diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index f65919d08..e10a8b627 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -8595,6 +8595,50 @@ Partial Class Compras_Compras Respuesta = True End If + + + If Respuesta Then + + Dim IEPSPSDetalles As Decimal = TmpDT.SUM("IEPSPS", " IEPSPS > 0 ").ToDecimal + Dim DiferenciaIEPSPS As Decimal = TxtIEPS.Text.ToDecimal - IEPSPSDetalles + + Dim DTConsultaIEPSPS As New DataTable + DTConsultaIEPSPS = TmpDT.FiltraParametros(" AplicaIEPS = 'True'") + + + Dim IndiceContador As Integer = 0 + Dim IndicePrimero As Integer = 0 + + + For Each dRow As DataRow In TmpDT.Rows + If Boolean.Parse(dRow("AplicaIEPS").ToString) Then + IndicePrimero = IndiceContador + Exit For + End If + IndiceContador = IndiceContador + 1 + Next + + If DiferenciaIEPSPS <> 0 Then + + If DTConsultaIEPSPS.Rows.Count > 0 Then + 'Ajusta IPES en primer registro que aplique IEPS + TmpDT.Rows(IndicePrimero)("IEPSPS") = TmpDT.Rows(IndicePrimero)("IEPSPS").ToString.ToDecimal + DiferenciaIEPSPS + TmpDT.AcceptChanges() + Else + Respuesta = False + Alert("Los productos especificados en el lisado no tienen asigando impuesto IEPS, favor de realizar la correción en el producto que aplique el impúesto.", TipoMensaje.MsgAdvertencia) + End If + End If + + + End If + + + + + + + Return Respuesta End Function