BDH. Calculo de importes desde codigo, separacion de conceptos de acreditamiento por cargo y bonificacion

This commit is contained in:
2023-01-11 18:45:48 -07:00
parent fe7c9ff518
commit 35c2908b7a
4 changed files with 227 additions and 105 deletions

View File

@@ -928,7 +928,7 @@ Public Class ClsAcumuladores
End Function End Function
#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, 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, 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 Optional CveVentaBonificacion As Integer = -1, Optional FacturadoBonificacion As Boolean = False) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
@@ -940,6 +940,9 @@ Public Class ClsAcumuladores
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad .Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad
.Add("@CveTamaño", SqlDbType.Int).Value = CveTamaño .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("@CveConcepto", SqlDbType.Int).Value = CveConcepto
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta .Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
@@ -961,7 +964,8 @@ Public Class ClsAcumuladores
Return Retorno Return Retorno
End Function 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 Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -973,6 +977,7 @@ Public Class ClsAcumuladores
.Add("@FechaI", SqlDbType.Date).Value = FechaI .Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveVentaRNCCargo", SqlDbType.Int).Value = CveVentaRNCCargo .Add("@CveVentaRNCCargo", SqlDbType.Int).Value = CveVentaRNCCargo
.Add("@CveVentaRNCBonificacion", SqlDbType.Int).Value = CveVentaRNCBonificacion
.Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto .Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto
End With End With

View File

@@ -2102,12 +2102,17 @@ Namespace Modelos
CveConcepto = 6 CveConcepto = 6
End Select End Select
'SI ES FACTURA,NC,DEV O ES RNC DE CARGO, CANCELAR MOVIMIENTOS '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 If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=CveConcepto) Then
Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0") Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0")
If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then
For Each RowSalida As DataRow In DtMovimientos.Rows 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
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 FacturadoBonificacion = False
Dim CveVentaBonificacion As Integer = -1 Dim CveVentaBonificacion As Integer = -1
@@ -2117,15 +2122,15 @@ Namespace Modelos
FacturadoBonificacion = CBool(RowSalida("FacturadoBonificacion").ToString()) FacturadoBonificacion = CBool(RowSalida("FacturadoBonificacion").ToString())
End If 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 Retorno = False
Exit For Exit For
End If End If
Next Next
DtMovimientos.Dispose() DtMovimientos.Dispose()
End If End If
End If End If
Else
End If End If
@@ -2138,15 +2143,25 @@ Namespace Modelos
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
If factura.TipoDocto = "Ing" AndAlso factura.Cliente.EsDistribuidor 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 For Each drow As DataRow In factura.DtDetalle.Rows
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then If drow("CveTamaño").ToString.ToEntero > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario, 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 UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then
Resultado = False Resultado = False
Exit For Exit For
End If End If
Else
Resultado = False
Exit For
End If
End If End If
Next Next
@@ -2197,13 +2212,22 @@ Namespace Modelos
If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then 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, 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 UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then
' Mensaje = "Error al guardar Movimientos de distribuidor" ' Mensaje = "Error al guardar Movimientos de distribuidor"
Resultado = False Resultado = False
Exit For Exit For
End If End If
Else
Resultado = False
Exit For
End If
End If End If
End If End If
@@ -4867,6 +4891,11 @@ Namespace Modelos
AplicaRefacturacionConPagos = True AplicaRefacturacionConPagos = True
End If 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 'VALIDA QUE LA FACTURA NO TENGA PAGOS
If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then 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." 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}") DtSalidas = DtInventario.FiltraParametros($"CvePS IS NULL AND {Filtro}")
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then 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 End If
If ObjFactura.TipoDocto = "Ing" Then If ObjFactura.TipoDocto = "Ing" Then
@@ -5593,7 +5625,7 @@ Namespace Modelos
If DtVirtuales IsNot Nothing Then If DtVirtuales IsNot Nothing Then
For Each RowVirtual As DataRow In DtVirtuales.Rows For Each RowVirtual As DataRow In DtVirtuales.Rows
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL '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 ErrorCancelar = True
MensajeError = "Ocurrió un error al realizar la devolución del virtual. Por favor vuelva a intentar." MensajeError = "Ocurrió un error al realizar la devolución del virtual. Por favor vuelva a intentar."
End If End If
@@ -6130,7 +6162,7 @@ Namespace Modelos
Return Not ErrorCancelar Return Not ErrorCancelar
End Function 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 Dim ErrorCancelar As Boolean = False
Try Try
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
@@ -6163,6 +6195,10 @@ Namespace Modelos
End If End If
Dim CveConceptoMovimientoVirtual As Integer = 36 Dim CveConceptoMovimientoVirtual As Integer = 36
If TipoDocto = "Dev" Then
CveConceptoMovimientoVirtual = 37
End If
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimientoDevolucion Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimientoDevolucion
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
@@ -7382,6 +7418,14 @@ Namespace Modelos
#End Region #End Region
#Region "G L O B A L - D T" #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 Public Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double
Get Get
If GlobalTipoCambio <= 0 Then If GlobalTipoCambio <= 0 Then

