diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index e4e1be772..f17967ba5 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -14235,11 +14235,20 @@ Partial Class Compras_Compras Else Dim Acumulado As Decimal = 0 Dim PU As Decimal = 0 + Dim CantidadRenglones As Integer = 0 + Dim ii As Integer = 0 + For Each Dr As GridViewRow In GVDevolucion.Rows + If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then + CantidadRenglones += 1 + End If + Next + For Each Dr As GridViewRow In GVDevolucion.Rows If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then Acumulado += (Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal) PU = Dr.DataKey("PU").ToString.ToDecimal - If subtotal < Acumulado Then + ii += 1 + If CantidadRenglones = ii Then Dim dif As Decimal = subtotal - Acumulado PU = (((Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal)) + dif) / Dr.FCTextBox("TxtCantidad").Text.ToDecimal End If