diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 7ea3d761a..f7939e85d 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -591,6 +591,39 @@ Partial Class Ventas_PVCobranza ObjFactura.DtRemisionesPS = DtRemisionesPS ObjFactura.DtRemisiones = DtRemisiones + Dim DtPagos As DataTable = New DataTable("DtPagosFactura") + DtPagos.Columns.Add(New DataColumn("CveFormaPago", GetType(Integer))) + DtPagos.Columns.Add(New DataColumn("Importe", GetType(Decimal))) + + If TxtImporteCredito.Text.ToDecimal > 0 Then + DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal}) + End If + + If TxtImporteDebito.Text.ToDecimal > 0 Then + DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal}) + End If + + If TxtImporteCheque.Text.ToDecimal > 0 Then + DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal}) + End If + + If TxtImporteTransferencia.Text.ToDecimal > 0 Then + DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal}) + End If + + If TxtImporteEfectivo.Text.ToDecimal > 0 Then + DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal}) + End If + + Dim PagoMaximo = DtPagos.MAX("Importe") + + Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero() + + If CveFormaPago > 0 Then + ObjFactura.CveFormaPago33 = CveFormaPago + ObjFactura.CveMetodoPago33 = 1 + End If + For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(), CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero(),