View File

@@ -1318,13 +1318,19 @@ Partial Class Inventarios_RecepcionUsados
If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, 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(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, Now, CveMovimiento:=CveMovimiento) Then UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, Now, CveMovimiento:=CveMovimiento) Then
Mensaje = "Error al guardar Movimientos de distribuidor" Mensaje = "Error al guardar Movimientos de distribuidor"
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If End If
End If
End If End If
Next Next

View File

@@ -4702,6 +4702,15 @@ Partial Class Ventas
If AplicaCancelarRemision AndAlso CveEstatus.Contiene(2, 3) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then DivCanRem.Visible = True If AplicaCancelarRemision AndAlso CveEstatus.Contiene(2, 3) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then DivCanRem.Visible = True
VentaSaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal VentaSaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal
If DbRowVenta("TipoDocto").ToString().Contiene("Rem", "Dev") AndAlso VentaSaldoAlmacen <> 0 Then
ChkDevAlm.Checked = True
LiDevolucionAlmacen.Visible = True
If DbRowVenta("TipoDocto").ToString() = "Dev" Then
LblDevAlm.Text = "Salida de almacen"
End If
End If
If CveEstatus = 5 Then LbCancelarDocumento.Enabled = False If CveEstatus = 5 Then LbCancelarDocumento.Enabled = False
'If CveEstatus = 20 Then 'If CveEstatus = 20 Then
' LbCancelarDocumentoManual.Visible = True ' LbCancelarDocumentoManual.Visible = True
@@ -9471,6 +9480,7 @@ Partial Class Ventas
Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
Dim ObjDocCliente As New ClsEdocumentacion(ObjVentas.IniciaTransacSQL()) Dim ObjDocCliente As New ClsEdocumentacion(ObjVentas.IniciaTransacSQL())
Dim ObjGeneral As New ClsGenerales(ObjVentas.IniciaTransacSQL()) Dim ObjGeneral As New ClsGenerales(ObjVentas.IniciaTransacSQL())
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
Dim ObjContPaq As ClsContPAQi = Nothing Dim ObjContPaq As ClsContPAQi = Nothing
'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) 'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
@@ -9541,7 +9551,7 @@ Partial Class Ventas
Dim CveTimbreCartaPorte As Integer = -1 Dim CveTimbreCartaPorte As Integer = -1
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion, CveAnticipoPadre:=CveAnticipoPadre) ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion, CveAnticipoPadre:=CveAnticipoPadre)
If ErrorList.Count = 0 AndAlso ChkEmitirCartaPorte.Checked AndAlso ObjFactura.TipoDocto = "Ing" Then If ErrorList.Count = 0 AndAlso ChkEmitirCartaPorte.Checked AndAlso ObjFactura.TipoDocto = "Ing" Then
@@ -9668,7 +9678,7 @@ Partial Class Ventas
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) Then If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) Then
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento) CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing, If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(If(DtVentasNC IsNot Nothing, DtVentasNC.Rows.Count - 1, 0))) Then Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(If(DtVentasNC IsNot Nothing, DtVentasNC.Rows.Count - 1, 0))) Then
ListaNotasCreditoGeneradas.Add(ObjFacturaDevolucion) ListaNotasCreditoGeneradas.Add(ObjFacturaDevolucion)
End If End If
@@ -9681,7 +9691,7 @@ Partial Class Ventas
End If End If
CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento) CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing, If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing,
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
ListaNotasCreditoGeneradas.Add(ObjFacturaBonificacion) ListaNotasCreditoGeneradas.Add(ObjFacturaBonificacion)
End If End If
@@ -9839,12 +9849,6 @@ Partial Class Ventas
End If End If
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then
ObjVentas.Commit() ObjVentas.Commit()
'ENVIAR POLIZA VIRTUAL 'ENVIAR POLIZA VIRTUAL
@@ -9854,7 +9858,6 @@ Partial Class Ventas
End If End If
End If End If
'ContPAQ El movimiento 1 es el de Venta 'ContPAQ El movimiento 1 es el de Venta
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
@@ -9891,7 +9894,6 @@ Partial Class Ventas
OnError("Ocurrió un error al contabilizar la factura", ex) OnError("Ocurrió un error al contabilizar la factura", ex)
End Try End Try
Try Try
'RMF, cuando es pedido, se manda autorización. 'RMF, cuando es pedido, se manda autorización.
If ObjFactura.TipoDocto.Contiene("PA") Then If ObjFactura.TipoDocto.Contiene("PA") Then
@@ -10133,12 +10135,8 @@ Partial Class Ventas
If ArchivoCotRdlc.Exists Or ArchivoCotMrt.Exists Then If ArchivoCotRdlc.Exists Or ArchivoCotMrt.Exists Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
If ChkEnviarFacturaCRM.Checked AndAlso CorreoContactoCRM.Trim.Length > 0 Then If ChkEnviarFacturaCRM.Checked AndAlso CorreoContactoCRM.Trim.Length > 0 Then
Try Try
Dim pdfCRM As Byte() = Nothing Dim pdfCRM As Byte() = Nothing
'If CveVenta > 0 Then 'If CveVenta > 0 Then
' ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False) ' ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
@@ -10151,16 +10149,10 @@ Partial Class Ventas
GeneraPDFCotizacion(True, CorreoContactoCRM:=CorreoContactoCRM, pdfCRM:=pdfCRM, SerieFolioCRM:=SerieFolioCRM, TipoDoctoCRM:=TipoDoctoCRM) GeneraPDFCotizacion(True, CorreoContactoCRM:=CorreoContactoCRM, pdfCRM:=pdfCRM, SerieFolioCRM:=SerieFolioCRM, TipoDoctoCRM:=TipoDoctoCRM)
End If End If
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al enviar el PDF", ex) OnError("Ocurrió un error al enviar el PDF", ex)
End Try End Try
End If End If
Else Else
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
End If End If
@@ -10178,9 +10170,6 @@ Partial Class Ventas
End If End If
End If End If
'ERROR DE NO TIMBRADO 'ERROR DE NO TIMBRADO
If Not SeTimbro And (DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or DdlTipoComprobante.SelectedValue = "Ant") Then If Not SeTimbro And (DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or DdlTipoComprobante.SelectedValue = "Ant") Then
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.") MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.")
@@ -10202,12 +10191,10 @@ Partial Class Ventas
End Select End Select
If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then
RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}'", "Imprimir") RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}'", "Imprimir")
End If End If
'DESCARGAR PDF DE CICOVISA 'DESCARGAR PDF DE CICOVISA
'If UsuarioActual.CveEmpresa = 72 And CveCliente = 70381 Then 'If UsuarioActual.CveEmpresa = 72 And CveCliente = 70381 Then
' If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then ' If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then
@@ -10235,8 +10222,6 @@ Partial Class Ventas
End If End If
GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO
Else
'Enviar pore correo cot CRM
End If End If
ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
If UsuarioActual.CveEmpresa.Contiene(81, 109) Then If UsuarioActual.CveEmpresa.Contiene(81, 109) Then
@@ -10311,7 +10296,6 @@ Partial Class Ventas
Alert(MensajeAlert.ToString(), TipoMensaje.MsgDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False) Alert(MensajeAlert.ToString(), TipoMensaje.MsgDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False)
End If End If
MensajeAlert.Clear() MensajeAlert.Clear()
Try Try
@@ -10324,7 +10308,6 @@ Partial Class Ventas
OnError("Ocurrió un error al limpiar los datos", ex) OnError("Ocurrió un error al limpiar los datos", ex)
End Try End Try
Else Else
ObjVentas.RollBack() ObjVentas.RollBack()
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
@@ -10343,6 +10326,7 @@ Partial Class Ventas
ObjCGame.Dispose() ObjCGame.Dispose()
ObjContr.Dispose() ObjContr.Dispose()
ObjDocCliente.Dispose() ObjDocCliente.Dispose()
ObjAcum.Dispose()
'ObjFolios.Dispose() 'ObjFolios.Dispose()
ErrorList.Clear() ErrorList.Clear()
ErrorList = Nothing ErrorList = Nothing
@@ -10986,24 +10970,27 @@ Partial Class Ventas
End Sub End Sub
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjAcum As ClsAcumuladores, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi,
ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False,
Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional IndexNC As Integer = 0) As Boolean Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional IndexNC As Integer = 0) As Boolean
Dim ProcesoCorrecto As Boolean = True Dim ProcesoCorrecto As Boolean = True
'GENERAMOS EL NUEVO FOLIO 'GENERAMOS EL NUEVO FOLIO
Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) 'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then 'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero())) ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero()))
If DT.Rows.Count > 0 Then ' If DT.Rows.Count > 0 Then
factura.Serie = DT.Rows(0)("Serie").ToString() ' factura.Serie = DT.Rows(0)("Serie").ToString()
factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() ' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero()
Else ' Else
ProcesoCorrecto = False ' ProcesoCorrecto = False
End If ' End If
DT.Dispose() ' DT.Dispose()
End If 'End If
factura.Serie = "-1"
factura.Folio = -1
If NCDescuento Then If NCDescuento Then
@@ -11019,7 +11006,7 @@ Partial Class Ventas
factura.CveVentaPadre = Me.CveVenta factura.CveVentaPadre = Me.CveVenta
'Registramos la venta 'Registramos la venta
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento) GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento)
Else Else
'GENERO LOS DATOS DE LA NC 'GENERO LOS DATOS DE LA NC
@@ -11158,7 +11145,7 @@ Partial Class Ventas
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion) ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
'Registramos la venta 'Registramos la venta
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True) GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
Else Else
ErrorList.Add("No se encontró un producto para generar la nota de crédito") ErrorList.Add("No se encontró un producto para generar la nota de crédito")
@@ -12916,7 +12903,7 @@ Partial Class Ventas
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO " #Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer, Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjAcum As ClsAcumuladores, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer,
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing,
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional CveAnticipoPadre As Integer = -1) ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional CveAnticipoPadre As Integer = -1)
@@ -13128,11 +13115,11 @@ Partial Class Ventas
'SI ES REFACTURACION, NO DEBE AFECTAR LOS USADOS 'SI ES REFACTURACION, NO DEBE AFECTAR LOS USADOS
If Not NuevaFactura.Contiene(1) Then If Not NuevaFactura.Contiene(1) Then
If ObjFactura.TipoDocto = "Ing" Then If ObjFactura.TipoDocto = "Ing" Then
If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura) Then If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura, ObjAcum) Then
ErrorList.Add("Error al guardar usados") ErrorList.Add("Error al guardar usados")
End If End If
ElseIf ObjFactura.TipoDocto = "Dev" Then ElseIf ObjFactura.TipoDocto = "Dev" Then
If Not GuardarUsados(1, ObjVentas.IniciaTransacSQL, factura) Then If Not GuardarUsados(1, ObjVentas.IniciaTransacSQL, factura, ObjAcum) Then
ErrorList.Add("Error al guardar usados") ErrorList.Add("Error al guardar usados")
End If End If
End If End If
@@ -13238,7 +13225,6 @@ Partial Class Ventas
Dim ListaRNC As List(Of Modelos.Factura) = Nothing Dim ListaRNC As List(Of Modelos.Factura) = Nothing
If NCDescuento Then If NCDescuento Then
EsCargo = (Not ListaNCDescuento.Any(Function(RNC) RNC.Num2 = 1))
ListaRNC = ListaNCDescuento ListaRNC = ListaNCDescuento
Else Else
EsCargo = RblRNCTipo.SelectedValue = "1" EsCargo = RblRNCTipo.SelectedValue = "1"
@@ -13246,26 +13232,93 @@ Partial Class Ventas
End If End If
'SI SE FACTURAN RNC DE CARGO, SE AGREGA EL CONCEPTO DE ACREDITAMIENTO 'SI SE FACTURAN RNC DE CARGO, SE AGREGA EL CONCEPTO DE ACREDITAMIENTO
If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso EsCargo AndAlso Not factura.EsGarantia Then If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
Dim CvePSCargo As Integer = -1 Dim CvePSCargo As Integer = -1
For Each RNC In ListaRNC Dim CveVentaRNC As Integer = -1
For Each RNC As Modelos.Factura In ListaRNC
If NCDescuento Then
EsCargo = (Not RNC.Num1 = 2)
End If
CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero() CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero()
If CvePSCargo > 0 Then CveVentaRNC = RNC.DtDetalle.FiltroPrimeroValor("CveVenta", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero()
If EsCargo Then
If Not ObjAcum.DistribuidorMovtosGet(Me.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
ErrorList.Add("Ocurrió un error al obtener los movimientos del distribuidor.")
Exit For Exit For
End If End If
Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero($"CvePSCargo={CvePSCargo}")
If RowMovto IsNot Nothing Then
'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO
Dim ImporteCargoOriginal = (RowMovto("ImporteCargo").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2)
'Dim ImporteBonificacionOriginal = (RowMovto("ImporteBonificacion").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2)
Dim PuntosOriginales = (RowMovto("Puntos").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2)
Dim CveTamanio As Integer = RowMovto("CveTamaño").ToString().ToEntero()
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim Puntos As Decimal = Cantidad * PuntosOriginales
Dim Cargo As Decimal = Cantidad * ImporteCargoOriginal
Dim Bonificacion As Decimal = 0
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, Bonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
ErrorList.Add("Ocurrió un error al agregar el movimiento de distribuidor.")
Exit For
End If
End If
Else
Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo={CvePSCargo}")
If DrTamanio IsNot Nothing Then
'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO
Dim ImporteBonificacion = Row("Total").ToString().ToDecimal().RoundSQL(2)
Dim CveTamanio As Integer = DrTamanio("CveTamaño").ToString().ToEntero()
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim Puntos As Decimal = 0
Dim Cargo As Decimal = 0
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, ImporteBonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
ErrorList.Add("Ocurrió un error al agregar el movimiento de distribuidor.")
Exit For
End If
End If
End If
Next Next
Dim CveTamanio As Integer = GlobalDTAcumTamaños().FiltroPrimeroValor("CveTamaño", $"CvePSCargo={CvePSCargo}").ToEntero() 'Dim RowTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo={CvePSCargo}")
If CveTamanio > 0 Then 'If RowTamanio IsNot Nothing Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Row("Cantidad").ToString().ToDecimal(), CveTamanio, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then ' Dim CveTamanio As Integer = RowTamanio("CveTamaño").ToString().ToEntero()
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.") ' Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Exit For ' Dim Puntos As Decimal = Cantidad * RowTamanio("Puntos").ToString().ToDecimal()
End If ' Dim Cargo As Decimal = Cantidad * RowTamanio("Cargo").ToString().ToDecimal()
End If ' Dim Bonificacion As Decimal = Cantidad * RowTamanio("Bonificacion").ToString().ToDecimal()
' If EsCargo Then
' Bonificacion = 0
' Else
' Puntos = 0
' Cargo = 0
' End If
' If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, Bonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
' ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
' Exit For
' End If
'End If
End If End If
End If End If
@@ -24786,9 +24839,9 @@ Partial Class Ventas
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then 'If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("Rem", "Dev") Then
ChkDevAlm.Checked = True ' ChkDevAlm.Checked = True
End If 'End If
If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then
ChkDevAlm.Checked = True ChkDevAlm.Checked = True
@@ -29314,13 +29367,15 @@ Partial Class Ventas
End If End If
UltimoRenglonRNC += 1 UltimoRenglonRNC += 1
Dim CveVentaDetalleRNC As Integer = RNCBonificacion.DtDetalle.FiltroPrimeroValor("CveVentaDetalle").ToEntero()
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO 'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(), AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=CveVentaDetalleRNC, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
End If End If
Next Next
@@ -32935,29 +32990,36 @@ Partial Class Ventas
End If End If
End Sub End Sub
Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura) As Boolean Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura, ObjAcum As ClsAcumuladores) As Boolean
Dim Resultado As Boolean = True Dim Resultado As Boolean = True
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
If ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then If ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
For Each drow As DataRow In factura.DtDetalle.Rows For Each drow As DataRow In factura.DtDetalle.Rows
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then If drow("CveTamaño").ToString.ToEntero > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, 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 drow("CveTamaño").ToString.ToEntero > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0D, "", Now) Then UsuarioActual.CveEmpresa, 0D, "", Now) Then
Resultado = False Resultado = False
Exit For Exit For
End If End If
End If End If
Next
Else Else
Resultado = True Resultado = False
Exit For
End If
End If
Next
End If
End If End If
Return Resultado Return Resultado
End Function End Function
@@ -36023,6 +36085,9 @@ Partial Class Ventas
Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs)
TxtFechaPago.Enabled = True
imgCalendario.Visible = True
If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
RBLPago.SelectedValue = "1" RBLPago.SelectedValue = "1"
RBLPago.Enabled = False RBLPago.Enabled = False
@@ -36037,6 +36102,8 @@ Partial Class Ventas
'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL
If RowLinea("TipoLinea").ToString() = "2" Then If RowLinea("TipoLinea").ToString() = "2" Then
TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy")
TxtFechaPago.Enabled = False
imgCalendario.Visible = False
End If End If
Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero()