Correciones en cancelacion, carga de inventario
This commit is contained in:
@@ -929,7 +929,8 @@ Public Class ClsAcumuladores
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
|
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
|
Dim Retorno As Boolean = False
|
||||||
'Data = New DataTable
|
'Data = New DataTable
|
||||||
|
|
||||||
@@ -947,6 +948,8 @@ Public Class ClsAcumuladores
|
|||||||
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
|
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
|
||||||
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
|
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
|
||||||
.Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng
|
.Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng
|
||||||
|
.Add("@CveVentaBonificacion", SqlDbType.Int).Value = CveVentaBonificacion
|
||||||
|
.Add("@FacturadoBonificacion", SqlDbType.Bit).Value = FacturadoBonificacion
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
Timbre = New CFDITimbre
|
Timbre = New CFDITimbre
|
||||||
End Sub
|
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.UsuarioActual = UsuarioActual
|
||||||
Me.CveVenta = CveVenta
|
Me.CveVenta = CveVenta
|
||||||
Me.CveEmpresa = CveEmpresa
|
Me.CveEmpresa = CveEmpresa
|
||||||
@@ -391,7 +391,7 @@ Namespace Modelos
|
|||||||
IniciaValores()
|
IniciaValores()
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas()
|
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
|
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
setValues(ObjVentas.DtResultados.Rows(0))
|
setValues(ObjVentas.DtResultados.Rows(0))
|
||||||
|
|
||||||
@@ -2101,21 +2101,34 @@ Namespace Modelos
|
|||||||
Case "Egs"
|
Case "Egs"
|
||||||
CveConcepto = 6
|
CveConcepto = 6
|
||||||
End Select
|
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 FacturadoBonificacion = False
|
||||||
Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0")
|
Dim CveVentaBonificacion As Integer = -1
|
||||||
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 Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then
|
If factura.TipoDocto = "RNC" Then
|
||||||
Retorno = False
|
CveVentaBonificacion = RowSalida("CveVentaBonificacion").ToString().ToEntero()
|
||||||
Exit For
|
FacturadoBonificacion = CBool(RowSalida("FacturadoBonificacion").ToString())
|
||||||
End If
|
End If
|
||||||
Next
|
|
||||||
DtMovimientos.Dispose()
|
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
|
End If
|
||||||
|
Else
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
@@ -2217,7 +2230,7 @@ Namespace Modelos
|
|||||||
|
|
||||||
End Function
|
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
|
Dim CveMovimiento As Integer = -1
|
||||||
Try
|
Try
|
||||||
Dim CveConceptoSalidaUsado As Integer = 45
|
Dim CveConceptoSalidaUsado As Integer = 45
|
||||||
@@ -2240,7 +2253,7 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If CveMovimiento > 0 Then
|
If GenerarPrePoliza AndAlso CveMovimiento > 0 Then
|
||||||
Dim Concepto As String = "Cancelación Usado" & factura.SerieFolio
|
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 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
|
Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
|
||||||
@@ -2498,7 +2511,7 @@ Namespace Modelos
|
|||||||
Dim TipoMovto68 = TipoMovimiento
|
Dim TipoMovto68 = TipoMovimiento
|
||||||
'SI ES CANCELACION DEBE GENERAR EL MOVIMIENTO DE SALIDA DE USADOS
|
'SI ES CANCELACION DEBE GENERAR EL MOVIMIENTO DE SALIDA DE USADOS
|
||||||
If ValorMultiplicador = -1 Then
|
If ValorMultiplicador = -1 Then
|
||||||
CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta)
|
CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta, GenerarPrePoliza:=False)
|
||||||
Else
|
Else
|
||||||
CveMovimientoReferencia = CveMovimiento
|
CveMovimientoReferencia = CveMovimiento
|
||||||
End If
|
End If
|
||||||
@@ -5675,6 +5688,11 @@ Namespace Modelos
|
|||||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10")
|
DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10")
|
||||||
CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 1").ToString().ToEntero()
|
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()
|
CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 10").ToString().ToEntero()
|
||||||
|
|
||||||
CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
|
CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
|
||||||
|
|||||||
@@ -2278,7 +2278,7 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
Me.ObjFactura = Nothing
|
Me.ObjFactura = Nothing
|
||||||
End If
|
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
|
If Me.ObjFactura IsNot Nothing Then
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user