diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb
index 0ad493781..1fbcf36dd 100644
--- a/App_Code/ClsAcumuladores.vb
+++ b/App_Code/ClsAcumuladores.vb
@@ -925,10 +925,10 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al eliminar poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
- End Function
+ End Function
#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, Puntos As Decimal, ImporteCargo As Decimal, ImporteBonificacion As Decimal, 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,
Optional CveVentaBonificacion As Integer = -1, Optional FacturadoBonificacion As Boolean = False) As Boolean
Dim Retorno As Boolean = False
@@ -940,6 +940,9 @@ Public Class ClsAcumuladores
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad
.Add("@CveTamaño", SqlDbType.Int).Value = CveTamaño
+ .Add("@Puntos", SqlDbType.Money).Value = Puntos
+ .Add("@ImporteCargo", SqlDbType.Money).Value = ImporteCargo
+ .Add("@ImporteBonificacion", SqlDbType.Money).Value = ImporteBonificacion
.Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
@@ -961,7 +964,8 @@ Public Class ClsAcumuladores
Return Retorno
End Function
- Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha, Optional CveVentaRNCCargo As Integer = -1, Optional CveConcepto As Integer = -1) As Boolean
+ Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha,
+ Optional CveVentaRNCCargo As Integer = -1, Optional CveVentaRNCBonificacion As Integer = -1, Optional CveConcepto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -973,6 +977,7 @@ Public Class ClsAcumuladores
.Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveVentaRNCCargo", SqlDbType.Int).Value = CveVentaRNCCargo
+ .Add("@CveVentaRNCBonificacion", SqlDbType.Int).Value = CveVentaRNCBonificacion
.Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto
End With
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 887b33ddb..7c3dfc1d2 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -4313,6 +4313,40 @@ Public Class ClsPaginas
End Set
End Property
+#Region "CITRUS GAME"
+ Property GlobalDTGralEmpacados(CveEmpresa As Integer) As DataTable
+ Get
+ Dim AppNombre As String = $"GlobalDTGralEmpacados-{CveEmpresa}"
+ If Application(AppNombre) Is Nothing Then
+ Dim ObjGenerales As New ClsGenerales()
+ If ObjGenerales.GetEmpacados(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados
+ ObjGenerales.Dispose()
+ End If
+
+ GlobalDTGralEmpacados = DirectCast(Application(AppNombre), DataTable)
+ End Get
+ Set(value As DataTable)
+ Dim AppNombre As String = $"GlobalDTGralEmpacados-{CveEmpresa}"
+ Application(AppNombre) = value
+ End Set
+ End Property
+ Property GlobalDTGralTipoOrganicos(CveEmpresa As Integer) As DataTable
+ Get
+ Dim AppNombre As String = $"GlobalDTGralTipoOrganicos-{CveEmpresa}"
+ If Application(AppNombre) Is Nothing Then
+ Dim ObjGenerales As New ClsGenerales()
+ If ObjGenerales.GetTipoOrganicos(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados
+ ObjGenerales.Dispose()
+ End If
+
+ GlobalDTGralTipoOrganicos = DirectCast(Application(AppNombre), DataTable)
+ End Get
+ Set(value As DataTable)
+ Dim AppNombre As String = $"GlobalDTGralTipoOrganicos-{CveEmpresa}"
+ Application(AppNombre) = value
+ End Set
+ End Property
+#End Region
#End Region
@@ -4321,8 +4355,6 @@ Public Class ClsPaginas
DirectorioSitio = 2
eFacturasCaptcha = 3
-
-
RutaEmpresasJM = 500
RutaEmpresasRM = 501
RutaEmpresasPC = 502
diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index ec9cc547c..17861b78e 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -2102,12 +2102,17 @@ Namespace Modelos
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 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
+ Dim Puntos As Decimal = RowSalida("Puntos").ToString().ToDecimal()
+
+ Dim ImporteCargo As Decimal = RowSalida("ImporteCargo").ToString().ToDecimal()
+ Dim ImporteBonificacion As Decimal = RowSalida("ImporteBonificacion").ToString().ToDecimal()
Dim FacturadoBonificacion = False
Dim CveVentaBonificacion As Integer = -1
@@ -2117,15 +2122,15 @@ Namespace Modelos
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
+ If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, Puntos, ImporteCargo, ImporteBonificacion, 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
@@ -2138,15 +2143,25 @@ Namespace Modelos
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
If factura.TipoDocto = "Ing" AndAlso factura.Cliente.EsDistribuidor Then
- Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
For Each drow As DataRow In factura.DtDetalle.Rows
- If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
- If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario,
- UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then
+ If drow("CveTamaño").ToString.ToEntero > 0 Then
+ Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CveTamaño={drow("CveTamaño").ToString.ToEntero}")
+ If DrTamanio IsNot Nothing Then
+ Dim Cargo As Decimal = DrTamanio("Cargo").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal()
+ Dim Bonificacion As Decimal = DrTamanio("Bonificacion").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal()
+ Dim Puntos As Decimal = DrTamanio("Puntos").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal()
+
+ If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, 2, factura.CveVenta, UsuarioActual.CveUsuario,
+ UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then
+ Resultado = False
+ Exit For
+ End If
+ Else
Resultado = False
Exit For
End If
+
End If
Next
@@ -2197,13 +2212,22 @@ Namespace Modelos
If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then
- If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
- UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then
- ' Mensaje = "Error al guardar Movimientos de distribuidor"
+ Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CveTamaño={Dr("CveTamaño").ToString.ToEntero}")
+ If DrTamanio IsNot Nothing Then
+ Dim Cargo As Decimal = DrTamanio("Cargo").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal()
+ Dim Bonificacion As Decimal = DrTamanio("Bonificacion").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal()
+ Dim Puntos As Decimal = DrTamanio("Puntos").ToString().ToDecimal() * Dr("Cantidad").ToString.ToDecimal()
+
+ If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
+ UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then
+ ' Mensaje = "Error al guardar Movimientos de distribuidor"
+ Resultado = False
+ Exit For
+ End If
+ Else
Resultado = False
Exit For
End If
-
End If
End If
@@ -4867,6 +4891,11 @@ Namespace Modelos
AplicaRefacturacionConPagos = True
End If
+ 'SI NO TIENE PAGOS, DEBE SEGUIR EL CAMINO DE REFACTURACION NORMAL
+ If AplicaRefacturacionConPagos AndAlso ObjFactura.Pagado = 0 Then
+ AplicaRefacturacionConPagos = False
+ End If
+
'VALIDA QUE LA FACTURA NO TENGA PAGOS
If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
@@ -5380,7 +5409,10 @@ Namespace Modelos
DtSalidas = DtInventario.FiltraParametros($"CvePS IS NULL AND {Filtro}")
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
- DtVirtuales = DtInventario.FiltraParametros($"CvePS IS NULL AND CveConcepto = 37 AND CveTipoAlmacen = 24")
+ DtVirtuales = DtInventario.FiltraParametros($"CvePS IS NULL AND CveConcepto = 37")
+ If ObjFactura.TipoDocto = "Dev" Then
+ DtVirtuales = DtInventario.FiltraParametros($"CvePS IS NULL AND CveConcepto = 36")
+ End If
End If
If ObjFactura.TipoDocto = "Ing" Then
@@ -5593,7 +5625,7 @@ Namespace Modelos
If DtVirtuales IsNot Nothing Then
For Each RowVirtual As DataRow In DtVirtuales.Rows
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
- If Not ErrorCancelar AndAlso Not CancelarMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
+ If Not ErrorCancelar AndAlso Not CancelarMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario, TipoDocto:=ObjFactura.TipoDocto) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al realizar la devolución del virtual. Por favor vuelva a intentar."
End If
@@ -6130,7 +6162,7 @@ Namespace Modelos
Return Not ErrorCancelar
End Function
- Private Function CancelarMovimientosVirtuales(CveVenta As Integer, CveMovimientoDevolucion As Integer, CveMovimientoVirtualSalida As Integer, ByRef ObjInventario As ClsInventarios) As Boolean
+ Private Function CancelarMovimientosVirtuales(CveVenta As Integer, CveMovimientoDevolucion As Integer, CveMovimientoVirtualSalida As Integer, ByRef ObjInventario As ClsInventarios, Optional TipoDocto As String = "") As Boolean
Dim ErrorCancelar As Boolean = False
Try
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
@@ -6163,6 +6195,10 @@ Namespace Modelos
End If
Dim CveConceptoMovimientoVirtual As Integer = 36
+ If TipoDocto = "Dev" Then
+ CveConceptoMovimientoVirtual = 37
+ End If
+
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimientoDevolucion
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
@@ -7382,6 +7418,14 @@ Namespace Modelos
#End Region
#Region "G L O B A L - D T"
+ Property GlobalDTAcumTamaños() As DataTable
+ Get
+ GlobalDTAcumTamaños = DirectCast(HttpContext.Current.Application("GlobalDTAcumTamaños"), DataTable)
+ End Get
+ Set(value As DataTable)
+ HttpContext.Current.Application("GlobalDTAcumTamaños") = value
+ End Set
+ End Property
Public Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double
Get
If GlobalTipoCambio <= 0 Then
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 479eefe24..8c2a90d53 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -3519,7 +3519,7 @@ Partial Class Compras_Compras
ViewState("IdCtaContRetIVA") = ObjProveedor.IdCtaContRetIVA
ViewState("IdCtaContRetISR") = ObjProveedor.IdCtaContRetISR
- If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso ObjProveedor.IdCtaContProveedores < 1 Then
+ If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso ObjProveedor.IdCtaContProveedores < 1 Then
Alert("El Proveedor seleccionado no tiene cuenta contable asignada.", TipoMensaje.MsgAdvertencia)
End If
diff --git a/CxC/RepCxCDetalle.aspx b/CxC/RepCxCDetalle.aspx
index 60b7fda83..c30545abe 100644
--- a/CxC/RepCxCDetalle.aspx
+++ b/CxC/RepCxCDetalle.aspx
@@ -537,6 +537,7 @@