Correciones en cancelacion, carga de inventario
This commit is contained in:
@@ -929,7 +929,8 @@ Public Class ClsAcumuladores
|
||||
#End Region
|
||||
|
||||
Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
|
||||
CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1) As Boolean
|
||||
CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1,
|
||||
Optional CveVentaBonificacion As Integer = -1, Optional FacturadoBonificacion As Boolean = False) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
'Data = New DataTable
|
||||
|
||||
@@ -947,6 +948,8 @@ Public Class ClsAcumuladores
|
||||
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
|
||||
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
|
||||
.Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng
|
||||
.Add("@CveVentaBonificacion", SqlDbType.Int).Value = CveVentaBonificacion
|
||||
.Add("@FacturadoBonificacion", SqlDbType.Bit).Value = FacturadoBonificacion
|
||||
End With
|
||||
|
||||
Try
|
||||
|
||||
@@ -379,7 +379,7 @@ Namespace Modelos
|
||||
End If
|
||||
Timbre = New CFDITimbre
|
||||
End Sub
|
||||
Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False, Optional CargaDTDetalle As Boolean = True, Optional CargaDatosCliente As Boolean = True, Optional CargaDatosRelacionados As Boolean = True)
|
||||
Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False, Optional CargaDTDetalle As Boolean = True, Optional CargaDatosCliente As Boolean = True, Optional CargaDatosRelacionados As Boolean = True, Optional VerificaAlmacen As Boolean = True)
|
||||
Me.UsuarioActual = UsuarioActual
|
||||
Me.CveVenta = CveVenta
|
||||
Me.CveEmpresa = CveEmpresa
|
||||
@@ -391,7 +391,7 @@ Namespace Modelos
|
||||
IniciaValores()
|
||||
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then
|
||||
If ObjVentas.GetVenta(CveVenta, CveEmpresa, VerificaAlmacen:=VerificaAlmacen) Then
|
||||
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
setValues(ObjVentas.DtResultados.Rows(0))
|
||||
|
||||
@@ -2101,21 +2101,34 @@ Namespace Modelos
|
||||
Case "Egs"
|
||||
CveConcepto = 6
|
||||
End Select
|
||||
'SI ES FACTURA,NC,DEV O ES RNC DE CARGO, CANCELAR MOVIMIENTOS
|
||||
If factura.TipoDocto.Contiene("Ing", "Dev", "Egs") OrElse factura.TipoDocto.Contiene("RNC") AndAlso factura.Num1 = 1 Then
|
||||
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
|
||||
|
||||
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 FacturadoBonificacion = False
|
||||
Dim CveVentaBonificacion As Integer = -1
|
||||
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then
|
||||
Retorno = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
DtMovimientos.Dispose()
|
||||
If factura.TipoDocto = "RNC" Then
|
||||
CveVentaBonificacion = RowSalida("CveVentaBonificacion").ToString().ToEntero()
|
||||
FacturadoBonificacion = CBool(RowSalida("FacturadoBonificacion").ToString())
|
||||
End If
|
||||
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha, CveVentaBonificacion:=CveVentaBonificacion, FacturadoBonificacion:=FacturadoBonificacion) Then
|
||||
Retorno = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
DtMovimientos.Dispose()
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
@@ -2217,7 +2230,7 @@ Namespace Modelos
|
||||
|
||||
End Function
|
||||
|
||||
Private Function CancelarInventarioUsado(factura As Modelos.Factura, CveAlmacenUsado As Integer, CveMovimientoEntrada As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As Integer
|
||||
Private Function CancelarInventarioUsado(factura As Modelos.Factura, CveAlmacenUsado As Integer, CveMovimientoEntrada As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, Optional GenerarPrePoliza As Boolean = True) As Integer
|
||||
Dim CveMovimiento As Integer = -1
|
||||
Try
|
||||
Dim CveConceptoSalidaUsado As Integer = 45
|
||||
@@ -2240,7 +2253,7 @@ Namespace Modelos
|
||||
End If
|
||||
Next
|
||||
|
||||
If CveMovimiento > 0 Then
|
||||
If GenerarPrePoliza AndAlso CveMovimiento > 0 Then
|
||||
Dim Concepto As String = "Cancelación Usado" & factura.SerieFolio
|
||||
Dim CvePrePoliza = ObjConta.AddPrePolizas("Mod/CancSalUsados", 74, DtMovimientosEntrada.SUMD("Total"), DtMovimientosEntrada.SUMD("Total"), 1, tFecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
|
||||
@@ -2498,7 +2511,7 @@ Namespace Modelos
|
||||
Dim TipoMovto68 = TipoMovimiento
|
||||
'SI ES CANCELACION DEBE GENERAR EL MOVIMIENTO DE SALIDA DE USADOS
|
||||
If ValorMultiplicador = -1 Then
|
||||
CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta)
|
||||
CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta, GenerarPrePoliza:=False)
|
||||
Else
|
||||
CveMovimientoReferencia = CveMovimiento
|
||||
End If
|
||||
@@ -5675,6 +5688,11 @@ Namespace Modelos
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10")
|
||||
CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 1").ToString().ToEntero()
|
||||
'SI ES SERVICIO A DOMICILIO DEBE REGRESAR A ESTE TIPO DE ALMACEN
|
||||
If Me.ServicioDomicilio Then
|
||||
CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 29").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 10").ToString().ToEntero()
|
||||
|
||||
CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
|
||||
|
||||
@@ -2278,7 +2278,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Me.ObjFactura = Nothing
|
||||
End If
|
||||
|
||||
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
|
||||
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
|
||||
|
||||
If Me.ObjFactura IsNot Nothing Then
|
||||
|
||||
|
||||
Reference in New Issue
Block a user