diff --git a/Contabilidad2/CatCuentas.aspx.vb b/Contabilidad2/CatCuentas.aspx.vb index c863ad3d2..720b93107 100644 --- a/Contabilidad2/CatCuentas.aspx.vb +++ b/Contabilidad2/CatCuentas.aspx.vb @@ -316,7 +316,7 @@ Partial Class Contabilidad2_CatCuentas Dim codigo As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}") - If UsuarioActual.Empresa.TipoContabilidad <> 1 Then + If UsuarioActual.Empresa.TipoContabilidad = 2 Then Using ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa) @@ -372,6 +372,10 @@ Partial Class Contabilidad2_CatCuentas 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjConta As New ClsContabilidad +<<<<<<< HEAD + Dim ObjConta2 As ClsContPAQi +======= +>>>>>>> ee1135d888f76469fa6e3e68f0b6393f8450045a 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,7 +390,7 @@ Partial Class Contabilidad2_CatCuentas End If If idnew > 0 Then - If UsuarioActual.Empresa.TipoContabilidad <> 1 Then + If UsuarioActual.Empresa.TipoContabilidad = 2 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 @@ -397,58 +401,71 @@ Partial Class Contabilidad2_CatCuentas 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 + Dim codigoPadre As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}") 'Tsubcuenta.Text + If UsuarioActual.Empresa.TipoContabilidad = 2 Then + ObjConta2 = New ClsContPAQi(UsuarioActual.Empresa) + + 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 + 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)) + + LimpiarCampos() + updatos.Update() + CargaDatos() + + Alert("La cuenta se guardo correctamente") End If - ObjConta2.Dispose() - End If + + ObjConta.Dispose() + + If ObjConta2 IsNot Nothing Then ObjConta2.Dispose() - '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() End Sub Private Sub LimpiarCampos() TxtCuenta.Text = "" @@ -496,7 +513,7 @@ Partial Class Contabilidad2_CatCuentas Dim codigo As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}") - If UsuarioActual.Empresa.TipoContabilidad <> 1 Then + If UsuarioActual.Empresa.TipoContabilidad = 2 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