Autorizacion de cotizaciones, saldo de almacen en refacturacion

This commit is contained in:
2021-08-28 11:19:27 -07:00
parent f88b519507
commit d377739ac9

View File

@@ -1834,6 +1834,15 @@ Partial Class Ventas
ViewState("CveEstatus") = value ViewState("CveEstatus") = value
End Set End Set
End Property End Property
Private Property CveEstatusCotizacion As Integer
Get
Return (IfNull(ViewState("CveEstatusCotizacion"), "-1", ViewState("CveEstatusCotizacion"))).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveEstatusCotizacion") = value
End Set
End Property
Private Property DiasCredito As Integer Private Property DiasCredito As Integer
Get Get
Return ViewState("DiasCredito").ToString().ToEntero() Return ViewState("DiasCredito").ToString().ToEntero()
@@ -2939,6 +2948,18 @@ Partial Class Ventas
End If End If
End If End If
If Request("CveCotizacion") IsNot Nothing AndAlso IfNull(Request("CveCotizacion"), 0).ToString().ToEntero() > 0 Then
If UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then
'VERIFICA SI NO ESTA AUTORIZADA
If CveEstatusCotizacion <> 8 Then
BtnEmitirImprimir.Enabled = False
BtnEmitirImprimir.Visible = False
Alert("La cotización no esta autorizada", TipoMensaje.MsgAdvertencia)
End If
End If
End If
End If End If
''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ??? ''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ???
@@ -4426,6 +4447,8 @@ Partial Class Ventas
' BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) ' BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True)
' BtnsFacturar.Visible = True ' BtnsFacturar.Visible = True
'End If 'End If
ElseIf DbRowVenta("TipoDocto").ToString() = "Cot" AndAlso CveCotizacion > 0 Then
CveEstatusCotizacion = DbRowVenta("CveEstatusFactura").ToString().ToEntero()
End If End If
@@ -8207,13 +8230,12 @@ Partial Class Ventas
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If End If
End If
'MARCAR VENTA ANTERIOR 'MARCAR VENTA ANTERIOR
If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If End If
Else
'MARCA LO PENDIENTE A NIVEL DETALLE 'MARCA LO PENDIENTE A NIVEL DETALLE
Dim DtMovDetalles As DataTable = Nothing Dim DtMovDetalles As DataTable = Nothing
If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then
@@ -8222,18 +8244,42 @@ Partial Class Ventas
ErrorList.Add("No se pudo verificar los movimientos de almacen de la factura") ErrorList.Add("No se pudo verificar los movimientos de almacen de la factura")
End If End If
'MARCAR VENTA ANTERIOR
If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If
If DtMovDetalles IsNot Nothing Then If DtMovDetalles IsNot Nothing Then
Dim CantidadTotal As Decimal = 0
Dim TotalSalida As Decimal = 0
For Each Row As DataRow In DtMovDetalles.Rows For Each Row As DataRow In DtMovDetalles.Rows
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToDecimal() Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToDecimal()
If SaldoAlmacen < 0 Then Cantidad += Cantidad
If SaldoAlmacen < 0 AndAlso Cantidad = Math.Abs(SaldoAlmacen) Then
TotalSalida += Math.Abs(SaldoAlmacen)
If Not ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1) Then If Not ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1) Then
ErrorList.Add("No se pudo actualizar el movimiento de almacen de la factura") ErrorList.Add("No se pudo actualizar el movimiento de almacen de la factura")
End If End If
End If End If
Next Next
'SI SE VERIFICA QUE TODO ESTA SURTIDO, SE MARCA TODA LA FACTURA
If CantidadTotal = Total Then
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If
End If
End If End If
DtMovDetalles.Dispose() DtMovDetalles.Dispose()
End If
End If End If
End If End If