Calculo de Ret IVA en OC

This commit is contained in:
2020-01-15 18:54:36 -07:00
parent 9dc2c64c0c
commit 2e5d0ffa58

View File

@@ -6980,21 +6980,23 @@ Partial Class OC
TxtRetIVA.Text = TxtRetIVA.Text.FormatoNumero
HdnRetIVA.Value = TxtRetIVA.Text
Dim Porcentaje = TxtRetIVA.Text.ToDecimal / DtDetalle.SUM("Total")
Dim Porcentaje As Decimal = TxtRetIVA.Text.ToDecimal / DtDetalle.SUM("Total")
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.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
'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")))