From 46dcbaf9491dc88a7b502c24149476d8c9b5dca7 Mon Sep 17 00:00:00 2001 From: Oscar Irigoyen Date: Fri, 26 May 2023 12:26:05 -0700 Subject: [PATCH] =?UTF-8?q?Compras=20Correci=C3=B3n=20=20prorrateo=20deduc?= =?UTF-8?q?ible=20no=20se=20considero=20el=20descuento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Compras/Compras.aspx.vb | 127 ++++++++++++++++++++-------------------- Ventas/Clientes.aspx.vb | 2 - 2 files changed, 65 insertions(+), 64 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 30fc968ec..da86e3a93 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4622,7 +4622,7 @@ Partial Class Compras_Compras Exit Sub End If - 'If Not AjustaIva() Then + 'If Not AjustaIVA() Then ' Exit Sub 'End If @@ -8216,77 +8216,78 @@ Partial Class Compras_Compras Dim IVADetalles As Decimal = TmpDT.SUMD("IVA", " IVA > 0 ") Dim DiferenciaIVas As Decimal = TxtIVA.Text.ToDecimal - IVADetalles + If Math.Abs(DiferenciaIVas) > 0 Then + If Math.Abs(DiferenciaIVas) > 0.05 Then - If Math.Abs(DiferenciaIVas) > 0.05 Then + Dim DTConsulta As New DataTable + DTConsulta = TmpDT.FiltraParametros(" IVA > 0 ") - Dim DTConsulta As New DataTable - DTConsulta = TmpDT.FiltraParametros(" IVA > 0 ") + If DTConsulta.Rows.Count > 0 Then - If DTConsulta.Rows.Count > 0 Then - - Dim IndiceContador As Integer = 0 - Dim IndiceUltimo As Integer = 0 - Dim CantidadRegistroConIVA As Decimal - - For Each dRow As DataRow In TmpDT.Rows - If dRow("IVA").ToString.ToDecimal > 0 Then - IndiceUltimo = IndiceContador - CantidadRegistroConIVA = CantidadRegistroConIVA + 1 - End If - IndiceContador = IndiceContador + 1 - Next - - IVADetalles = TmpDT.SUMD("IVA", " IVA > 0 ") - DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles - - If Math.Abs(DiferenciaIVas) > 0.0D Then - - If (TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas) < 0 Then - - Dim AjusteteDividido As Decimal = Math.Abs(DiferenciaIVas) / CantidadRegistroConIVA - - For Each dRow As DataRow In TmpDT.Rows - dRow("IVA") = dRow("IVA").ToString.ToDecimal - AjusteteDividido - Next - - Else - TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas - End If - - TmpDT.AcceptChanges() - - End If - - End If - - 'Revalidacion de ajuste - IVADetalles = TmpDT.SUMD("IVA", " IVA > 0 ") - DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles - - If Math.Abs(DiferenciaIVas) > 0.01D Then - Respuesta = False - If IVADetalles > 0 Then + Dim IndiceContador As Integer = 0 + Dim IndiceUltimo As Integer = 0 + Dim CantidadRegistroConIVA As Decimal For Each dRow As DataRow In TmpDT.Rows If dRow("IVA").ToString.ToDecimal > 0 Then - dRow("IVA") = dRow("IVA").ToString.ToDecimal + DiferenciaIVas - TmpDT.AcceptChanges() - Respuesta = True - Exit For + IndiceUltimo = IndiceContador + CantidadRegistroConIVA = CantidadRegistroConIVA + 1 End If + IndiceContador = IndiceContador + 1 Next - Else - Alert("Los productos especificados en el listado no tienen asignado impuesto IVA, favor de realizar la corrección en el producto que aplique el impuesto.", TipoMensaje.MsgAdvertencia) - Respuesta = False - End If - Else - Respuesta = True - End If + IVADetalles = TmpDT.SUMD("IVA", " IVA > 0 ") + DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles - Else - Alert("existe una diferencia de más de 0.05 entre el IVA de la compra y los detalles.", TipoMensaje.MsgAdvertencia) - Respuesta = False + If Math.Abs(DiferenciaIVas) > 0.0D Then + + If (TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas) < 0 Then + + Dim AjusteteDividido As Decimal = Math.Abs(DiferenciaIVas) / CantidadRegistroConIVA + + For Each dRow As DataRow In TmpDT.Rows + dRow("IVA") = dRow("IVA").ToString.ToDecimal - AjusteteDividido + Next + + Else + TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas + End If + + TmpDT.AcceptChanges() + + End If + + End If + + 'Revalidacion de ajuste + IVADetalles = TmpDT.SUMD("IVA", " IVA > 0 ") + DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles + + If Math.Abs(DiferenciaIVas) > 0.01D Then + Respuesta = False + If IVADetalles > 0 Then + + For Each dRow As DataRow In TmpDT.Rows + If dRow("IVA").ToString.ToDecimal > 0 Then + dRow("IVA") = dRow("IVA").ToString.ToDecimal + DiferenciaIVas + TmpDT.AcceptChanges() + Respuesta = True + Exit For + End If + Next + + Else + Alert("Los productos especificados en el listado no tienen asignado impuesto IVA, favor de realizar la corrección en el producto que aplique el impuesto.", TipoMensaje.MsgAdvertencia) + Respuesta = False + End If + Else + Respuesta = True + End If + + Else + Alert("existe una diferencia de más de 0.05 entre el IVA de la compra y los detalles.", TipoMensaje.MsgAdvertencia) + Respuesta = False + End If End If Return Respuesta @@ -20659,6 +20660,7 @@ Partial Class Compras_Compras dRow91_5("RetISR") = dRow91_5("RetISR").ToString.ToDecimal * Mul91_5 dRow91_5("IEPSPS") = dRow91_5("IEPSPS").ToString.ToDecimal * Mul91_5 dRow91_5("IEPSPSIVA") = dRow91_5("IEPSPSIVA").ToString.ToDecimal * Mul91_5 + dRow91_5("Descuento") = dRow91_5("Descuento").ToString.ToDecimal * Mul91_5 dRow91_5("Total") = dRow91_5("Total").ToString.ToDecimal * Mul91_5 dRow91_5("NoDeducible") = 1 @@ -20670,6 +20672,7 @@ Partial Class Compras_Compras dRow8_5("RetISR") = dRow8_5("RetISR").ToString.ToDecimal * Mul85 dRow8_5("IEPSPS") = dRow8_5("IEPSPS").ToString.ToDecimal * Mul85 dRow8_5("IEPSPSIVA") = dRow8_5("IEPSPSIVA").ToString.ToDecimal * Mul85 + dRow8_5("Descuento") = dRow8_5("Descuento").ToString.ToDecimal * Mul85 dRow8_5("Total") = dRow8_5("Total").ToString.ToDecimal * Mul85 dRow8_5("NoDeducible") = 0 diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index ccf7e3e44..fe13f8281 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -3979,8 +3979,6 @@ Partial Class Clientes End If End If - - End If Return Respuesta