This commit is contained in:
rakcsle
2024-10-14 08:16:44 -07:00
parent 94100af37d
commit d9cd4d4dc6
4 changed files with 659 additions and 136 deletions

View File

@@ -7753,25 +7753,23 @@ Partial Class OC_OC
TxtRetIVA.Text = TxtRetIVA.Text.FormatoNumero
HdnRetIVA.Value = TxtRetIVA.Text
Dim Porcentaje As Decimal = TxtRetIVA.Text.ToDecimal / DtDetalle.SUMD("Total")
Dim IvaTotal As Decimal = DtDetalle.FiltraParametros("IVA > 0").SUMD("Total")
Dim Porcentaje As Decimal = TxtRetIVA.Text.ToDecimal / IvaTotal
Dim LastDr As DataRow = Nothing
For Each Dr As DataRow In DtDetalle.Rows
'Dr("RetIVA") = (Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100
Dr("RetIVA") = Math.Round((Dr("Total").ToString.ToDecimal * Porcentaje), 2)
'Dr("RetIVA") = Math.Round((Dr("Cantidad").ToString.ToDecimal * Dr("Importe").ToString.ToDecimal * Porcentaje), 2)
Dr("RetIVAPorcentaje") = Porcentaje
' Tipo Dato '0' es Cuando es Nuevo, '1' para editar y '2' viene de la BD
Dr("TipoDato") = If(Dr("TipoDato").ToString.ToEntero = 0, 0, 1)
LastDr = Dr
Next
'If Not IsNothing(LastDr) Then
' Dim Fdes As Decimal = TxtRetIVA.Text.ToDecimal - DtDetalle.SUM("RetIVA").ToString.ToDecimal
' If Fdes > 0 Then
' LastDr("RetIVA") = LastDr("RetIVA").ToString.ToDecimal + Fdes
' End If
'End If
'Alert(String.Format("Descuento:{0}", DtDetalle.SUM("Descuento")))
If Dr("IVA").ToString.ToDecimal > 0 Then
'Dr("RetIVA") = (Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100
Dr("RetIVA") = Math.Round((Dr("Total").ToString.ToDecimal * Porcentaje), 2)
'Dr("RetIVA") = Math.Round((Dr("Cantidad").ToString.ToDecimal * Dr("Importe").ToString.ToDecimal * Porcentaje), 2)
Dr("RetIVAPorcentaje") = Porcentaje
' Tipo Dato '0' es Cuando es Nuevo, '1' para editar y '2' viene de la BD
Dr("TipoDato") = If(Dr("TipoDato").ToString.ToEntero = 0, 0, 1)
LastDr = Dr
End If
Next
CalculaGenerales()