From 5b0ebc5eb00b8bbf335c0d5c01086d0ae47de8a6 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 26 Jul 2021 15:08:40 -0700 Subject: [PATCH] Globales --- App_Code/ClsContabilidad.vb | 65 +++++++++++++++++ Contabilidad2/CatCuentasAsignaciones.aspx | 73 +++++++++++++++++++- Contabilidad2/CatCuentasAsignaciones.aspx.vb | 52 +++++++++++++- 3 files changed, 188 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 4556220f6..fbf0a6182 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5852,6 +5852,71 @@ Public Class ClsContabilidad Return Retorno End Function +#Region "Globales" + Public Function GetCuentasGlobales(CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasGlobalesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener el catálogo de cuentas globales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCuentasGlobales(CveConceptoContable As Integer, CveCuenta As Integer, TipoGlobal As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasGlobalesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@TipoGlobal", SqlDbType.Int).Value = TipoGlobal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el catálogo de cuentas asignación", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveCuentasGlobales(CveConceptoContable As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasGlobalesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el catálogo de globales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + +#End Region + Public Function GetContaEjercicio(CveEmpresa As Integer) As Boolean Dim Retorno = False diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx b/Contabilidad2/CatCuentasAsignaciones.aspx index e518412a9..ea32e31b3 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx +++ b/Contabilidad2/CatCuentasAsignaciones.aspx @@ -14,7 +14,10 @@
  • - + +
  • +
  • +
  • @@ -86,6 +89,27 @@ +
    + + + + + + + + + + + + + + + + + +
    @@ -171,6 +195,53 @@ + + + + + + + diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx.vb b/Contabilidad2/CatCuentasAsignaciones.aspx.vb index 2dcb413aa..526852767 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx.vb +++ b/Contabilidad2/CatCuentasAsignaciones.aspx.vb @@ -40,8 +40,14 @@ Partial Class Contabilidad2_CatCuentasAsignaciones If ObjConta.GetCuentasAsignacionesSistema(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjConta.DtResultados End If + + If ObjConta.GetCuentasGlobales(UsuarioActual.CveEmpresa) Then + GvGlobal.DataSource = ObjConta.DtResultados + End If + ObjConta.Dispose() GvDatos.DataBind() + GvGlobal.DataBind() UpDatos.Update() End Sub @@ -53,10 +59,12 @@ Partial Class Contabilidad2_CatCuentasAsignaciones If ObjConta.GetConta_ConceptosContables() Then DdlCconceptosContables.DataSource = ObjConta.DtResultados + DdlConceptoGlobal.DataSource = ObjConta.DtResultados.FiltraParametros("EsCuentaUnica = false AND EsSistema = True AND EsGlobal = True") End If If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then DdlCuenta.DataSource = ObjConta.DtResultados + DdlCuentaGlobal.DataSource = ObjConta.DtResultados End If ObjConta.Dispose() DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) @@ -79,7 +87,9 @@ Partial Class Contabilidad2_CatCuentasAsignaciones DdlCuentaBancaria.DataBind() DdlCconceptosContables.DataBind() + DdlConceptoGlobal.DataBind() DdlCuenta.DataBind() + DdlCuentaGlobal.DataBind() DdlProveedor.DataBind() 'DdlPersonal.DataBind() DdlClasificacion.DataBind() @@ -145,6 +155,11 @@ Partial Class Contabilidad2_CatCuentasAsignaciones End If End If + If Dr("AplicaImpuesto").ToString = "True" Then + divPorcentajeIVA.Visible = True + End If + + If Dr("AplicaClasificacion").ToString = "True" Then divClasificacion.Visible = True End If @@ -184,7 +199,24 @@ Partial Class Contabilidad2_CatCuentasAsignaciones ObjConta.Dispose() End Sub - Protected Sub BtnAgregarMotivoD_Click(sender As Object, e As EventArgs) Handles BtnAgregarMotivoD.Click + Protected Sub BtnAgregarGlobal_Click(sender As Object, e As EventArgs) Handles BtnAgregarGlobal.Click + + UppModalGlobal.Update() + RegistraScript("$('#ModalGlobal').modal();") + End Sub + + Protected Sub EliminarRowGlobal(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ObjConta As New ClsContabilidad + If ObjConta.RemoveCuentasGlobales(GvRow.DataKey("CveConceptoContable").ToEntero, GvRow.DataKey("CveEmpresa").ToEntero) Then + Alert("se elimino correctamente") + End If + CargaDatosSistema() + UpDatos.Update() + ObjConta.Dispose() + End Sub + + Protected Sub BtnAgregarAsignacion_Click(sender As Object, e As EventArgs) Handles BtnAgregarAsignacion.Click LimpiarDatos() LbAgregar.Text = "Agregar" @@ -238,4 +270,22 @@ Partial Class Contabilidad2_CatCuentasAsignaciones CargaDatosSistema() UpDatos.Update() End Sub + + Protected Sub LBAgregaGlobal_Click(sender As Object, e As EventArgs) + + Dim ErrorString As String = "" + Dim ObjConta As New ClsContabilidad + If Not ObjConta.AddCuentasGlobales(DdlConceptoGlobal.SelectedValue.ToEntero, DdlCuentaGlobal.SelectedValue.ToEntero, DdlTipoGlobal.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + ErrorString = "Error al agregar" + End If + ObjConta.Dispose() + + If ErrorString.Length > 0 Then + Alert(ErrorString) + Else + Alert("Agregado correctamente") + End If + CargaDatosSistema() + UpDatos.Update() + End Sub End Class