From 3f2ccf7a13b04d92517cfd2b80cf285b84c112f4 Mon Sep 17 00:00:00 2001 From: JPerez Date: Mon, 14 Jul 2025 14:30:14 -0700 Subject: [PATCH] --FIX. ConciliacionesBancarias, poder seleccionar de 1 a N. para asociarlas --- Bancos/ConciliacionesBancarias.aspx.vb | 28 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Bancos/ConciliacionesBancarias.aspx.vb b/Bancos/ConciliacionesBancarias.aspx.vb index eac3b39ba..184740034 100644 --- a/Bancos/ConciliacionesBancarias.aspx.vb +++ b/Bancos/ConciliacionesBancarias.aspx.vb @@ -6,6 +6,7 @@ Imports Extensiones Imports System.Xml Imports Microsoft.Reporting.WebForms Imports System.Globalization +Imports Telerik.Web.UI Partial Class Bancos_ConciliacionesBancariasaspx Inherits ClsPaginas @@ -231,15 +232,20 @@ Partial Class Bancos_ConciliacionesBancariasaspx RegistraScript("$('#DModalCriterio').modal()") End Sub Private Sub ConciliacionManual() + + If GvDatos.Rows.Cast(Of GridViewRow).Where(Function(gvr) gvr.FCCheckBox("ChkConciliado").Checked).Count = 0 OrElse GvEdoConciliacion.Rows.Cast(Of GridViewRow).Where(Function(gvr) gvr.FCCheckBox("ChkConciliado").Checked).Count = 0 Then + Alert("Debe seleccionar un folio", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim SumaSIGAbono As Double = 0 Dim SumaSIGCargo As Double = 0 Dim SumaExcelAbono As Double = 0 Dim SumaExcelCargo As Double = 0 - Dim Seleccionados As Integer = 0 Dim Fecha As Date + For Each Gvr As GridViewRow In GvDatos.Rows If Gvr.FCCheckBox("ChkConciliado").Checked And Gvr.FCCheckBox("ChkConciliado").Enabled Then - Seleccionados += 1 Fecha = Gvr.DataKey("FechaDocumento").ToDate If Gvr.DataKey("Tipo") = "Cargo" Then If Gvr.DataKey("Importe").ToDouble < 0 Then ' cuando es negativo suma para el abono @@ -258,13 +264,7 @@ Partial Class Bancos_ConciliacionesBancariasaspx End If End If Next - If Seleccionados > 1 Then - Alert("Tiene que tener seleccionado solamente un movimiento.", TipoMensaje.MsgAdvertencia) - Exit Sub - ElseIf Not Seleccionados > 0 Then - Alert("Tiene que tener seleccionado .", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + For Each Gvr As GridViewRow In GvEdoConciliacion.Rows If Gvr.FCCheckBox("ChkConciliado").Checked And Gvr.FCCheckBox("ChkConciliado").Enabled Then If (Gvr.DataKey("FechaDocumento").ToDate = Fecha And DdlCriterio.SelectedValue.ToEntero = 1) Or DdlCriterio.SelectedValue.ToEntero = 2 Then @@ -279,10 +279,20 @@ Partial Class Bancos_ConciliacionesBancariasaspx End If End If Next + If SumaSIGCargo <> SumaExcelCargo OrElse SumaSIGAbono <> SumaExcelAbono Then Alert($"La suma de los importes no cuadran ({SumaSIGCargo}-{SumaExcelCargo}**{SumaSIGAbono}-{SumaExcelAbono})", TipoMensaje.MsgAdvertencia) Exit Sub End If + + Dim CumpleCriterioContable = GvDatos.Rows.Cast(Of GridViewRow).Where(Function(gvr) gvr.FCCheckBox("ChkConciliado").Checked).Count = 1 AndAlso GvEdoConciliacion.Rows.Cast(Of GridViewRow).Where(Function(gvr) gvr.FCCheckBox("ChkConciliado").Checked).Count >= 1 + Dim CumpleCriterioBancario = GvEdoConciliacion.Rows.Cast(Of GridViewRow).Where(Function(gvr) gvr.FCCheckBox("ChkConciliado").Checked).Count = 1 AndAlso GvDatos.Rows.Cast(Of GridViewRow).Where(Function(gvr) gvr.FCCheckBox("ChkConciliado").Checked).Count >= 1 + + If Not (CumpleCriterioContable OrElse CumpleCriterioBancario) Then + Alert("Debe seleccionar solo 1 folio del lado contable o bancario", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim ObjBancos As New ClsBancos Dim ObjOI As New ClsOIEventos(ObjBancos.IniciaTransacSQL()) Dim ErrorTrans As Boolean = False