From 66c77de36814d52ee5e3828c3ff98e1dd667f993 Mon Sep 17 00:00:00 2001 From: rrene Date: Sun, 24 Mar 2024 09:29:56 -0700 Subject: [PATCH] - mejora en manejo de errores --- Ventas/PVCobranza.aspx.vb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 6e73a915f..4f6cc4926 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -294,11 +294,17 @@ Partial Class Ventas_PVCobranza 'registrar pago 'validaciones - If TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal = 0 Then + 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) Exit Sub End If + If LtlSaldo.Text.ToDecimal > Pagado Then + Alert("Favor de especificar el saldo total de pagar", TipoMensaje.ToastAdventencia) + Exit Sub + End If + Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero Dim DbRowVenta As DataRow = Nothing @@ -332,7 +338,7 @@ Partial Class Ventas_PVCobranza Dim Fecha As Date = NowADS() Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal Dim MsgError As String = "" - Dim SaldoPendiente As Decimal = VentaActual.Total + Dim SaldoPendiente As Decimal = DbRowVenta("Saldo").ToString.ToDecimal Dim ObjConta As New ClsContabilidad Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL()) @@ -350,12 +356,12 @@ Partial Class Ventas_PVCobranza MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2) End If SaldoPendiente -= PagoEfectivo - If 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) PagoEfectivo = TxtImporteCredito.Text.ToDecimal End If SaldoPendiente -= PagoEfectivo - If 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) PagoEfectivo = TxtImporteDebito.Text.ToDecimal End If @@ -364,12 +370,12 @@ Partial Class Ventas_PVCobranza PagoEfectivo = TxtImporteCheque.Text.ToDecimal End If - If 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) PagoEfectivo = TxtImporteCheque.Text.ToDecimal End If - If Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, CveCorte) Then + If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, CveCorte) Then MsgError = "Error al aplicar el corte" End If