Cancelar movimientos de usados
This commit is contained in:
@@ -2058,24 +2058,36 @@ Namespace Modelos
|
|||||||
End Sub
|
End Sub
|
||||||
Private Function CancelarMovimientosUsados(factura As Modelos.Factura, UsuarioActual As Usuario, ByRef ObjAcum As ClsAcumuladores) As Boolean
|
Private Function CancelarMovimientosUsados(factura As Modelos.Factura, UsuarioActual As Usuario, ByRef ObjAcum As ClsAcumuladores) As Boolean
|
||||||
Dim Retorno As Boolean = True
|
Dim Retorno As Boolean = True
|
||||||
If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=2) Then
|
|
||||||
Dim CveConceptoSalida As Integer = 2
|
|
||||||
|
|
||||||
Dim DtSalidas As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0")
|
Dim CveConcepto As Integer = -1
|
||||||
If DtSalidas IsNot Nothing AndAlso DtSalidas.Rows.Count > 0 Then
|
|
||||||
For Each RowSalida As DataRow In DtSalidas.Rows
|
Select Case factura.TipoDocto
|
||||||
|
Case "Ing"
|
||||||
|
CveConcepto = 2
|
||||||
|
Case "Dev"
|
||||||
|
CveConcepto = 1
|
||||||
|
Case "RNC"
|
||||||
|
CveConcepto = 1
|
||||||
|
Case "Egs"
|
||||||
|
CveConcepto = 6
|
||||||
|
End Select
|
||||||
|
|
||||||
|
If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=CveConcepto) Then
|
||||||
|
Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0")
|
||||||
|
If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then
|
||||||
|
For Each RowSalida As DataRow In DtMovimientos.Rows
|
||||||
Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1
|
Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1
|
||||||
|
|
||||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConceptoSalida, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then
|
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then
|
||||||
Retorno = False
|
Retorno = False
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
DtSalidas.Dispose()
|
DtMovimientos.Dispose()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Return Retorno
|
Return Retorno
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
Private Function GuardarUsados(ByRef ObjAcum As ClsAcumuladores, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, factura As Modelos.Factura, ByRef Optional Resp As MMensajeFactura = Nothing) As Boolean
|
Private Function GuardarUsados(ByRef ObjAcum As ClsAcumuladores, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, factura As Modelos.Factura, ByRef Optional Resp As MMensajeFactura = Nothing) As Boolean
|
||||||
Dim Resultado As Boolean = True
|
Dim Resultado As Boolean = True
|
||||||
@@ -5420,7 +5432,7 @@ Namespace Modelos
|
|||||||
|
|
||||||
'CANCELA MOVIMIENTOS DE USADOS
|
'CANCELA MOVIMIENTOS DE USADOS
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
If ObjFactura.TipoDocto = "Ing" Then
|
If ObjFactura.TipoDocto.Contiene("Ing", "Dev", "RNC", "Egs") Then
|
||||||
If Not CancelarMovimientosUsados(ObjFactura, UsuarioActual, ObjAcum) Then
|
If Not CancelarMovimientosUsados(ObjFactura, UsuarioActual, ObjAcum) Then
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
MensajeError = "Ocurrió un error al cancelar los movimientos de usados"
|
MensajeError = "Ocurrió un error al cancelar los movimientos de usados"
|
||||||
|
|||||||
Reference in New Issue
Block a user