-- agregar AF, cuenta de acumulada

-- ajustes en conceptos de depreciación
This commit is contained in:
2023-02-22 09:21:04 -07:00
parent 1f8b42c78a
commit e9f14f2ede
2 changed files with 26 additions and 11 deletions

View File

@@ -1814,6 +1814,9 @@ Partial Class General_SaldosIniciales
If Not dt.Columns.Contains("CveCuentaContableDepreciacion") Then
dt.Columns.Add("CveCuentaContableDepreciacion", GetType(Integer))
End If
If Not dt.Columns.Contains("CveCuentaContableDepreciacionAcum") Then
dt.Columns.Add("CveCuentaContableDepreciacionAcum", GetType(Integer))
End If
Dim sbErrores As New StringBuilder
For Each Row As DataRow In dt.Rows
@@ -1822,10 +1825,8 @@ Partial Class General_SaldosIniciales
Dim Descripcion As String = Row("Descripción").ToString()
Dim CuentaContable As String = Row("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "")
If CuentaContable.Length > 0 Then
Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero()
If CveCuentaContable > 0 Then
Row("CveCuentaContable") = CveCuentaContable
Else
@@ -1834,10 +1835,8 @@ Partial Class General_SaldosIniciales
End If
End If
CuentaContable = Row("Cuenta Depreciación").ToString().Trim.Replace("-", "").Replace(" ", "")
If CuentaContable.Length > 0 Then
Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero()
If CveCuentaContable > 0 Then
Row("CveCuentaContableDepreciacion") = CveCuentaContable
Else
@@ -1845,6 +1844,16 @@ Partial Class General_SaldosIniciales
ErrorAF = True
End If
End If
CuentaContable = Row("Cuenta Depreciación Acumulada").ToString().Trim.Replace("-", "").Replace(" ", "")
If CuentaContable.Length > 0 Then
Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero()
If CveCuentaContable > 0 Then
Row("CveCuentaContableDepreciacionAcum") = CveCuentaContable
Else
sbErrores.AppendLine($"Activo Fijo {Codigo} {Descripcion} cuenta {CuentaContable} no encontrada.<br>")
ErrorAF = True
End If
End If
Next
If Not ErrorAF Then
@@ -1859,8 +1868,6 @@ Partial Class General_SaldosIniciales
Dim ObjConta As New ClsContabilidad(ObjAF.IniciaTransacSQL)
Try
Dim Contador As Integer = 0
Dim NumRow As Integer = 0
@@ -1889,7 +1896,8 @@ Partial Class General_SaldosIniciales
Dim CveEstadoActivoFijo As Integer = GlobalDTEstadoActivoFijo().FiltroPrimeroValor("CveEstadoActivoFijo", $"EstadoActivoFijo = '{Estado}'").ToString().ToEntero()
Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"Nombre = '{Cliente}'").ToString().ToEntero()
Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString().ToEntero()
Dim CveCuentaContableDepreciacion As Integer = Row("CveCuentaContable").ToString().ToEntero()
Dim CveCuentaContableDepreciacion As Integer = Row("CveCuentaContableDepreciacion").ToString().ToEntero()
Dim CveCuentaContableDepreciacionAcum As Integer = Row("CveCuentaContableDepreciacionAcum").ToString().ToEntero()
'VALIDACIONES
If Not CveSubTipoAF > 0 Then Alert($"No se encontró el SubTipo: {TipoAF} Descripcion: {Descripcion} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorAF = True : Exit For
@@ -1920,6 +1928,13 @@ Partial Class General_SaldosIniciales
ErrorAF = True
End If
End If
If CveCuentaContableDepreciacion > 0 Then
If Not ObjConta.AddCuentasAsignaciones(270, UsuarioActual.CveEmpresa, CveCuentaContableDepreciacionAcum, -1,
-1, -1, -1, -1, -1, 0, CveBancoCuenta:=-1, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=CveAF,
CveTipoGasto:=-1, RegeneraCuenta:=False) Then
ErrorAF = True
End If
End If
Else
ErrorAF = True
Exit For
@@ -1934,6 +1949,7 @@ Partial Class General_SaldosIniciales
ObjAF.Commit()
TxtExcel.Text = ""
UpDatos.Update()
GlobalDTActivoFijos(UsuarioActual.CveEmpresa) = Nothing
Else
Alert(String.Format("Se agregaron: <b>{0}</b> Activos Fijos correctamente.", NumRows), TipoMensaje.MsgInformacion)
ObjAF.Commit()