diff --git a/Contabilidad2/CatCuentas.aspx b/Contabilidad2/CatCuentas.aspx index ca1f269ad..24cf2ec21 100644 --- a/Contabilidad2/CatCuentas.aspx +++ b/Contabilidad2/CatCuentas.aspx @@ -103,7 +103,6 @@
-
Subcuenta de
@@ -171,7 +170,6 @@

-
Concepto
diff --git a/Contabilidad2/CatCuentas.aspx.vb b/Contabilidad2/CatCuentas.aspx.vb index 40341986f..c863ad3d2 100644 --- a/Contabilidad2/CatCuentas.aspx.vb +++ b/Contabilidad2/CatCuentas.aspx.vb @@ -154,6 +154,7 @@ Partial Class Contabilidad2_CatCuentas ArbolCuentas.nodoid = "CveCuenta" ArbolCuentas.padre = "CvePadre" ArbolCuentas.titulo = "CtaCodigo" + ArbolCuentas.DataBind() End Sub @@ -175,7 +176,7 @@ Partial Class Contabilidad2_CatCuentas dt = getNodospadreHijos(IDSelected) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then Dim dr As DataRow = dt.Rows(0) - TxtCuenta.Text = Trim(dr("CuentaFormato").ToString.Replace("-", "").ToString) + 'TxtCuenta.Text = Trim(dr("CuentaFormato").ToString.Replace("-", "").ToString) 'Tcuenta.Text = Trim(dr("CuentaFormato").ToString.Replace("-", "").ToString) Tsubcuenta.Text = dr("CuentaFormato").ToString() DTcuenta.SelectedValue = dr("Tipo").ToString() @@ -371,7 +372,6 @@ Partial Class Contabilidad2_CatCuentas 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjConta As New ClsContabilidad - Dim ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa) Dim CuentaEfectivo As Integer = 0 Dim Afectable As Integer = 1 'If(DcuentaMayor.SelectedValue <> 2, 0, 1) ' cuando sea tipo 2, va a ser afectable @@ -386,65 +386,69 @@ Partial Class Contabilidad2_CatCuentas End If If idnew > 0 Then + If UsuarioActual.Empresa.TipoContabilidad <> 1 Then + Dim ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa) + Dim codigoPadre As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}") 'Tsubcuenta.Text + If ObjConta2.GetCuentas(-1, "-1", -1) Then + Dim IdPadre As Integer = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"Codigo='{codigoPadre}'").ToEntero + Dim IdAgrupador As Integer - Dim codigoPadre As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}") 'Tsubcuenta.Text - If ObjConta2.GetCuentas(-1, "-1", -1) Then - Dim IdPadre As Integer = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"Codigo='{codigoPadre}'").ToEntero - Dim IdAgrupador As Integer - - If ObjConta2.GetAgrupadoresSAT() Then - IdAgrupador = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"CodigoNombre='{DdlAgrupadorSAT.SelectedItem.Text}'").ToEntero - End If - - If IdPadre > 0 Then - Dim idnew2 As Integer = ObjConta2.AddCuenta(TxtCuenta.Text.Replace("-", ""), Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, CuentaEfectivo, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToEntero, TxtNomIngles.Text.Trim, Afectable, IdPadre, IdAgrupador) - - If idnew2 > 0 Then - If ObjConta.UpdateCuentaCompaq(idnew, idnew2, UsuarioActual.CveEmpresa) Then - End If + If ObjConta2.GetAgrupadoresSAT() Then + IdAgrupador = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"CodigoNombre='{DdlAgrupadorSAT.SelectedItem.Text}'").ToEntero End If + If IdPadre > 0 Then + Dim idnew2 As Integer = ObjConta2.AddCuenta(TxtCuenta.Text.Replace("-", ""), Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, CuentaEfectivo, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToEntero, TxtNomIngles.Text.Trim, Afectable, IdPadre, IdAgrupador) + + If idnew2 > 0 Then + If ObjConta.UpdateCuentaCompaq(idnew, idnew2, UsuarioActual.CveEmpresa) Then + End If + End If + + End If End If + ObjConta2.Dispose() End If - Dim dr As DataRow = DtDatos.NewRow - dr("CveCuenta") = idnew - dr("CuentaFormato") = TxtCuenta.Text - 'dr("CuentaFormato") = Tcuenta.Text - dr("Nombre") = Tnombre.Text - dr("CtaCodigo") = String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text) - 'dr("CtaCodigo") = String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text) - dr("Tipo") = DTcuenta.SelectedValue.ToString - dr("CtaMayor") = DcuentaMayor.SelectedValue.ToString - dr("CvePadre") = IDSelected - dr("Codigo") = Tnombre.Text - dr("CveMoneda") = DdlMoneda.SelectedValue.ToEntero - dr("DigAgrup") = TxtDigAgrup.Text.Trim.ToEntero - dr("NomIdioma") = TxtNomIngles.Text.Trim - DtDatos.Rows.Add(dr) - ArbolCuentas.DataSource = DtDatos - '.Attributes.Add("data-hijos","0"); - Dim item As ADServerControl.DragableItem = DirectCast(ArbolCuentas.FindControl(String.Format("{0}", IDSelected)), ADServerControl.DragableItem) - item.Attributes.Item("data-hijos") = item.Attributes.Item("data-hijos").ToEntero + 1 - Dim objul As ADServerControl.DragableUL = DirectCast(ArbolCuentas.FindControl(String.Format("ul{0}", IDSelected)), ADServerControl.DragableUL) - If (IsNothing(objul)) Then - objul = New ADServerControl.DragableUL - objul.ID = String.Format("ul{0}", item.Cve) - item.Controls.Add(objul) - End If - ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text)) - 'ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text)) - 'updatos.Visible = False - 'nuevacuenta.Visible = False + 'Dim dr As DataRow = DtDatos.NewRow + 'dr("CveCuenta") = idnew + 'dr("CuentaFormato") = TxtCuenta.Text + ''dr("CuentaFormato") = Tcuenta.Text + 'dr("Nombre") = Tnombre.Text + 'dr("CtaCodigo") = String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text) + ''dr("CtaCodigo") = String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text) + 'dr("Tipo") = DTcuenta.SelectedValue.ToString + 'dr("CtaMayor") = DcuentaMayor.SelectedValue.ToString + 'dr("CvePadre") = IDSelected + 'dr("Codigo") = Tnombre.Text + 'dr("CveMoneda") = DdlMoneda.SelectedValue.ToEntero + 'dr("DigAgrup") = TxtDigAgrup.Text.Trim.ToEntero + 'dr("NomIdioma") = TxtNomIngles.Text.Trim + 'DtDatos.Rows.Add(dr) + 'ArbolCuentas.DataSource = DtDatos + ''.Attributes.Add("data-hijos","0"); + 'Dim item As ADServerControl.DragableItem = DirectCast(ArbolCuentas.FindControl(String.Format("{0}", IDSelected)), ADServerControl.DragableItem) + 'item.Attributes.Item("data-hijos") = item.Attributes.Item("data-hijos").ToEntero + 1 + 'Dim objul As ADServerControl.DragableUL = DirectCast(ArbolCuentas.FindControl(String.Format("ul{0}", IDSelected)), ADServerControl.DragableUL) + 'If (IsNothing(objul)) Then + ' objul = New ADServerControl.DragableUL + ' objul.ID = String.Format("ul{0}", item.Cve) + ' item.Controls.Add(objul) + 'End If + 'ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text)) + ''ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text)) + + ''updatos.Visible = False + ''nuevacuenta.Visible = False LimpiarCampos() updatos.Update() CargaDatos() + Alert("La cuenta se guardo correctamente") End If ObjConta.Dispose() - ObjConta2.Dispose() End Sub Private Sub LimpiarCampos() TxtCuenta.Text = "" @@ -469,7 +473,6 @@ Partial Class Contabilidad2_CatCuentas Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjConta As New ClsContabilidad - Dim ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa) 'ObjConta.IniciaTransacSQL() If ObjConta.RemoveCuenta(IDSelected.ToEntero) Then @@ -492,21 +495,27 @@ Partial Class Contabilidad2_CatCuentas Alert("La Cuenta ha sido eliminada", TipoMensaje.MsgInformacion) Dim codigo As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}") - If ObjConta2.GetCuentas(-1, "-1", -1) Then - Dim Id As Integer = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"Codigo='{codigo}'").ToEntero - If Id > 0 Then - If ObjConta2.RemoveCuenta(Id) Then + If UsuarioActual.Empresa.TipoContabilidad <> 1 Then + Dim ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa) + If ObjConta2.GetCuentas(-1, "-1", -1) Then + Dim Id As Integer = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"Codigo='{codigo}'").ToEntero + + If Id > 0 Then + If ObjConta2.RemoveCuenta(Id) Then + End If End If End If + ObjConta2.Dispose() + End If + Else Alert("La Cuenta no pudo ser eliminada", TipoMensaje.MsgError) ' ObjConta.RollBack() End If ObjConta.Dispose() - ObjConta2.Dispose() End Sub 'Protected Sub BtnCambiaAgrupadorSAT_Click(sender As Object, e As EventArgs)