--FIX. Aplicacion de multiples metodos de pago en cobranza.aspx
This commit is contained in:
@@ -55,8 +55,8 @@ Partial Class Ventas_PVCobranza
|
|||||||
|
|
||||||
'MOSTRAR SOLO CUENTAS DE CONTADO EN BDH
|
'MOSTRAR SOLO CUENTAS DE CONTADO EN BDH
|
||||||
'If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
'If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
DdlCuentaEfectivo.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 AND TieneTerminal = 0", 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
|
'If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
@@ -296,12 +296,19 @@ Partial Class Ventas_PVCobranza
|
|||||||
'validaciones
|
'validaciones
|
||||||
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal
|
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal
|
||||||
If Pagado = 0 Then
|
If Pagado = 0 Then
|
||||||
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
|
Alert("Favor de especificar importe", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If LtlSaldo.Text.ToDecimal > Pagado Then
|
If LtlSaldo.Text.ToDecimal() > Pagado Then
|
||||||
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.ToastAdventencia)
|
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
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -336,9 +343,10 @@ Partial Class Ventas_PVCobranza
|
|||||||
|
|
||||||
Dim CvePrePoliza As Integer
|
Dim CvePrePoliza As Integer
|
||||||
Dim Fecha As Date = NowADS()
|
Dim Fecha As Date = NowADS()
|
||||||
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
|
|
||||||
Dim MsgError As String = ""
|
Dim MsgError As String = ""
|
||||||
Dim SaldoPendiente As Decimal = DbRowVenta("Saldo").ToString.ToDecimal
|
Dim SaldoPendiente As Decimal = DbRowVenta("Saldo").ToString.ToDecimal
|
||||||
|
Dim PagoAplicado As Decimal = 0
|
||||||
|
|
||||||
Dim ObjConta As New ClsContabilidad
|
Dim ObjConta As New ClsContabilidad
|
||||||
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL())
|
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL())
|
||||||
@@ -348,31 +356,44 @@ Partial Class Ventas_PVCobranza
|
|||||||
|
|
||||||
If CvePrePoliza > 0 Then
|
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
|
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)
|
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
|
End If
|
||||||
SaldoPendiente -= PagoEfectivo
|
|
||||||
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
|
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)
|
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
|
End If
|
||||||
|
|
||||||
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
|
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
|
||||||
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
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
|
End If
|
||||||
|
|
||||||
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then
|
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)
|
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
|
End If
|
||||||
|
|
||||||
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, CveCorte) Then
|
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, CveCorte) Then
|
||||||
|
|||||||
Reference in New Issue
Block a user