-- mejora alta cuentas
This commit is contained in:
@@ -1559,38 +1559,42 @@ Partial Class General_SaldosIniciales
|
|||||||
|
|
||||||
|
|
||||||
For Each Row As DataRow In dt.Rows
|
For Each Row As DataRow In dt.Rows
|
||||||
NombreCuenta = Row("NombreCuenta").ToString
|
Dim Cuenta As String = Row("Cuenta").ToString.Trim
|
||||||
CuentaPadre = Row("CuentaPadre").ToString
|
If Cuenta <> "" Then
|
||||||
Dim Cuenta As String = Row("Cuenta").ToString
|
NombreCuenta = Row("NombreCuenta").ToString.Trim
|
||||||
Dim TipoCuenta As String = Row("TipoCuenta").ToString
|
CuentaPadre = Row("CuentaPadre").ToString.Trim
|
||||||
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
|
Dim TipoCuenta As String = Row("TipoCuenta").ToString.Trim
|
||||||
If ObjConta.GetCuentas(-1, CuentaPadre.Replace("-", ""), -1, UsuarioActual.CveEmpresa) Then
|
Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString.Trim
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
Dim CveCuentaPadre As Integer = -1
|
||||||
CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero
|
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
|
Else
|
||||||
TieneError = True
|
TieneError = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
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
|
Else
|
||||||
TieneError = True
|
TieneError = True
|
||||||
|
ContadorError = ContadorError + 1
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Else
|
|
||||||
CveCuentaPadre = -2
|
|
||||||
End If
|
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
|
Next
|
||||||
Else
|
Else
|
||||||
Alert("No se tienen asociados Agrupadores para esta empresa")
|
Alert("No se tienen asociados Agrupadores para esta empresa")
|
||||||
@@ -1598,12 +1602,12 @@ Partial Class General_SaldosIniciales
|
|||||||
End If
|
End If
|
||||||
If Not TieneError Then
|
If Not TieneError Then
|
||||||
ObjConta.Commit()
|
ObjConta.Commit()
|
||||||
|
Alert($"Se agregaron {ContadorUpdate} Cuentas Correctamente y se omitieron: {ContadorError} cuentas.")
|
||||||
Else
|
Else
|
||||||
Alert($"No pudimos agregar la cuenta en ContaSIG: {NombreCuenta} - Cuenta Padre: {CuentaPadre}", TipoMensaje.MsgError)
|
Alert($"No pudimos agregar la cuenta en ContaSIG: {NombreCuenta} - Cuenta Padre: {CuentaPadre}", TipoMensaje.MsgError)
|
||||||
ObjConta.RollBack()
|
ObjConta.RollBack()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Alert($"Se agregaron {ContadorUpdate} Cuentas Correctamente y se omitieron: {ContadorError} cuentas.")
|
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ObjConta.RollBack()
|
ObjConta.RollBack()
|
||||||
|
|||||||
Reference in New Issue
Block a user