diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 0ac68a0f0..f6eb8bf6f 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -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")))