--FIX filtrar porcentaje de IVA al aplicar ant

This commit is contained in:
JPerez
2025-06-24 18:45:27 -07:00
parent 8b311a1a79
commit f2d73b7eea

View File

@@ -1358,7 +1358,6 @@ Partial Class Ventas_PVCobranza
RemisionesLista.Add(VentaRemision.CveVenta) RemisionesLista.Add(VentaRemision.CveVenta)
Dim DtRemisionesPS As New DataTable() Dim DtRemisionesPS As New DataTable()
Dim DtPagosFacturaGlobal As New DataTable()
If ObjClientes.GetVentasRemisionesTotales(VentaRemision.CveCliente, VentaRemision.CveVenta.ToString(), 1, UsuarioActual.CveEmpresa) Then If ObjClientes.GetVentasRemisionesTotales(VentaRemision.CveCliente, VentaRemision.CveVenta.ToString(), 1, UsuarioActual.CveEmpresa) Then
DtRemisionesPS = ObjClientes.DtResultados.Copy() 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 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() 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() Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
DtPagos.Rows.Add({CveFormaPagoAnt, Importe}) DtPagos.Rows.Add({CveFormaPagoAnt, Importe})
@@ -1423,17 +1437,22 @@ Partial Class Ventas_PVCobranza
If TxtImporteEfectivo.Text.ToDecimal > 0 Then If TxtImporteEfectivo.Text.ToDecimal > 0 Then
Dim tpag As Decimal = LtlSaldo.Text.ToDecimal - PagadoSinEfectivo Dim tpag As Decimal = LtlSaldo.Text.ToDecimal - PagadoSinEfectivo
If TxtImporteEfectivo.Text.ToDecimal < tpag Then tpag = TxtImporteEfectivo.Text.ToDecimal 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 End If
Dim PagoMaximo = DtPagos.MAX("Importe") Dim PagoMaximo = DtPagos.MAX("Importe")
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero() Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
If CveFormaPago > 0 Then If CveFormaPago > 0 Then
ObjFactura.CveFormaPago = CveFormaPago ObjFactura.CveFormaPago = CveFormaPago
ObjFactura.CveMetodoPago = 1 ObjFactura.CveMetodoPago = 1
ObjFactura.ClaveMetodoPagoSAT = "PUE" ObjFactura.ClaveMetodoPagoSAT = "PUE"
ObjFactura.ClaveFormaPagoSAT = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {ObjFactura.CveFormaPago}") ObjFactura.ClaveFormaPagoSAT = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {ObjFactura.CveFormaPago}")
End If End If
ObjFactura.FechaPago = Now 'venta de cantado el mismo dia ObjFactura.FechaPago = Now 'venta de cantado el mismo dia
Else Else
'venta a crédito 'venta a crédito
@@ -2331,19 +2350,23 @@ Partial Class Ventas_PVCobranza
DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
Dim tTipoDocto As String
Dim tTipoDocto As String = ""
Dim PorcentajeIVA As Decimal = -1
If DbRowVenta IsNot Nothing Then If DbRowVenta IsNot Nothing Then
CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() CveCliente = DbRowVenta("CveCliente").ToString().ToEntero()
CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero() CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero()
tTipoDocto = DbRowVenta("TipoDocto").ToString() tTipoDocto = DbRowVenta("TipoDocto").ToString()
PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString().ToDecimal()
End If End If
If CveCliente > 0 Then If CveCliente > 0 Then
CargaAnticipos(CveCliente, tTipoDocto) CargaAnticipos(CveCliente, tTipoDocto, PorcentajeIVA)
End If End If
End Sub 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 If CveCliente > 0 Then
Dim ObjMovtos As New ClsMovimientos() Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then
@@ -2355,7 +2378,8 @@ Partial Class Ventas_PVCobranza
If TipoDocto = "Ant" Then TipoAnticipo = " 'IxC' " If TipoDocto = "Ant" Then TipoAnticipo = " 'IxC' "
If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing Then 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 Else
GVAnticipos.DataSource = Nothing GVAnticipos.DataSource = Nothing
End If End If