From bac43e98267e66d3ec416ca33470ed53373ac5d8 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 22 Apr 2025 23:23:37 -0700 Subject: [PATCH] --Validaciones cobro clientes -- obligar siempre tener corte --- Ventas/ClientesAbonar.aspx.vb | 31 ++++++++++++++++++++++++++++++- Ventas/PVCobranza.aspx.vb | 8 +++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 32fa60b0e..184fd643b 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -4,7 +4,6 @@ Imports System.Data Imports ADSTimbrado Imports Extensiones -Imports Org.BouncyCastle.Ocsp Partial Class Ventas_ClientesAbonar Inherits ClsPaginas @@ -743,6 +742,36 @@ Partial Class Ventas_ClientesAbonar Exit Sub End If + If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso RblTipoPago.SelectedValue = "3" Then + Dim DtSaldo As DataTable = Nothing + Dim ObjMovto As New ClsMovimientos + If ObjMovto.GetIngresosSaldosDetalle(CveCliente, -1, UsuarioActual.CveEmpresa) Then + DtSaldo = ObjMovto.DtResultados.FiltraParametros($"CveIE={DdlIngreso.SelectedValue.ToEntero()}") + End If + ObjMovto.Dispose() + + If DtSaldo IsNot Nothing AndAlso DtSaldo.Rows.Count = 1 Then + Dim ImporteRef As Decimal = DtSaldo.SUM("Saldo", $"CveIE={DdlIngreso.SelectedValue.ToEntero()}") + Dim ImporteAbonar As Decimal = 0 + + For Each gvr As GridViewRow In GvCxC.Rows + If gvr.FCCheckBox("Chk").Checked Then + ImporteAbonar += gvr.FCTextBox("TxtAbonar").Text.ToDecimal() + End If + Next + ImporteAbonar += TxtAnticipo.Text.ToDecimal() + + If ImporteRef.RoundSQL(2) <> ImporteAbonar.RoundSQL(2) Then + Alert("El importe abonado es diferente al saldo del ingreso", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Else + Alert("No se pudieron validar los saldos", TipoMensaje.MsgError) + Exit Sub + End If + + End If + Dim Cuenta As String = "" Dim CuentaDeposito As String = "" diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 81e465ba8..a787c990a 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -674,6 +674,12 @@ Partial Class Ventas_PVCobranza End If Dim tCveCorte As Integer = CveCorte + + If tCveCorte <= 0 Then + Alert("No se puede realizar el pago. Debe tener un corte activo", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero Dim CveVentaRemision As Integer = -1 @@ -712,7 +718,7 @@ Partial Class Ventas_PVCobranza Dim PedidoContrato = DbRowVenta("PedidoContrato").ToString() Dim OrdenCompra = DbRowVenta("OrdenCompra").ToString() - If tCveCorte <= 0 AndAlso DbRowVenta("CveCorte").ToString.ToEntero > 0 Then tCveCorte = DbRowVenta("CveCorte").ToString.ToEntero + 'If tCveCorte <= 0 AndAlso DbRowVenta("CveCorte").ToString.ToEntero > 0 Then tCveCorte = DbRowVenta("CveCorte").ToString.ToEntero Dim CvePrePoliza As Integer = -1 Dim Fecha As Date = DbRowVenta("Fecha").ToString.ToDate 'NowADS()