--FIX. ConciliacionesBancarias, poder seleccionar de 1 a N. para asociarlas

This commit is contained in:
JPerez
2025-07-14 14:30:14 -07:00
parent 85b626bb44
commit 3f2ccf7a13

View File

@@ -6,6 +6,7 @@ Imports Extensiones
Imports System.Xml Imports System.Xml
Imports Microsoft.Reporting.WebForms Imports Microsoft.Reporting.WebForms
Imports System.Globalization Imports System.Globalization
Imports Telerik.Web.UI
Partial Class Bancos_ConciliacionesBancariasaspx Partial Class Bancos_ConciliacionesBancariasaspx
Inherits ClsPaginas Inherits ClsPaginas
@@ -231,15 +232,20 @@ Partial Class Bancos_ConciliacionesBancariasaspx
RegistraScript("$('#DModalCriterio').modal()") RegistraScript("$('#DModalCriterio').modal()")
End Sub End Sub
Private Sub ConciliacionManual() 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 SumaSIGAbono As Double = 0
Dim SumaSIGCargo As Double = 0 Dim SumaSIGCargo As Double = 0
Dim SumaExcelAbono As Double = 0 Dim SumaExcelAbono As Double = 0
Dim SumaExcelCargo As Double = 0 Dim SumaExcelCargo As Double = 0
Dim Seleccionados As Integer = 0
Dim Fecha As Date Dim Fecha As Date
For Each Gvr As GridViewRow In GvDatos.Rows For Each Gvr As GridViewRow In GvDatos.Rows
If Gvr.FCCheckBox("ChkConciliado").Checked And Gvr.FCCheckBox("ChkConciliado").Enabled Then If Gvr.FCCheckBox("ChkConciliado").Checked And Gvr.FCCheckBox("ChkConciliado").Enabled Then
Seleccionados += 1
Fecha = Gvr.DataKey("FechaDocumento").ToDate Fecha = Gvr.DataKey("FechaDocumento").ToDate
If Gvr.DataKey("Tipo") = "Cargo" Then If Gvr.DataKey("Tipo") = "Cargo" Then
If Gvr.DataKey("Importe").ToDouble < 0 Then ' cuando es negativo suma para el abono 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
End If End If
Next 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 For Each Gvr As GridViewRow In GvEdoConciliacion.Rows
If Gvr.FCCheckBox("ChkConciliado").Checked And Gvr.FCCheckBox("ChkConciliado").Enabled Then 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 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
End If End If
Next Next
If SumaSIGCargo <> SumaExcelCargo OrElse SumaSIGAbono <> SumaExcelAbono Then If SumaSIGCargo <> SumaExcelCargo OrElse SumaSIGAbono <> SumaExcelAbono Then
Alert($"La suma de los importes no cuadran ({SumaSIGCargo}-{SumaExcelCargo}**{SumaSIGAbono}-{SumaExcelAbono})", TipoMensaje.MsgAdvertencia) Alert($"La suma de los importes no cuadran ({SumaSIGCargo}-{SumaExcelCargo}**{SumaSIGAbono}-{SumaExcelAbono})", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If 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 ObjBancos As New ClsBancos
Dim ObjOI As New ClsOIEventos(ObjBancos.IniciaTransacSQL()) Dim ObjOI As New ClsOIEventos(ObjBancos.IniciaTransacSQL())
Dim ErrorTrans As Boolean = False Dim ErrorTrans As Boolean = False