diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 5d6a9c720..67455a4b5 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -1358,7 +1358,6 @@ Partial Class Ventas_PVCobranza RemisionesLista.Add(VentaRemision.CveVenta) Dim DtRemisionesPS As New DataTable() - Dim DtPagosFacturaGlobal As New DataTable() If ObjClientes.GetVentasRemisionesTotales(VentaRemision.CveCliente, VentaRemision.CveVenta.ToString(), 1, UsuarioActual.CveEmpresa) Then DtRemisionesPS = ObjClientes.DtResultados.Copy() @@ -1399,6 +1398,21 @@ Partial Class Ventas_PVCobranza If GvRow.DataKey("Tipo").Contiene("NC", "IxC", "Ant") AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then Dim CveFormaPagoAnt = GvRow.DataKey("CveFormaPago").ToEntero() + + If GvRow.DataKey("Tipo").Contiene("Ant") Then + 'SI NO ES AMORTIZACION DE ANTICIPO + If Not CveFormaPagoAnt = 21 Then + CveFormaPagoAnt = 21 + End If + End If + + 'If GvRow.DataKey("Tipo").Contiene("NC") Then + ' 'SI NO ES AMORTIZACION DE ANTICIPO o DEVOLUCION + ' If Not CveFormaPagoAnt.Contiene(21, 11) Then + ' CveFormaPagoAnt = 21 + ' End If + 'End If + Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal() DtPagos.Rows.Add({CveFormaPagoAnt, Importe}) @@ -1423,17 +1437,22 @@ Partial Class Ventas_PVCobranza If TxtImporteEfectivo.Text.ToDecimal > 0 Then Dim tpag As Decimal = LtlSaldo.Text.ToDecimal - PagadoSinEfectivo If TxtImporteEfectivo.Text.ToDecimal < tpag Then tpag = TxtImporteEfectivo.Text.ToDecimal - DtPagos.Rows.Add({1, tpag}) + + If tpag > 0 Then + DtPagos.Rows.Add({1, tpag}) + End If End If Dim PagoMaximo = DtPagos.MAX("Importe") Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero() + If CveFormaPago > 0 Then ObjFactura.CveFormaPago = CveFormaPago ObjFactura.CveMetodoPago = 1 ObjFactura.ClaveMetodoPagoSAT = "PUE" ObjFactura.ClaveFormaPagoSAT = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {ObjFactura.CveFormaPago}") End If + ObjFactura.FechaPago = Now 'venta de cantado el mismo dia Else 'venta a crédito @@ -2331,19 +2350,23 @@ Partial Class Ventas_PVCobranza DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") End If ObjVentas.Dispose() - Dim tTipoDocto As String + + Dim tTipoDocto As String = "" + Dim PorcentajeIVA As Decimal = -1 + If DbRowVenta IsNot Nothing Then CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero() tTipoDocto = DbRowVenta("TipoDocto").ToString() + PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString().ToDecimal() End If If CveCliente > 0 Then - CargaAnticipos(CveCliente, tTipoDocto) + CargaAnticipos(CveCliente, tTipoDocto, PorcentajeIVA) End If End Sub - Private Sub CargaAnticipos(CveCliente As Integer, TipoDocto As String) + Private Sub CargaAnticipos(CveCliente As Integer, TipoDocto As String, PorcentajeIVA As Decimal) If CveCliente > 0 Then Dim ObjMovtos As New ClsMovimientos() If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then @@ -2355,7 +2378,8 @@ Partial Class Ventas_PVCobranza If TipoDocto = "Ant" Then TipoAnticipo = " 'IxC' " If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing Then - GVAnticipos.DataSource = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"ISTotal = 0 AND Saldo > 0 AND Tipo IN ({TipoAnticipo}) ") + GVAnticipos.DataSource = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"ISTotal = 0 AND Saldo > 0 AND Tipo IN ({TipoAnticipo}) AND (PorcentajeIVA = {PorcentajeIVA} OR Tipo = 'IxC')") + 'GVAnticipos.DataSource = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"ISTotal = 0 AND Saldo > 0 AND Tipo IN ({TipoAnticipo})") Else GVAnticipos.DataSource = Nothing End If