From ef9b88945377cd98005340ebb2507b46d487b104 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 10 Apr 2024 15:21:56 -0700 Subject: [PATCH] --FIX redondeo de factura global --- App_Code/Modelos.vb | 10 ++++++++-- Ventas/FacturacionGlobal.aspx.vb | 10 ++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 2c1c5dec4..0d02c285a 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -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") diff --git a/Ventas/FacturacionGlobal.aspx.vb b/Ventas/FacturacionGlobal.aspx.vb index fc174e83d..475f83d5b 100644 --- a/Ventas/FacturacionGlobal.aspx.vb +++ b/Ventas/FacturacionGlobal.aspx.vb @@ -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