From 4406c1768884910fba0a657cbaf49e23485d1a73 Mon Sep 17 00:00:00 2001 From: Oscar Irigoyen Date: Tue, 11 Oct 2022 18:53:54 -0700 Subject: [PATCH] CatCuentas --- App_Code/ClsContabilidad.vb | 6 +++++- Contabilidad2/CatCuentas.aspx | 8 +++++++ Contabilidad2/CatCuentas.aspx.vb | 36 +++++++++++++++++++++++++++++++- General/SaldosIniciales.aspx.vb | 12 +++++------ 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index c39d24f8f..be86a5e61 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -4747,7 +4747,9 @@ Public Class ClsContabilidad Public Function UpdateCuenta(CveCuenta As Integer, Nombre As String, Tipo As String, CtaMayor As Integer, CveMoneda As Integer, Optional DigAgrupador As Integer = -1, Optional CveAgrupadorSAT As Integer = -1, Optional NomIdioma As String = "", Optional CveConceptoAdmin As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CveClasificacion As Integer = -1, Optional PorcentajeImpuesto As Decimal = -1, - Optional CveBancoCuenta As Integer = -1, Optional CveAlmacen As Integer = -1, Optional Afectable As Integer = -1, Optional Codigo As String = "-1") As Boolean + Optional CveBancoCuenta As Integer = -1, Optional CveAlmacen As Integer = -1, Optional Afectable As Integer = -1, Optional Codigo As String = "-1", + Optional CvePadre As Integer = -1) As Boolean + Dim Retorno As Boolean = False DataAdapter("PA_Conta_UpdateCuentas") @@ -4770,6 +4772,8 @@ Public Class ClsContabilidad .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@Afectable", SqlDbType.Int).Value = Afectable .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@CvePadre", SqlDbType.Int).Value = CvePadre + End With diff --git a/Contabilidad2/CatCuentas.aspx b/Contabilidad2/CatCuentas.aspx index ad6288165..51bcc8812 100644 --- a/Contabilidad2/CatCuentas.aspx +++ b/Contabilidad2/CatCuentas.aspx @@ -47,6 +47,11 @@ font-size: 9px !important; content: "\f040"; } + + #select2-C_DdlCuentaContable-results{ + max-width:300px!important + } + @@ -110,6 +115,9 @@
Subcuenta de
+ +
diff --git a/Contabilidad2/CatCuentas.aspx.vb b/Contabilidad2/CatCuentas.aspx.vb index 39a2a3978..6845bb71a 100644 --- a/Contabilidad2/CatCuentas.aspx.vb +++ b/Contabilidad2/CatCuentas.aspx.vb @@ -186,6 +186,10 @@ Partial Class Contabilidad2_CatCuentas End Function Protected Sub agregar_Click(sender As Object, e As EventArgs) Handles ArbolCuentas.addclick LimpiarCampos() + + Tsubcuenta.Visible = True + DdlCuentaContable.Visible = False + Dim dt As New DataTable 'IDSelected = HdnID.Value.ToEntero() "ul" + itempadre.Cve; @@ -243,6 +247,11 @@ Partial Class Contabilidad2_CatCuentas Protected Sub editar_Click(sender As Object, e As EventArgs) Handles ArbolCuentas.editclick LimpiarCampos() limpiavalorescontables() + CargaCuentasContables() + + Tsubcuenta.Visible = False + DdlCuentaContable.Visible = True + Dim dt As DataTable Dim obj As ADServerControl.DragableItem = DirectCast(sender, ADServerControl.DragableItem) IDSelected = obj.Cve @@ -301,6 +310,7 @@ Partial Class Contabilidad2_CatCuentas If dt.Rows.Count > 0 Then Dim drt As DataRow = dt.Rows(0) Tsubcuenta.Text = drt("Codigo").ToString + DdlCuentaContable.SelectedValueExist(drt("CveCuenta").ToString) LblSubCuenta.Text = drt("Nombre").ToString End If @@ -313,6 +323,25 @@ Partial Class Contabilidad2_CatCuentas End Sub + Private Sub CargaCuentasContables() + + DdlCuentaContable.ClearSelection() + DdlCuentaContable.Items.Clear() + DdlCuentaContable.SelectedValue = Nothing + + Dim ObjConta As New ClsContabilidad + + If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + DdlCuentaContable.DataSource = ObjConta.DtResultados + End If + + ObjConta.Dispose() + + DdlCuentaContable.DataBind() + DdlCuentaContable.Items.Insert(0, New ListItem("-", "-1")) + DdlCuentaContable.SelectedValueExist("-1") + + End Sub Protected Sub Guardar_Click(sender As Object, e As EventArgs) Handles Guardar.Click If Tnombre.Text.Trim = "" Then Alert("Ingrese nombre de la cuenta", TipoMensaje.MsgError) : Exit Sub @@ -328,11 +357,13 @@ Partial Class Contabilidad2_CatCuentas Dim CveBancoCuenta As Integer = ddlBancos.SelectedValue.ToEntero Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero() + + If DdlAgrupadorSAT.SelectedValue.ToEntero > 0 Then If ObjConta.UpdateCuenta(IDSelected.ToEntero, Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToString.ToEntero, DdlAgrupadorSAT.SelectedValue.ToEntero, TxtNomIngles.Text.ToString, CveConceptoAdmin:=CveConceptoAdmin, CveProveedor:=CveProveedor, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeImpuesto, - CveBancoCuenta:=CveBancoCuenta, CveAlmacen:=CveAlmacen, Codigo:=TxtCuenta.Text.Replace("-", "")) Then + CveBancoCuenta:=CveBancoCuenta, CveAlmacen:=CveAlmacen, Codigo:=TxtCuenta.Text.Replace("-", ""), CvePadre:=DdlCuentaContable.SelectedValue.ToEntero) Then If UsuarioActual.Empresa.TipoContabilidad = 2 Then Dim ObjContaEmpresa As New ClsContPAQi(UsuarioActual.Empresa) @@ -592,6 +623,9 @@ Partial Class Contabilidad2_CatCuentas nuevacuenta.Visible = False TxtCuenta.Enabled = False 'Tcuenta.Enabled = False + DdlCuentaContable.SelectedValueExist(-1) + DdlCuentaContable.Visible = False + Tsubcuenta.Visible = True BtnEliminar.Visible = False End Sub diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 011cfec39..2c3d36add 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1018,7 +1018,7 @@ Partial Class General_SaldosIniciales Dim CodigoRegimenFiscal As String = Row("Regimen Fiscal").ToString - Dim Clasificacion As String = Row("Clasificación Proveedor").ToString + Dim ProveedorClasificacion As String = Row("Clasificación Proveedor").ToString Dim Moneda As String = Row("Moneda Preferente").ToString Dim DIOTTipoTercero As String = Row("Tipo Tercero").ToString.Trim.ToUpper Dim DIOTipoOperacion As String = Row("Tipo Operación").ToString @@ -1100,10 +1100,10 @@ Partial Class General_SaldosIniciales End If - If Clasificacion.Trim.Length > 0 Then - CveProveedorClasificacion = DTClasificaciones.FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero + If ProveedorClasificacion.Trim.Length > 0 Then + CveProveedorClasificacion = GlobalDTProveedorClasificacion(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedorClasificacion", $"ProveedorClasificacion = '{ProveedorClasificacion}'").ToString.ToEntero If Not CveProveedorClasificacion > 0 Then - sbErrores.AppendLine($"Proveedor {RazonSocial} Clasificación {Clasificacion} invalida.
") + sbErrores.AppendLine($"Proveedor {RazonSocial} Proveedor Clasificacion {ProveedorClasificacion} invalida.
") ErrorProv = True End If End If @@ -2019,10 +2019,10 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - Dim Cuenta As String = Row("Cuenta").ToString.Trim + Dim Cuenta As String = Row("Cuenta").ToString.Trim.Replace("-", "") If Cuenta <> "" Then NombreCuenta = Row("NombreCuenta").ToString.Trim - CuentaPadre = Row("CuentaPadre").ToString.Trim + CuentaPadre = Row("CuentaPadre").ToString.Trim.Replace("-", "") Dim TipoCuenta As String = Row("TipoCuenta").ToString.Trim Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString.Trim