se obtiene el CveAgrupadorSat

This commit is contained in:
Antonio Gonzalez
2019-12-20 13:16:34 -07:00
parent 6562acea5a
commit 989b3720c8

View File

@@ -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