Autorizacion de cotizaciones, saldo de almacen en refacturacion
This commit is contained in:
@@ -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,33 +8230,56 @@ 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
|
||||||
|
|
||||||
'MARCA LO PENDIENTE A NIVEL DETALLE
|
|
||||||
Dim DtMovDetalles As DataTable = Nothing
|
|
||||||
If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then
|
|
||||||
DtMovDetalles = ObjInventario.DtResultados.Copy()
|
|
||||||
Else
|
Else
|
||||||
ErrorList.Add("No se pudo verificar los movimientos de almacen de la factura")
|
'MARCA LO PENDIENTE A NIVEL DETALLE
|
||||||
End If
|
Dim DtMovDetalles As DataTable = Nothing
|
||||||
|
If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtMovDetalles = ObjInventario.DtResultados.Copy()
|
||||||
|
Else
|
||||||
|
ErrorList.Add("No se pudo verificar los movimientos de almacen de la factura")
|
||||||
|
End If
|
||||||
|
|
||||||
If DtMovDetalles IsNot Nothing Then
|
'MARCAR VENTA ANTERIOR
|
||||||
For Each Row As DataRow In DtMovDetalles.Rows
|
If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then
|
||||||
Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToDecimal()
|
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
|
||||||
If SaldoAlmacen < 0 Then
|
End If
|
||||||
If Not ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1) Then
|
|
||||||
ErrorList.Add("No se pudo actualizar el movimiento de almacen de la factura")
|
If DtMovDetalles IsNot Nothing Then
|
||||||
|
|
||||||
|
Dim CantidadTotal As Decimal = 0
|
||||||
|
Dim TotalSalida As Decimal = 0
|
||||||
|
|
||||||
|
For Each Row As DataRow In DtMovDetalles.Rows
|
||||||
|
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
|
||||||
|
Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToDecimal()
|
||||||
|
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
|
||||||
|
ErrorList.Add("No se pudo actualizar el movimiento de almacen de la factura")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
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
|
||||||
Next
|
End If
|
||||||
|
|
||||||
|
DtMovDetalles.Dispose()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
DtMovDetalles.Dispose()
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user