--FIX redondeo de factura global

This commit is contained in:
2024-04-10 15:21:56 -07:00
parent 7d0d730792
commit ef9b889453
2 changed files with 10 additions and 10 deletions

View File

@@ -1458,7 +1458,7 @@ Namespace Modelos
Optional CveSubProyecto As Integer = -1,
Optional SubProyecto As String = "", Optional PorcentajeIVA As Decimal = -1,
Optional CuentaPredial As String = "", Optional CveVentaDetallePadre As Integer = -1,
Optional CveVentaDetalleRemision As Integer = -1, Optional CveViajePasajero As Integer = -1) As Boolean
Optional CveVentaDetalleRemision As Integer = -1, Optional CveViajePasajero As Integer = -1, Optional RedondearTotal As Boolean = True) As Boolean
If Not CvePS > 0 Then
Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
@@ -1622,7 +1622,13 @@ Namespace Modelos
Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
Row("TipoDescuento") = -1
Row("CvePromocionDetalle") = -1
Row("Total") = (Cantidad * PU)
If RedondearTotal Then
Row("Total") = (Cantidad * PU).RoundSQL(NumeroDecimales)
Else
Row("Total") = (Cantidad * PU)
End If
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
Row("SATClaveProdServ") = DrPS("SATClavePS")
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")

View File

@@ -218,6 +218,7 @@ Partial Class Ventas_FacturacionGlobal
ObjFactura.DtRemisiones = DtRemisiones.FiltraParametros($"CveVenta IN ({SbRemisiones.ToString()})")
ObjFactura.DtPagosFacturaGlobal = DtPagosFacturaGlobal
Dim RowNum As Integer = 0
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(),
CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero())
@@ -225,20 +226,13 @@ Partial Class Ventas_FacturacionGlobal
ObjFactura.CalculaTotales()
'DEBE ESTAR DENTRO DE LA CLASE, COMENTAR UNA VEZ SE HAYA HECHO EL CAMBIO
'If ObjFactura.Descuento > 0 Then
' ObjFactura.Total = ObjFactura.Total - ObjFactura.Descuento
'End If
ObjFactura.PreparaTimbre()
If Math.Abs(ObjFactura.Total.RoundSQL(2) - DtPagosFacturaGlobal.SUMD("Importe").RoundSQL(2)) > 0.1 Then
If Math.Abs(ObjFactura.Total.RoundSQL(2) - DtPagosFacturaGlobal.SUMD("Importe").RoundSQL(2)) > 0.01D Then
Alert($"Los pagos no coinciden con el total de la factura [{ObjFactura.Total.RoundSQL(2)}-{ DtPagosFacturaGlobal.SUMD("Importe").RoundSQL(2)}]", TipoMensaje.MsgError)
Exit Sub
End If
'ObjFactura.DtInventario = ObjFactura.DtDetalle.FiltraParametros("CveTipoPs = 2")
Dim SbAlert As New StringBuilder()
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing