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

@@ -24,7 +24,6 @@ Partial Class AF_RepDepreciacion
Protected Sub BtnGenerarDepreciacion_Click(sender As Object, e As System.EventArgs) Handles BtnGenerarDepreciacion.Click Protected Sub BtnGenerarDepreciacion_Click(sender As Object, e As System.EventArgs) Handles BtnGenerarDepreciacion.Click
If GvDatos.Rows.Count > 0 Then If GvDatos.Rows.Count > 0 Then
Dim CveActivoFijo As Integer Dim CveActivoFijo As Integer
Dim ObjInventario As New ClsInventarios Dim ObjInventario As New ClsInventarios
@@ -41,11 +40,12 @@ Partial Class AF_RepDepreciacion
Dim ConceptoPolizaDetalle As String = String.Format("Depreciación - {0} - {1}", txtFechaI.Text, RowsDt.FCLiteral("LtlDescripcion").Text) Dim ConceptoPolizaDetalle As String = String.Format("Depreciación - {0} - {1}", txtFechaI.Text, RowsDt.FCLiteral("LtlDescripcion").Text)
If CvePrePoliza > 0 Then If CvePrePoliza > 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -MontoDepreciacion, -MontoDepreciacion, 270, ConceptoPolizaDetalle, ConceptoPolizaDetalle, 0, CveActivoFijo:=CveActivoFijo, CveSubProyecto:=CveSubProyecto) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, MontoDepreciacion, MontoDepreciacion, 101, ConceptoPolizaDetalle, ConceptoPolizaDetalle, 0, CveActivoFijo:=CveActivoFijo, CveSubProyecto:=CveSubProyecto) Then
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, MontoDepreciacion, MontoDepreciacion, 101, ConceptoPolizaDetalle, ConceptoPolizaDetalle, 0, CveActivoFijo:=CveActivoFijo, CveSubProyecto:=CveSubProyecto) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, MontoDepreciacion, MontoDepreciacion, 270, ConceptoPolizaDetalle, ConceptoPolizaDetalle, 0, CveActivoFijo:=CveActivoFijo, CveSubProyecto:=CveSubProyecto) Then
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If End If
@@ -54,7 +54,6 @@ Partial Class AF_RepDepreciacion
Exit For Exit For
End If End If
End If End If
Next Next
If ErrorMovInv = False Then If ErrorMovInv = False Then

View File

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