From e9f14f2edef1a12952391027180a046ede4cda9b Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 22 Feb 2023 09:21:04 -0700 Subject: [PATCH] =?UTF-8?q?--=20agregar=20AF,=20cuenta=20de=20acumulada=20?= =?UTF-8?q?--=20ajustes=20en=20conceptos=20de=20depreciaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AF/RepDepreciacion.aspx.vb | 7 +++---- General/SaldosIniciales.aspx.vb | 30 +++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/AF/RepDepreciacion.aspx.vb b/AF/RepDepreciacion.aspx.vb index 00cdc75ca..ca2c7f659 100644 --- a/AF/RepDepreciacion.aspx.vb +++ b/AF/RepDepreciacion.aspx.vb @@ -24,7 +24,6 @@ Partial Class AF_RepDepreciacion Protected Sub BtnGenerarDepreciacion_Click(sender As Object, e As System.EventArgs) Handles BtnGenerarDepreciacion.Click - If GvDatos.Rows.Count > 0 Then Dim CveActivoFijo As Integer 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) 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 Exit For 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 Exit For End If @@ -54,7 +54,6 @@ Partial Class AF_RepDepreciacion Exit For End If End If - Next If ErrorMovInv = False Then diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 67d851a82..da8efa4a5 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -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.
") + 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: {0} Activos Fijos correctamente.", NumRows), TipoMensaje.MsgInformacion) ObjAF.Commit()