From d8a005fbe8c19887ac5524ef799ebaed50334589 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Sat, 28 Mar 2020 17:45:57 -0700 Subject: [PATCH] nuevo catalogo de la tabla Cuentas Asignaciones --- App_Code/ClsContabilidad.vb | 98 +++++++++++++ App_Code/ClsPaginas.vb | 1 + Contabilidad2/CatCuentasAsignaciones.aspx | 124 ++++++++++++++++ Contabilidad2/CatCuentasAsignaciones.aspx.vb | 147 +++++++++++++++++++ 4 files changed, 370 insertions(+) create mode 100644 Contabilidad2/CatCuentasAsignaciones.aspx create mode 100644 Contabilidad2/CatCuentasAsignaciones.aspx.vb diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 316635b7c..7f31c7a9d 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5770,6 +5770,104 @@ Public Class ClsContabilidad Return Retorno End Function + Public Function GetCuentasAsignaciones(CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasAsignacionesGet") + + 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 asignación", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCuentasAsignaciones(Optional CveConceptoContable As Integer = -1, Optional CveCuenta As Integer = -1, Optional IdCtaContable As Integer = -1, + Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, + Optional CveClasificacion As Integer = -1, Optional CveAlmacen As Integer = -1, Optional PorcentajeIVA As Decimal = -1) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasAsignacionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al agregar la cuenta asignación", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveCuentasAsignaciones(CveCuentaAsignacion As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasAsignacionesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuentaAsignacion", SqlDbType.Int).Value = CveCuentaAsignacion + 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 UpdateCuentasAsignaciones(CveConceptoAsignacion As Integer, Optional CveConceptoContable As Integer = -1, Optional CveCuenta As Integer = -1, + Optional IdCtaContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, + Optional CvePersonal As Integer = -1, Optional CveClasificacion As Integer = -1, Optional CveAlmacen As Integer = -1, + Optional PorcentajeIVA As Decimal = -1) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasAsignacionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuentaAsignacion", SqlDbType.Int).Value = CveConceptoAsignacion + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al agregar la cuenta asignación", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + #Region " RECONSTRUCCION DE PREPOLIZAS " Public Function ReconstruirPP_PagoCompra(CvePrePoliza As Integer) As Boolean Dim Retorno = False diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 1189f9541..6c79fa996 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4067,6 +4067,7 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoSAT.aspx".ToUpper(), 618) PaginaDict.Add("/Contabilidad2/MovimientosConProveedores.aspx".ToUpper(), 619) PaginaDict.Add("/Contabilidad2/RepBalanceGeneral.aspx".ToUpper(), 530) + PaginaDict.Add("/Contabilidad2/CatCuentasAsignaciones.aspx".ToUpper(), 724) #End Region 'CONTRATOS #Region "Contratos" diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx b/Contabilidad2/CatCuentasAsignaciones.aspx new file mode 100644 index 000000000..8bd7dba81 --- /dev/null +++ b/Contabilidad2/CatCuentasAsignaciones.aspx @@ -0,0 +1,124 @@ +<%@ Page Title="Contabilidad2 - Catálogo Cuentas Asignación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatCuentasAsignaciones.aspx.vb" Inherits="Contabilidad2_CatCuentasAsignaciones" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Cuentas Asignación. + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx.vb b/Contabilidad2/CatCuentasAsignaciones.aspx.vb new file mode 100644 index 000000000..dab34ed30 --- /dev/null +++ b/Contabilidad2/CatCuentasAsignaciones.aspx.vb @@ -0,0 +1,147 @@ +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class Contabilidad2_CatCuentasAsignaciones + Inherits ClsPaginas + + Private Property CveConceptoAsignacion() As Integer 'Guardamos el ID de registro para saber cual registro Editar + Get + Return If(IsNothing(ViewState("CveConceptoAsignacion")), -1, CInt(ViewState("CveConceptoAsignacion"))) + End Get + Set + ViewState("CveConceptoAsignacion") = Value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + CargaDatos() + CargaDatosModal() + End If + End Sub + + Private Sub CargaDatos() + Dim ObjConta As New ClsContabilidad + If ObjConta.GetCuentasAsignaciones(UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjConta.DtResultados + End If + ObjConta.Dispose() + GvDatos.DataBind() + End Sub + + Private Sub CargaDatosModal() + Dim ObjConta As New ClsContabilidad + Dim ObjProveedores As New ClsCompProveedores + Dim ObjRH As New ClsRH + Dim ObjClasificaciones As New ClsClasificaciones + Dim ObjInv As New ClsInventarios + + If ObjConta.GetConta_ConceptosContables() Then + DdlCconceptosContables.DataSource = ObjConta.DtResultados + End If + + If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then + DdlCuenta.DataSource = ObjConta.DtResultados + End If + + If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + End If + + DdlClientes.setEsWebService(True) + + If ObjRH.GetPersonal(-1, UsuarioActual.CveEmpresa) Then + DdlPersonal.DataSource = ObjRH.DtResultados + End If + + If ObjClasificaciones.GetClasificaciones(CveEmpresa:=UsuarioActual.CveEmpresa) Then + DdlClasificacion.DataSource = ObjClasificaciones.DtResultados + End If + + If ObjInv.GetAlmacenes(-1, -1, UsuarioActual.CveEmpresa, -1) Then + DdlAlmacen.DataSource = ObjInv.DtResultados + End If + + ObjConta.Dispose() + ObjProveedores.Dispose() + ObjRH.Dispose() + ObjClasificaciones.Dispose() + ObjInv.Dispose() + + + DdlCconceptosContables.DataBind() + DdlCuenta.DataBind() + DdlProveedor.DataBind() + DdlPersonal.DataBind() + DdlClasificacion.DataBind() + DdlAlmacen.DataBind() + + DdlCconceptosContables.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlProveedor.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlClasificacion.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + + Protected Sub ActualizaModulo(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + CveConceptoAsignacion = GvRow.DataKey("CveCuentaAsignacion").ToEntero + DdlCconceptosContables.SelectedValue = GvRow.DataKey("CveConceptoContable").ToEntero + DdlCuenta.SelectedValue = GvRow.DataKey("CveCuenta").ToEntero + DdlProveedor.SelectedValue = GvRow.DataKey("CveProveedor").ToEntero + DdlClasificacion.SelectedValue = GvRow.DataKey("CveClasificacion").ToEntero + DdlAlmacen.SelectedValue = GvRow.DataKey("CveAlmacen").ToEntero + TxtIdCuentaContable.Text = GvRow.DataKey("IdCuenta") + TxtPorcentajeIVA.Text = GvRow.DataKey("PorcentajeIVA") + LbAgregar.Text = "Actualizar" + UpModalModulos.Update() + RegistraScript("$('#ModalCat').modal();") + End Sub + + Protected Sub EliminarRow(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ObjConta As New ClsContabilidad + If ObjConta.RemoveCuentasAsignaciones(GvRow.DataKey("CveCuentaAsignacion").ToEntero) Then + Alert("se elimino correctamente") + End If + ObjConta.Dispose() + End Sub + + Protected Sub BtnAgregarMotivoD_Click(sender As Object, e As EventArgs) Handles BtnAgregarMotivoD.Click + CveConceptoAsignacion = -1 + DdlCconceptosContables.SelectedValue = -1 + DdlCuenta.SelectedValue = -1 + DdlProveedor.SelectedValue = -1 + DdlClasificacion.SelectedValue = -1 + DdlAlmacen.SelectedValue = -1 + TxtIdCuentaContable.Text = "" + TxtPorcentajeIVA.Text = "" + LbAgregar.Text = "Agregar" + UpModalModulos.Update() + RegistraScript("$('#ModalCat').modal();") + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click + Dim ObjConta As New ClsContabilidad + Dim ErrorString As String = "" + If LbAgregar.Text = "Agregar" Then + If ObjConta.AddCuentasAsignaciones(DdlCconceptosContables.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero, + DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, + DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal) Then + ErrorString = "Error al Agregar" + End If + ElseIf LbAgregar.Text = "Actualizar" Then + If ObjConta.UpdateCuentasAsignaciones(CveConceptoAsignacion, DdlCconceptosContables.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero, + DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, + DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal) Then + ErrorString = "Error al Actualizar" + End If + End If + ObjConta.Dispose() + RegistraScript("$('#ModalCat').modal('hide');") + If ErrorString.Length > 0 Then + Alert(ErrorString) + End If + End Sub +End Class