nuevo catalogo de la tabla Cuentas Asignaciones

This commit is contained in:
Antonio Gonzalez
2020-03-28 17:45:57 -07:00
parent bcbc2b5b71
commit d8a005fbe8
4 changed files with 370 additions and 0 deletions

View File

@@ -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" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Catálogo de Cuentas Asignación.
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server" ID="UpAgregar">
<ContentTemplate>
<li>
<asp:LinkButton runat="server" ID="BtnAgregarMotivoD" data-toggle="tooltip" data-placement="left" title="Agregar un Defecto" Text="<i class='fa fa-plus'></i>Agregar Motivo Baja"></asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel runat="server" ID="UpDatos" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView runat="server" ID="GvDatos" EmptyDataText="No se encontraron Motivo de Baja Registrados" ToolTip="Listado de Motivo de Baja" CssClass="table table-striped table-advance table-hover ScrollAD"
DataKeyNames="CveCuentaAsignacion,CveConceptoContable,CveCuenta,IdCuenta,CveProveedor,CveCliente,CvePersonal,CveClasificacion,CveAlmacen,PorcentajeIVA" AutoGenerateColumns="False"
Style="margin-top: -10px; text-align: center;width:100%" GridLines="None">
<Columns>
<asp:BoundField DataField="ConceptoContable" HeaderText="Concepto Contable" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="CuentaNombre" HeaderText="Nombre Cuenta" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="IdCuenta" HeaderText="Id Cuenta" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="ProveedorNombre" HeaderText="Nombre Proveedor" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="ClienteNombre" HeaderText="Nombre Cliente" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="PersonalNombre" HeaderText="Nombre Personal" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="Clasificacion" HeaderText="Clasificación" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="Almacen" HeaderText="Almacén" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="PorcentajeIVA" HeaderText="Porcentaje IVA" ItemStyle-HorizontalAlign="Left"/>
<asp:TemplateField ItemStyle-Width="99px">
<ItemTemplate>
<asp:LinkButton ID="ImgE" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="ActualizaModulo" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="83px">
<ItemTemplate>
<asp:LinkButton ID="ImgEE" runat="server" AlternateText="Eliminar" CausesValidation="False" OnClick="EliminarRow" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpModal">
<ContentTemplate>
<div id="ModalCat" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModalModulos" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
<asp:Literal ID="LtlTituloModalTiposD" runat="server">Cuentas Asignación</asp:Literal>
</h4>
</div>
<div class="modal-body" style="text-align:center">
<div class="row">
<div class="col-md-1" style="width:50%;text-align:left">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlCconceptosContables" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" AppendDataBoundItems="true" DataTextField="ConceptoContable" DataValueField="CveConceptoContable" Width="240px" ValidationGroup="GrpModulo"></asp:DropDownList>
<label for="<%= DdlCconceptosContables.ClientID.ToString()%>">Concepto Contable: </label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlCuenta" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" AppendDataBoundItems="true" DataTextField="Nombre" DataValueField="CveCuenta" Width="240px" ValidationGroup="GrpModulo"></asp:DropDownList>
<label for="<%= DdlCuenta.ClientID.ToString()%>">Concepto Contable: </label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtIdCuentaContable" CssClass="form-control " runat="server" MaxLength="50" CausesValidation="true" style="width:100%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVClave" runat="server" ControlToValidate="TxtIdCuentaContable" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>'¨IdCuentaContable''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModulo"></asp:RequiredFieldValidator>
<label for="<%= TxtIdCuentaContable.ClientID.ToString()%>">IdCuentaContable:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlProveedor" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" AppendDataBoundItems="true" DataTextField="RazonSocial" DataValueField="CveProveedor" Width="240px" ValidationGroup="GrpModulo"></asp:DropDownList>
<label for="<%= DdlProveedor.ClientID.ToString()%>">Proveedor: </label>
</div>
<div class="form-group form-md-line-input input-iconright">
<label for="<%= DdlClientes.ClientID.ToString()%>">Cliente: </label><br />
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="90%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
<div class="col-md-1" style="width:50%;text-align:left">
<div class="form-group form-md-line-input input-iconright">
<label for="<%= DdlPersonal.ClientID.ToString()%>">Personal: </label><br />
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlPersonal" Width="90%" data-metodo="getpersonal" runat="server" DataTextField="NombreCompleto" DataValueField="CvePersonal" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlClasificacion" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" AppendDataBoundItems="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="240px" ValidationGroup="GrpModulo"></asp:DropDownList>
<label for="<%= DdlClasificacion.ClientID.ToString()%>">Clasificación: </label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlAlmacen" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" AppendDataBoundItems="true" DataTextField="Almacen" DataValueField="CveAlmacen" Width="240px" ValidationGroup="GrpModulo"></asp:DropDownList>
<label for="<%= DdlAlmacen.ClientID.ToString()%>">Almacén: </label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPorcentajeIVA" CssClass="form-control " runat="server" MaxLength="50" CausesValidation="true" style="width:100%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtPorcentajeIVA" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>'¨PorcentajeIVA''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModulo"></asp:RequiredFieldValidator>
<label for="<%= TxtPorcentajeIVA.ClientID.ToString()%>">PorcentajeIVA:</label>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LbAgregar" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpModulo" />
<button id="BtnCancelarProyecto" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -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