From 7512897742927c9d8c03d02cb1e38d747f83284d Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 20 Aug 2020 16:58:53 -0700 Subject: [PATCH] Calcular impuestos locales en base al porcentaje de nota de credito --- Ventas/Ventas.aspx.vb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index cb1d7e14d..5683fdf54 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -22698,7 +22698,6 @@ Partial Class Ventas End If End Sub - Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1) As DataTable Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0 @@ -22745,9 +22744,13 @@ Partial Class Ventas Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100 Dim FiltroStr As String = "" Dim importePuTemp As Decimal = 0 - Dim TotalImpuestosLocales As Decimal = 0 + Dim TotalImpuestosLocalesVentaOriginal As Decimal = 0 + Dim TotalImpuestosLocalesRecalculado As Decimal = 0 + + 'CALCULA LO EQUIVALENTE EN IMPUSTOS LOCALES If TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then - TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal() + TotalImpuestosLocalesVentaOriginal = TmpDTImpuestos.SUM("Importe").ToDecimal() + TotalImpuestosLocalesRecalculado = TotalImpuestosLocalesVentaOriginal * Porcentaje End If For Each Dr As DataRow In DtImpuestosLocal.Rows @@ -22755,7 +22758,7 @@ Partial Class Ventas importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal())) If Not AplicaImpuestosLocales Then - importePuTemp = importePuTemp - TotalImpuestosLocales + importePuTemp = importePuTemp - TotalImpuestosLocalesVentaOriginal End If Dr("ImporteTotal") = importePuTemp.RoundSQL(2) @@ -22775,9 +22778,11 @@ Partial Class Ventas Next Dim importeNC = (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) + If AplicaImpuestosLocales Then - Importe = Importe + TotalImpuestosLocales + Importe = Importe + TotalImpuestosLocalesRecalculado End If + 'codigo para ajuste de centavo, si el importe total no cuadra con los totales Dim difTmp As Decimal = Importe - importeNC @@ -22795,7 +22800,6 @@ Partial Class Ventas 'CargaNCDT(CveVentaNC, Importe.ToDecimal) Return DtImpuestosLocal End Function - Private Sub AgregaTempDT(ByRef TmpDT As DataTable, CvePS As Integer, PS As String, Codigo As String, CodigoPS As String, CveTipoPS As Integer, CveTipoInvPS As Integer, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, Obs As String, Cantidad As Double, PU As Double, PorcentajeIVA As Double, ImporteIVA As Double, PorcentajeRetIVA As Double, ImporteRetIVA As Double,