-- mejora alta cuentas
This commit is contained in:
@@ -1559,38 +1559,42 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
|
||||
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)
|
||||
Dim Cuenta As String = Row("Cuenta").ToString.Trim
|
||||
If Cuenta <> "" Then
|
||||
NombreCuenta = Row("NombreCuenta").ToString.Trim
|
||||
CuentaPadre = Row("CuentaPadre").ToString.Trim
|
||||
|
||||
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
|
||||
Dim TipoCuenta As String = Row("TipoCuenta").ToString.Trim
|
||||
Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString.Trim
|
||||
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
|
||||
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")
|
||||
@@ -1598,12 +1602,12 @@ Partial Class General_SaldosIniciales
|
||||
End If
|
||||
If Not TieneError Then
|
||||
ObjConta.Commit()
|
||||
Alert($"Se agregaron {ContadorUpdate} Cuentas Correctamente y se omitieron: {ContadorError} cuentas.")
|
||||
Else
|
||||
Alert($"No pudimos agregar la cuenta en ContaSIG: {NombreCuenta} - Cuenta Padre: {CuentaPadre}", TipoMensaje.MsgError)
|
||||
ObjConta.RollBack()
|
||||
End If
|
||||
|
||||
Alert($"Se agregaron {ContadorUpdate} Cuentas Correctamente y se omitieron: {ContadorError} cuentas.")
|
||||
|
||||
Catch ex As Exception
|
||||
ObjConta.RollBack()
|
||||
|
||||
Reference in New Issue
Block a user