--FIX. Aplicacion de multiples metodos de pago en cobranza.aspx

This commit is contained in:
2024-03-27 14:26:13 -07:00
parent 6c75038e1c
commit 469403b44e

View File

@@ -55,8 +55,8 @@ Partial Class Ventas_PVCobranza
'MOSTRAR SOLO CUENTAS DE CONTADO EN BDH
'If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
DdlCuentaEfectivo.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 0", CveMon))
DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 0", CveMon))
DdlCuentaEfectivo.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon))
DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon))
'If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
@@ -296,12 +296,19 @@ Partial Class Ventas_PVCobranza
'validaciones
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal
If Pagado = 0 Then
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
Alert("Favor de especificar importe", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If LtlSaldo.Text.ToDecimal > Pagado Then
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.ToastAdventencia)
If LtlSaldo.Text.ToDecimal() > Pagado Then
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal
If PagadoSinEfectivo > LtlSaldo.Text.ToDecimal() Then
Alert("El pago con los metodos de pago actuales no puede ser mayor al importe de la venta", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
@@ -336,9 +343,10 @@ Partial Class Ventas_PVCobranza
Dim CvePrePoliza As Integer
Dim Fecha As Date = NowADS()
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
Dim MsgError As String = ""
Dim SaldoPendiente As Decimal = DbRowVenta("Saldo").ToString.ToDecimal
Dim PagoAplicado As Decimal = 0
Dim ObjConta As New ClsContabilidad
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL())
@@ -348,31 +356,44 @@ Partial Class Ventas_PVCobranza
If CvePrePoliza > 0 Then
If PagoEfectivo > 0 Then
If PagoEfectivo > VentaActual.Total Then
TxtCambio.Text = (VentaActual.Total - PagoEfectivo).FormatoNumero
PagoEfectivo = VentaActual.Total
End If
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
End If
SaldoPendiente -= PagoEfectivo
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
PagoEfectivo = TxtImporteCredito.Text.ToDecimal
SaldoPendiente -= TxtImporteCredito.Text.ToDecimal
PagoAplicado += TxtImporteCredito.Text.ToDecimal
End If
SaldoPendiente -= PagoEfectivo
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
PagoEfectivo = TxtImporteDebito.Text.ToDecimal
SaldoPendiente -= TxtImporteDebito.Text.ToDecimal
PagoAplicado += TxtImporteDebito.Text.ToDecimal
End If
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
SaldoPendiente -= TxtImporteCheque.Text.ToDecimal
PagoAplicado += TxtImporteCheque.Text.ToDecimal
End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then
MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
SaldoPendiente -= TxtImporteTransferencia.Text.ToDecimal
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
PagoAplicado += PagoEfectivo
If PagoAplicado > VentaActual.Total Then
TxtCambio.Text = (PagoAplicado - VentaActual.Total).FormatoNumero
PagoEfectivo = SaldoPendiente
End If
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
SaldoPendiente -= PagoEfectivo
End If
If SaldoPendiente > 0 Then
MsgError = "Tiene saldo pendiente por aplicar"
End If
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, CveCorte) Then