From e5bd328ed2fe44856c945493ed22e5eb996a7f6a Mon Sep 17 00:00:00 2001 From: Oscar Irigoyen Date: Wed, 18 Jan 2023 08:18:46 -0700 Subject: [PATCH] Saldos Iniciales Correcion validacion Clasificaiones --- General/SaldosIniciales.aspx.vb | 63 +++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 045a6964e..fac6f797e 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -647,7 +647,7 @@ Partial Class General_SaldosIniciales Dim DTCuentasContables As New DataTable - If UsuarioActual.Empresa.TipoContabilizacion = 1 Or UsuarioActual.CveEmpresa.Contiene(172) Then + If UsuarioActual.Empresa.TipoContabilizacion = 1 Or UsuarioActual.CveEmpresa.Contiene(172, 174) Then Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then @@ -2344,9 +2344,42 @@ Partial Class General_SaldosIniciales Private Sub ProcesaClasificaciones(dt As DataTable, dTCuentasContables As DataTable) + Dim ErrorProceso As Boolean = False + + + Dim SBMensajesCuentasNoEncontradas As New StringBuilder + + For Each dRow As DataRow In dt.FiltraParametros(" LEN(Clasificacion) > 0 ").Rows + + Dim Clasificacion As String = dRow("Clasificacion").ToString().Trim.Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") + + Dim CuentaContableIngreso As String = dRow("CuentaContableIngreso").ToString().Trim.Replace("-", "").Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") + Dim CuentaContableGasto As String = dRow("CuentaContableGasto").ToString().Trim.Replace("-", "").Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") + + + Dim CveCuentaContableIngreso As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableIngreso}'").ToEntero() + Dim CveCuentaContableGasto As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableGasto}'").ToEntero() + + If CuentaContableIngreso.Trim.Length > 0 AndAlso CveCuentaContableIngreso <= 0 Then + SBMensajesCuentasNoEncontradas.AppendLine($"Clasificación {Clasificacion} no se encontro la cuenta de ingreso {CuentaContableIngreso}.
") + ErrorProceso = True + End If + + If CuentaContableGasto.Trim.Length > 0 AndAlso CveCuentaContableGasto <= 0 Then + SBMensajesCuentasNoEncontradas.AppendLine($"Clasificación {Clasificacion} no se encontro la cuenta de gasto {CuentaContableGasto}.
") + ErrorProceso = True + End If + + Next + + If ErrorProceso Then + Alert($"Cuentas no encontradas.
{SBMensajesCuentasNoEncontradas.ToString}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim ObjClasificaciones As New ClsClasificaciones Dim ObjConta As New ClsContabilidad(ObjClasificaciones.IniciaTransacSQL) - Dim ErrorProceso As Boolean = False + Dim Contador As Integer = 0 @@ -2411,15 +2444,15 @@ Partial Class General_SaldosIniciales Dim CveCuentaContableIngreso As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableIngreso}'").ToEntero() Dim CveCuentaContableGasto As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableGasto}'").ToEntero() - If CuentaContableIngreso.Trim.Length > 0 AndAlso CveCuentaContableIngreso <= 0 Then - Alert($"Clasificación {Clasificacion} no se encontro la cuenta de ingreso {CuentaContableIngreso}.", TipoMensaje.MsgAdvertencia) - ErrorProceso = True - End If + 'If CuentaContableIngreso.Trim.Length > 0 AndAlso CveCuentaContableIngreso <= 0 Then + ' Alert($"Clasificación {Clasificacion} no se encontro la cuenta de ingreso {CuentaContableIngreso}.", TipoMensaje.MsgAdvertencia) + ' ErrorProceso = True + 'End If - If CuentaContableGasto.Trim.Length > 0 AndAlso CveCuentaContableGasto <= 0 Then - Alert($"Clasificación {Clasificacion} no se encontro la cuenta de gasto {CuentaContableGasto}.", TipoMensaje.MsgAdvertencia) - ErrorProceso = True - End If + 'If CuentaContableGasto.Trim.Length > 0 AndAlso CveCuentaContableGasto <= 0 Then + ' Alert($"Clasificación {Clasificacion} no se encontro la cuenta de gasto {CuentaContableGasto}.", TipoMensaje.MsgAdvertencia) + ' ErrorProceso = True + 'End If Dim CveClasificaionTemp = DTClasificaiones.FiltroPrimeroValor("CveClasificacion", $"Clasificacion='{Clasificacion}'").ToEntero() @@ -2435,9 +2468,17 @@ Partial Class General_SaldosIniciales CveClasificacion = ObjClasificaciones.CveClasificacion - If Not CveClasificacion > 0 Then + If CveClasificacion > 0 Then + If ObjClasificaciones.GetClasificaciones(UsuarioActual.CveEmpresa) Then + DTClasificaiones = ObjClasificaciones.DtResultados + End If + Else + ErrorProceso = True End If + + + Else ErrorProceso = True End If