Ajuste combustibles, cuando el ajuste es negativo lo distribuye entre llas partidas que apliquen ieps y tengan iva

This commit is contained in:
rakcsle
2021-07-20 08:43:36 -07:00
parent 03331a9639
commit 7894d1cd60

View File

@@ -4359,7 +4359,7 @@ Partial Class Compras_Compras
If Not AjustaCombustibles() Then
Exit Sub
End If
Exit Sub
'------------------TERMINA VALIDACIONES------------------
@@ -8523,10 +8523,12 @@ Partial Class Compras_Compras
Dim IndiceContador As Integer = 0
Dim IndiceUltimo As Integer = 0
Dim CantidadRegistroConIVA As Decimal
For Each dRow As DataRow In TmpDT.Rows
If Boolean.Parse(dRow("AplicaIEPS").ToString) And Boolean.Parse(dRow("IEPSGrabaIVA").ToString) = False And dRow("IVA").ToString.ToDecimal > 0 Then
IndiceUltimo = IndiceContador
CantidadRegistroConIVA = CantidadRegistroConIVA + 1
End If
IndiceContador = IndiceContador + 1
Next
@@ -8535,8 +8537,26 @@ Partial Class Compras_Compras
DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles
If Math.Abs(DiferenciaIVas) > 0.01D Then
TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas
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
If Boolean.Parse(dRow("AplicaIEPS").ToString) And Boolean.Parse(dRow("IEPSGrabaIVA").ToString) = False And dRow("IVA").ToString.ToDecimal > 0 Then
dRow("IVA") = dRow("IVA").ToString.ToDecimal - AjusteteDividido
End If
Next
Else
TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas
End If
TmpDT.AcceptChanges()
End If
End If
@@ -8549,22 +8569,22 @@ Partial Class Compras_Compras
If Math.Abs(DiferenciaIVas) > 0.01D Then
Respuesta = False
'If IVADetalles > 0 Then
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
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 lisado no tienen asigando impuesto IVA, favor de realizar la correción en el producto que aplique el impúesto.", TipoMensaje.MsgAdvertencia)
Respuesta = False
End If
'Else
' Alert("Los productos especificados en el lisado no tienen asigando impuesto IVA, favor de realizar la correción en el producto que aplique el impúesto.", TipoMensaje.MsgAdvertencia)
' Respuesta = False
'End If
Else
Respuesta = True
End If
@@ -18447,20 +18467,22 @@ Partial Class Compras_Compras
Dim IEPSPS = (TxtIEPSModal.Text.ToDouble / 100)
Dim IEPSPSIVA = 0
If Not (CveCompra > 0 Or CveFactura > 0 Or OCVinculada) Then
'If DdlIVA.SelectedValue.ToDouble = 0 Then DrPS("IVA") = 0 Else DrPS("IVA") = IVA * Total
DrPS("IVA") = IVA * Total
DrPS("IVAPorcentaje") = IVA
DrPS("RetIVA") = RetIVA * Total
DrPS("RetIVAPorcentaje") = RetIVA
DrPS("RetISR") = RetISR * Total
DrPS("RetISRPorcentaje") = RetISR
DrPS("IEPSPS") = IEPSPS * Total
DrPS("IEPSPSPorcentaje") = IEPSPS
DrPS("IEPSPSIVA") = IEPSPSIVA * Total
DrPS("IEPSPSIVAPorcentaje") = IEPSPSIVA
AplicaCalculaTotales = True
End If
'I f Not (CveCompra > 0 Or CveFactura > 0 Or OCVinculada) Then
'If DdlIVA.SelectedValue.ToDouble = 0 Then DrPS("IVA") = 0 Else DrPS("IVA") = IVA * Total
DrPS("IVA") = IVA * Total
DrPS("IVAPorcentaje") = IVA
DrPS("RetIVA") = RetIVA * Total
DrPS("RetIVAPorcentaje") = RetIVA
DrPS("RetISR") = RetISR * Total
DrPS("RetISRPorcentaje") = RetISR
DrPS("IEPSPS") = IEPSPS * Total
DrPS("IEPSPSPorcentaje") = IEPSPS
DrPS("IEPSPSIVA") = IEPSPSIVA * Total
DrPS("IEPSPSIVAPorcentaje") = IEPSPSIVA
AplicaCalculaTotales = True
'End If
TmpDT.AcceptChanges()