Cambio al guardar y elimnar por tipo de contabilidad
This commit is contained in:
@@ -103,7 +103,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<hr />
|
|
||||||
<div class="form-line">
|
<div class="form-line">
|
||||||
<div class="catcuentas left">Subcuenta de</div>
|
<div class="catcuentas left">Subcuenta de</div>
|
||||||
<div class="catcuentas right">
|
<div class="catcuentas right">
|
||||||
@@ -171,7 +170,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<hr />
|
|
||||||
<div class="form-line">
|
<div class="form-line">
|
||||||
<div class="catcuentas left">Concepto</div>
|
<div class="catcuentas left">Concepto</div>
|
||||||
<div class="catcuentas right">
|
<div class="catcuentas right">
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ Partial Class Contabilidad2_CatCuentas
|
|||||||
ArbolCuentas.nodoid = "CveCuenta"
|
ArbolCuentas.nodoid = "CveCuenta"
|
||||||
ArbolCuentas.padre = "CvePadre"
|
ArbolCuentas.padre = "CvePadre"
|
||||||
ArbolCuentas.titulo = "CtaCodigo"
|
ArbolCuentas.titulo = "CtaCodigo"
|
||||||
|
ArbolCuentas.DataBind()
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -175,7 +176,7 @@ Partial Class Contabilidad2_CatCuentas
|
|||||||
dt = getNodospadreHijos(IDSelected)
|
dt = getNodospadreHijos(IDSelected)
|
||||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
Dim dr As DataRow = dt.Rows(0)
|
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)
|
'Tcuenta.Text = Trim(dr("CuentaFormato").ToString.Replace("-", "").ToString)
|
||||||
Tsubcuenta.Text = dr("CuentaFormato").ToString()
|
Tsubcuenta.Text = dr("CuentaFormato").ToString()
|
||||||
DTcuenta.SelectedValue = dr("Tipo").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 ClsContPAQi(UsuarioActual.Empresa)
|
||||||
Dim ObjConta As New ClsContabilidad
|
Dim ObjConta As New ClsContabilidad
|
||||||
Dim ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa)
|
|
||||||
|
|
||||||
Dim CuentaEfectivo As Integer = 0
|
Dim CuentaEfectivo As Integer = 0
|
||||||
Dim Afectable As Integer = 1 'If(DcuentaMayor.SelectedValue <> 2, 0, 1) ' cuando sea tipo 2, va a ser afectable
|
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
|
End If
|
||||||
|
|
||||||
If idnew > 0 Then
|
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.GetAgrupadoresSAT() Then
|
||||||
If ObjConta2.GetCuentas(-1, "-1", -1) Then
|
IdAgrupador = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"CodigoNombre='{DdlAgrupadorSAT.SelectedItem.Text}'").ToEntero
|
||||||
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
|
||||||
|
|
||||||
|
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
|
End If
|
||||||
|
ObjConta2.Dispose()
|
||||||
End If
|
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
|
'Dim dr As DataRow = DtDatos.NewRow
|
||||||
'nuevacuenta.Visible = False
|
'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()
|
LimpiarCampos()
|
||||||
updatos.Update()
|
updatos.Update()
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
|
|
||||||
Alert("La cuenta se guardo correctamente")
|
Alert("La cuenta se guardo correctamente")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjConta.Dispose()
|
ObjConta.Dispose()
|
||||||
ObjConta2.Dispose()
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub LimpiarCampos()
|
Private Sub LimpiarCampos()
|
||||||
TxtCuenta.Text = ""
|
TxtCuenta.Text = ""
|
||||||
@@ -469,7 +473,6 @@ Partial Class Contabilidad2_CatCuentas
|
|||||||
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click
|
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click
|
||||||
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||||||
Dim ObjConta As New ClsContabilidad
|
Dim ObjConta As New ClsContabilidad
|
||||||
Dim ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa)
|
|
||||||
'ObjConta.IniciaTransacSQL()
|
'ObjConta.IniciaTransacSQL()
|
||||||
|
|
||||||
If ObjConta.RemoveCuenta(IDSelected.ToEntero) Then
|
If ObjConta.RemoveCuenta(IDSelected.ToEntero) Then
|
||||||
@@ -492,21 +495,27 @@ Partial Class Contabilidad2_CatCuentas
|
|||||||
Alert("La Cuenta ha sido eliminada", TipoMensaje.MsgInformacion)
|
Alert("La Cuenta ha sido eliminada", TipoMensaje.MsgInformacion)
|
||||||
|
|
||||||
Dim codigo As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}")
|
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 UsuarioActual.Empresa.TipoContabilidad <> 1 Then
|
||||||
If ObjConta2.RemoveCuenta(Id) 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
|
||||||
End If
|
End If
|
||||||
|
ObjConta2.Dispose()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Alert("La Cuenta no pudo ser eliminada", TipoMensaje.MsgError)
|
Alert("La Cuenta no pudo ser eliminada", TipoMensaje.MsgError)
|
||||||
' ObjConta.RollBack()
|
' ObjConta.RollBack()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjConta.Dispose()
|
ObjConta.Dispose()
|
||||||
ObjConta2.Dispose()
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
'Protected Sub BtnCambiaAgrupadorSAT_Click(sender As Object, e As EventArgs)
|
'Protected Sub BtnCambiaAgrupadorSAT_Click(sender As Object, e As EventArgs)
|
||||||
|
|||||||
Reference in New Issue
Block a user