From 989b3720c83d634b61d4a1b9595172e28def63bb Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Fri, 20 Dec 2019 13:16:34 -0700 Subject: [PATCH] se obtiene el CveAgrupadorSat --- General/SaldosIniciales.aspx.vb | 78 +++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 07e610b87..9821c652d 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1797,40 +1797,52 @@ Partial Class General_SaldosIniciales Dim NombreCuenta As String = "" Dim CuentaPadre As String = "" - For Each Row As DataRow In dt.Rows - NombreCuenta = Row("NombreCuenta").ToString - CuentaPadre = Row("CuentaPadre").ToString - Dim Cuenta As String = Row("Cuenta").ToString - Dim TipoCuenta As String = Row("TipoCuenta").ToString - Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString - Dim CveCuentaPadre As Integer = -1 - - If Not CuentaPadre = "" Then - If ObjConta.GetCuentas(-1, CuentaPadre.Replace("-", ""), -1, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero - Else - TieneError = True - Exit For - End If - Else - TieneError = True - Exit For - End If - Else - CveCuentaPadre = -2 - End If - - Dim IdNew = ObjConta.AddCuenta(CveCuentaPadre, Cuenta.Replace("-", ""), NombreCuenta, TipoCuenta, 1, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa) - If IdNew > 0 Then - ContadorUpdate = ContadorUpdate + 1 - Else - TieneError = True - ContadorError = ContadorError + 1 - Exit For - End If - Next + Dim AgrupadoresSAT As DataTable = New DataTable + If ObjConta.GetAgrupadoresSAT(UsuarioActual.CveEmpresa) Then + AgrupadoresSAT = ObjConta.DtResultados + End If + If AgrupadoresSAT.Rows.Count > 0 Then + + + For Each Row As DataRow In dt.Rows + NombreCuenta = Row("NombreCuenta").ToString + CuentaPadre = Row("CuentaPadre").ToString + Dim Cuenta As String = Row("Cuenta").ToString + Dim TipoCuenta As String = Row("TipoCuenta").ToString + Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString + Dim CveCuentaPadre As Integer = -1 + Dim CveAgrupadorSAT As Integer = If(AgrupadorSAT = "0", -1, AgrupadoresSAT.FiltroPrimeroValor("CveAgrupadorSAT", String.Format("CodigoNombre LIKE '%{0}%'", AgrupadorSAT)).ToEntero) + + If Not CuentaPadre = "" Then + If ObjConta.GetCuentas(-1, CuentaPadre.Replace("-", ""), -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + Else + TieneError = True + Exit For + End If + Else + TieneError = True + Exit For + End If + Else + CveCuentaPadre = -2 + End If + + Dim IdNew = ObjConta.AddCuenta(CveCuentaPadre, Cuenta.Replace("-", ""), NombreCuenta, TipoCuenta, 1, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa, CveAgrupadorSAT:=CveAgrupadorSAT) + If IdNew > 0 Then + ContadorUpdate = ContadorUpdate + 1 + Else + TieneError = True + ContadorError = ContadorError + 1 + Exit For + End If + Next + Else + Alert("No se tienen asociados Agrupadores para esta empresa") + TieneError = True + End If If Not TieneError Then ObjConta.Commit() Else