- mejora en manejo de errores
This commit is contained in:
@@ -294,11 +294,17 @@ Partial Class Ventas_PVCobranza
|
|||||||
'registrar pago
|
'registrar pago
|
||||||
|
|
||||||
'validaciones
|
'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)
|
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
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 CveVenta As Integer = HdnCveVenta.Value.ToEntero
|
||||||
|
|
||||||
Dim DbRowVenta As DataRow = Nothing
|
Dim DbRowVenta As DataRow = Nothing
|
||||||
@@ -332,7 +338,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
Dim Fecha As Date = NowADS()
|
Dim Fecha As Date = NowADS()
|
||||||
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
|
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
|
||||||
Dim MsgError As String = ""
|
Dim MsgError As String = ""
|
||||||
Dim SaldoPendiente As Decimal = VentaActual.Total
|
Dim SaldoPendiente As Decimal = DbRowVenta("Saldo").ToString.ToDecimal
|
||||||
|
|
||||||
Dim ObjConta As New ClsContabilidad
|
Dim ObjConta As New ClsContabilidad
|
||||||
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL())
|
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)
|
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
End If
|
End If
|
||||||
SaldoPendiente -= PagoEfectivo
|
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)
|
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
PagoEfectivo = TxtImporteCredito.Text.ToDecimal
|
PagoEfectivo = TxtImporteCredito.Text.ToDecimal
|
||||||
End If
|
End If
|
||||||
SaldoPendiente -= PagoEfectivo
|
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)
|
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
PagoEfectivo = TxtImporteDebito.Text.ToDecimal
|
PagoEfectivo = TxtImporteDebito.Text.ToDecimal
|
||||||
End If
|
End If
|
||||||
@@ -364,12 +370,12 @@ Partial Class Ventas_PVCobranza
|
|||||||
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
|
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
|
||||||
End If
|
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)
|
MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
|
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
|
||||||
End If
|
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"
|
MsgError = "Error al aplicar el corte"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user