This commit is contained in:
2023-05-26 12:59:18 -07:00
2 changed files with 65 additions and 64 deletions

View File

@@ -4565,7 +4565,7 @@ Partial Class Compras_Compras
Exit Sub
End If
'If Not AjustaIva() Then
'If Not AjustaIVA() Then
' Exit Sub
'End If
@@ -8046,77 +8046,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
@@ -20356,6 +20357,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
@@ -20367,6 +20369,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

View File

@@ -3979,8 +3979,6 @@ Partial Class Clientes
End If
End If
End If
Return Respuesta