Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<%@ Page Title="Cargar Archivo" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CargarArchivo.aspx.vb" Inherits="CargarArchivo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="H" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" Runat="Server">
Carga de Archivos
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" Runat="Server">
<script language="javascript" type="">
function uploadComplete() {
debugger;
window.parent.MuestraAlerta("Información", "El Archivo se guardó correctamente.", "I", 1, "");
var tipo = $("#HdnTipo").value;
window.parent.CargarArchivo(tipo);
window.parent.tb_remove();
if (navigator.appName == "Microsoft Internet Explorer") {
window.parent.LnkUpload.focus();
}
}
function uploadError() {
alert("Ocurrió un error al intentar subir el archivo, por favor intentelo de nuevo.");
}
</script>
<asp:HiddenField ID="HdnTipo" runat="server" ClientIDMode="Static"/>
<table border="1" rules="all" style="border-collapse: collapse">
<tr>
<td align="left">Seleccione el archivo a guardar</td>
</tr>
<tr>
<td><ajax:AsyncFileUpload ID="AFU" runat="server" ClientIDMode="Static" OnClientUploadComplete="uploadComplete" OnClientUploadError="uploadError" Width="250px" UploaderStyle="Modern" UploadingBackColor="#CCFFFF" /></td>
</tr>
<tr>
<td align="left"><span style="text-decoration: underline"><b>NOTA:</b></span><br />La ventana se cerrará automáticamente cuando termine el proceso de carga.</td>
</tr>
</table>
</asp:Content>

View File

@@ -0,0 +1,34 @@
Imports System.IO
Partial Class CargarArchivo
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Session("FileUpload") = ""
CType(Me.Master, BaseMasterPage).EsPopup = True
CType(Me.Master, BaseMasterPage).PopupWidth = 350
If Request("Tipo") IsNot Nothing AndAlso Request("Tipo").Length > 0 Then
HdnTipo.Value = Request("Tipo")
End If
End If
End Sub
Protected Sub AFU_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete
If AFU.HasFile Then
If Not Directory.Exists(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp") Then
Directory.CreateDirectory(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp")
End If
Dim UploadFolder As String = Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\"
Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName)
If System.IO.File.Exists(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension) Then
System.IO.File.Delete(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
End If
AFU.SaveAs(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
Session("FileUpload") = UsuarioActual.CveUsuario.ToString & Extension
End If
End Sub
End Class

View File

@@ -0,0 +1,31 @@
Imports System.IO
Partial Class CargarImagen
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Session("FileUpload") = ""
CType(Me.Master, BaseMasterPage).EsPopup = True
CType(Me.Master, BaseMasterPage).PopupWidth = 350
RegistraScript("$get('tdContenido').style.height='100px'")
End If
End Sub
Protected Sub AFU_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete
If AFU.HasFile Then
If Not Directory.Exists(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp") Then
Directory.CreateDirectory(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp")
End If
Dim UploadFolder As String = Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\"
Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName)
If System.IO.File.Exists(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension) Then
System.IO.File.Delete(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
End If
AFU.SaveAs(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
Session("FileUpload") = UsuarioActual.CveUsuario.ToString & Extension
End If
End Sub
End Class

259
Planeacion/CatFolios.aspx Normal file
View File

@@ -0,0 +1,259 @@
<%@ Page Title="Catálogo de Folios" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatFolios.aspx.vb" Inherits="CatFolios" %>
<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:UpdatePanel runat="server" ID="UpAgregarFolio">
<ContentTemplate>
<li>
<asp:LinkButton ID="ImgAddFolio" runat="server" Visible="True" OnClick="BtnAgregarFolio_Click"> <i class="fa fa-pencil"></i> Agregar Folio</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Catálogo de Folios
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-body">
<%--<%--<%-- <%-- <table class="table table-striped" style="border: 1px solid #D3D3D3; min-width: 985px; width: 100%; display: none;">
<thead>
<tr class="Titulos">
<th width="100px">
<asp:LinkButton ID="LbSucursal" runat="server" CausesValidation="false" Text="" CommandArgument="Sucursal" OnClick="LbOrden_Click">
Sucursal
<asp:Literal ID="ImgSucursal" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="100px">
<asp:LinkButton ID="LbCentroCosto" runat="server" CausesValidation="false" Text="" CommandArgument="CentroCosto" OnClick="LbOrden_Click">
Centro de Costo
<asp:Literal ID="ImgCentroCosto" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="320px">
<asp:LinkButton ID="LbSerie" runat="server" CausesValidation="false" Text="" CommandArgument="Serie" OnClick="LbOrden_Click">
Serie
<asp:Literal ID="ImgSerie" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbTipoDocto" runat="server" CausesValidation="false" Text="" CommandArgument="Tipo Docto" OnClick="LbOrden_Click">
Tipo Docto
<asp:Literal ID="ImgTipoDocto" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<%-- <th width="120px">
<asp:LinkButton ID="LbAprobacion" runat="server" CausesValidation="false" Text="" CommandArgument="Aprobacion" OnClick="LbOrden_Click">
Aprobación
<asp:Literal ID="ImgAprobacion" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbFechaAprobacion" runat="server" CausesValidation="false" Text="" CommandArgument="Fecha Aprobación" OnClick="LbOrden_Click">
Fecha Aprobación
<asp:Literal ID="ImgFechaAprobación" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>--%>
<%--<th width="120px">
<asp:LinkButton ID="LbFolioInicial" runat="server" CausesValidation="false" Text="" CommandArgument="Folio Inicial" OnClick="LbOrden_Click">
Folio Inicial
<asp:Literal ID="ImgFolioInicial" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbFolioActual" runat="server" CausesValidation="false" Text="" CommandArgument="Folio Actual" OnClick="LbOrden_Click">
Folio Actual
<asp:Literal ID="ImgFolioActual" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbFolioFinal" runat="server" CausesValidation="false" Text="" CommandArgument="Folio Final" OnClick="LbOrden_Click">
Folio Final
<asp:Literal ID="ImgFolioFinal" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbEstatus" runat="server" CausesValidation="false" Text="" CommandArgument="Estatus" OnClick="LbOrden_Click">
Estatus
<asp:Literal ID="ImgEstatus" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbFecha" runat="server" CausesValidation="false" Text="" CommandArgument="Fecha" OnClick="LbOrden_Click">
Fecha
<asp:Literal ID="ImgFecha" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbUsuario" runat="server" CausesValidation="false" Text="" CommandArgument="Usuario" OnClick="LbOrden_Click">
Usuario
<asp:Literal ID="ImgUsuario" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
</tr>
</thead>
</table--%>
<div style="">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveFolio,FInicial,FActual,FFinal,Estado,TipoDocto,CveSubProyecto" EmptyDataText="No se encontraron Folios registrados" TShowHeader="true" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" GridLines="None">
<Columns>
<%-- <asp:BoundField DataField="Sucursal" HeaderText="Sucursal" />--%>
<asp:BoundField DataField="SubProyecto" HeaderText="Centro Costo" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="Serie" HeaderText="Serie" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="TipoDocto" HeaderText="Tipo Docto." ItemStyle-HorizontalAlign="Center"/>
<%-- <asp:BoundField DataField="Aprobacion" HeaderText="Aprobacion" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="FechaAprobacion" DataFormatString="{0:d}" HeaderText="Fecha Aprobación" ItemStyle-HorizontalAlign="Center"/>--%>
<asp:BoundField DataField="FInicial" HeaderText="Folio Inicial" ItemStyle-HorizontalAlign="Right"/>
<asp:BoundField DataField="FActual" HeaderText="Folio Actual" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="FFinal" HeaderText="Folio Final" ItemStyle-HorizontalAlign="Right"/>
<asp:BoundField DataField="Estado" HeaderText="Estatus" ItemStyle-HorizontalAlign="Center"/>
<asp:BoundField DataField="Fecha" DataFormatString="{0:d}" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center"/>
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-HorizontalAlign="Left"/>
<asp:TemplateField HeaderText="Editar" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center">
<EditItemTemplate>
<asp:LinkButton ID="imgU" runat="server" AlternateText="Actualizar" CausesValidation="True" CommandName="Update" CssClass="btn btn-circle btn-xs green" Text="<i class='fa fa-check'></i>" ValidationGroup="GrpGV" />
&nbsp;
<asp:LinkButton ID="imgC" runat="server" AlternateText="Cancelar" CausesValidation="False" CommandName="Cancel" CssClass="btn btn-circle btn-xs red" Text="<i class='fa fa-times'></i>" />
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="Edit_Click" CssClass="btn btn-circle btn-xs green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-xs 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>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivAgregarFolio" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpAddFolio" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:HiddenField ID="HdnModalidad" runat="server" Value="I" ClientIDMode="Static" />
<asp:HiddenField ID="HdnID" runat="server" Value="-1" ClientIDMode="Static" />
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Folio</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpBodyFolio" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<%--<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSucursal" CssClass="select2me form-control" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="Sucursal" DataValueField="CveSucursal" ValidationGroup="GrpObligatorio">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVSucurusal" runat="server" CssClass="help-block errorimput" ControlToValidate="DdlSucursal" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sucursal''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= DdlSucursal.ClientID.ToString()%>">Sucursal:</label>
</div>--%>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyecto" runat="server" Width="50%" CssClass="select2me form-control" AppendDataBoundItems="true" CausesValidation="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" ValidationGroup="GrpObligatorio"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVSubProyecto" runat="server" CssClass="help-block errorimput" ControlToValidate="DdlSubProyecto" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Centro de costo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= DdlSubProyecto.ClientID.ToString()%>">Centro Costo:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoDocto" Width="50%" CssClass="select2me form-control" runat="server" AppendDataBoundItems="true" CausesValidation="true" ValidationGroup="GrpObligatorio">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTipoDocto" runat="server" CssClass="help-block errorimput" ControlToValidate="DdlTipoDocto" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Docto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= DdlTipoDocto.ClientID.ToString()%>">Tipo Docto:</label>
</div>
<%-- <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtAprobacion" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVAprobacion" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtAprobacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Aprobación''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtAprobacion.ClientID.ToString()%>">Aprobación:</label>
</div>--%>
<%-- <div class="form-group form-md-line-input input-iconright">
<label for="<%= TxtFAprob.ClientID.ToString()%>">Fecha Aprobación:</label>
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 140px !important; padding: 0px;">
<asp:TextBox ID="TxtFAprob" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="TxtFAprob" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="TxtFAprob" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="TxtFAprob" Display="None" ErrorMessage="El campo <b>''Fecha Aprobación''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="TxtFAprob" Display="None" ErrorMessage="El campo <b>''Fecha Aprobación''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpObligatorio"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>--%>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtFolioInicial" runat="server" CausesValidation="true" MaxLength="8" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVFinicial" runat="server" CssClass="help-block errorimput miclase" ControlToValidate="TxtFolioInicial" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio Inicial''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFI_FI" runat="server" ControlToValidate="TxtFolioInicial" ControlToCompare="TxtFolioFinal" Display="None" ErrorMessage="El campo <b>''Folio Inicial''</b> No puede ser mayor que el Folio Final." Operator="LessThanEqual" Type="Integer" ValidationGroup="GrpObligatorio"></asp:CompareValidator>
<label for="<%= TxtFolioInicial.ClientID.ToString()%>">Folio Inicial:</label>
</div>
<div class="form-group form-md-line-input input-iconright" id="DivFactual" runat="server" visible="false">
<asp:TextBox ID="TxtFolioActual" runat="server" CausesValidation="true" MaxLength="8" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVFactual" runat="server" CssClass="help-block errorimput miclase" ControlToValidate="TxtFolioActual" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio Actual''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtFolioActual.ClientID.ToString()%>">Folio Actual:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtFolioFinal" runat="server" CausesValidation="true" MaxLength="8" ValidationGroup="GrpGuardar" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVFFinal" runat="server" CssClass="help-block errorimput miclase" ControlToValidate="TxtFolioFinal" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio Final''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtFolioFinal.ClientID.ToString()%>">Folio Final:</label>
</div>
<br />
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox ID="ChkEstatus" runat="server" CssClass="form-control" Checked="true" />
<label for="<%= ChkEstatus.ClientID.ToString()%>">Estatus:</label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="modal-footer">
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="BtnGuardar" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='material-icons'>done_all</i> Guardar</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script language="javascript" type="text/javascript">
function C() {
return confirm('¿Está seguro que desea eliminar el Folio?');
}
</script>
</asp:Content>

View File

@@ -0,0 +1,213 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports System.IO
Partial Class CatFolios
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Private Property CveFolio As Integer
Get
Return ViewState("CveFolio").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveFolio") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ViewState("Orden") = ""
Session("FileUpload") = ""
CargaSubProyectos()
CargaDdlTipoDocto()
CargaDatos()
End If
End Sub
#Region "C A R G A S"
Private Sub CargaDdlTipoDocto()
DdlTipoDocto.Items.Insert(0, New ListItem("Seleccione", "-1"))
If UsuarioActual.Empresa.CvePlataforma = 1 Then
DdlTipoDocto.Items.Insert(1, New ListItem("Facturas", "Ing"))
DdlTipoDocto.Items.Insert(2, New ListItem("Remisión", "Rem"))
DdlTipoDocto.Items.Insert(3, New ListItem("Notas de Crédito", "Egs"))
DdlTipoDocto.Items.Insert(4, New ListItem("Devoluciones", "Dev"))
DdlTipoDocto.Items.Insert(5, New ListItem("Cotización", "Cot"))
DdlTipoDocto.Items.Insert(6, New ListItem("Requisiciones", "Req"))
DdlTipoDocto.Items.Insert(7, New ListItem("Orden de Compra", "OC"))
DdlTipoDocto.Items.Insert(8, New ListItem("Orden de Servicio", "OS"))
DdlTipoDocto.Items.Insert(9, New ListItem("Nomina", "Nom"))
DdlTipoDocto.Items.Insert(10, New ListItem("Organización Interna", "OI"))
DdlTipoDocto.Items.Insert(11, New ListItem("Vale Gasolina", "VaG"))
DdlTipoDocto.Items.Insert(12, New ListItem("Resguardo AF", "AFR"))
DdlTipoDocto.Items.Insert(13, New ListItem("Traslado AF", "AFT"))
DdlTipoDocto.Items.Insert(14, New ListItem("Acarreo", "Aca"))
DdlTipoDocto.Items.Insert(15, New ListItem("Contratos", "Con"))
DdlTipoDocto.Items.Insert(16, New ListItem("Pedido", "Ped"))
DdlTipoDocto.Items.Insert(17, New ListItem("Devolución de Pedido", "DPe"))
DdlTipoDocto.Items.Insert(18, New ListItem("Pedido de Consignación", "PeC"))
DdlTipoDocto.Items.Insert(19, New ListItem("Órden de Producción", "OP"))
DdlTipoDocto.Items.Insert(20, New ListItem("Órden de Corte", "OCO"))
DdlTipoDocto.Items.Insert(21, New ListItem("Entrada de Materia Prima a Empaque", "EME"))
DdlTipoDocto.Items.Insert(22, New ListItem("Empaque", "EMP"))
DdlTipoDocto.Items.Insert(23, New ListItem("Solicitud de Traslado", "STr"))
DdlTipoDocto.Items.Insert(24, New ListItem("Complemento Pago", "CP"))
DdlTipoDocto.Items.Insert(24, New ListItem("Fletes", "FLE"))
DdlTipoDocto.Items.Insert(25, New ListItem("Activos Fijos", "AF"))
DdlTipoDocto.Items.Insert(26, New ListItem("Viaticos", "VIA"))
DdlTipoDocto.Items.Insert(27, New ListItem("Remanufactura", "RMF"))
DdlTipoDocto.Items.Insert(28, New ListItem("PedidoA", "PA"))
DdlTipoDocto.Items.Insert(29, New ListItem("Pedido2", "Pd2"))
DdlTipoDocto.Items.Insert(30, New ListItem("Proveedor/Acreedor", "Amb"))
DdlTipoDocto.Items.Insert(31, New ListItem("Proveedor", "Pro"))
DdlTipoDocto.Items.Insert(32, New ListItem("Acreedor", "Acr"))
DdlTipoDocto.Items.Insert(33, New ListItem("Productos/Servicios", "PS"))
ElseIf UsuarioActual.Empresa.CvePlataforma = 2 Then
DdlTipoDocto.Items.Insert(1, New ListItem("Facturas", "Ing"))
DdlTipoDocto.Items.Insert(2, New ListItem("Notas de Crédito", "Egs"))
DdlTipoDocto.Items.Insert(3, New ListItem("Cotización", "Cot"))
DdlTipoDocto.Items.Insert(4, New ListItem("Remisión", "Rem"))
DdlTipoDocto.Items.Insert(5, New ListItem("Orden de Compra", "OC"))
End If
DdlTipoDocto.DataBind()
End Sub
Private Sub CargaSubProyectos()
DdlSubProyecto.Items.Clear()
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Public Sub CargaDatos()
Dim ObjFolios As New ClsGralFolios
If ObjFolios.GetFolios() Then
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GlobalDTFolios = ObjFolios.DtResultados
GvDatos.DataSource = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GvDatos.DataBind()
Else
Me.GvDatos.DataSource = Nothing
End If
ObjFolios.Dispose()
End Sub
#End Region
Public Sub BtnAgregarFolio_Click(sender As Object, e As EventArgs)
CveFolio = -1
HdnModalidad.Value = "I"
ChkEstatus.Checked = True
TxtFolioInicial.Text = ""
TxtFolioFinal.Text = ""
TxtFolioActual.Text = ""
DivFactual.Visible = False
CargaSubProyectos()
BtnGuardar.Text = "Agregar"
UpAddFolio.Update()
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolio"))
End Sub
Public Sub Edit_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CveFolio = (GvRow.DataKey("CveFolio")).ToEntero
HdnModalidad.Value = "U"
DdlSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto"))
DdlTipoDocto.SelectedValueExist(GvRow.DataKey("TipoDocto"))
ChkEstatus.Checked = If(GvRow.DataKey("Estado").ToString = "Activo", True, False)
TxtFolioInicial.Text = (GvRow.DataKey("FInicial"))
TxtFolioFinal.Text = (GvRow.DataKey("FFinal"))
TxtFolioActual.Text = (GvRow.DataKey("FActual"))
DivFactual.Visible = True
BtnGuardar.Text = "Actualizar"
UpAddFolio.Update()
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolio"))
End Sub
#Region "GV"
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim ObjFolios As New ClsGralFolios
If ObjFolios.RemoveFolios(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
GvDatos.EditIndex = -1
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GlobalDTFolios = ObjFolios.DtResultados
Alert("La Aprobación de Folios se eliminó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjFolios.Dispose()
End Sub
#End Region
#Region "G U A R D A R "
Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
Dim ObjFolios As New ClsGralFolios
Dim TieneError = False
If HdnModalidad.Value = "I" Then
If Not ObjFolios.AddFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.Trim.ToEntero, TxtFolioInicial.Text.Trim.ToEntero,
TxtFolioFinal.Text.Trim.Trim.ToEntero, Session("FileUpload").ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
TieneError = True
End If
Else
If Not ObjFolios.UpdateFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.Trim.ToEntero, TxtFolioActual.Text.Trim.ToEntero, TxtFolioFinal.Text.Trim.ToEntero,
"", If(ChkEstatus.Checked, True, False), UsuarioActual.CveUsuario, CveFolio) Then
TieneError = True
End If
End If
If TieneError Then
Alert("Ocurrio un error al guardar/editar la nueva aprobación de Folios", TipoMensaje.MsgError)
Else
DdlTipoDocto.SelectedIndex = 0
TxtFolioInicial.Text = ""
TxtFolioActual.Text = ""
TxtFolioFinal.Text = ""
Session("FileUpload") = ""
Alert("La nueva Aprobación de Folios se guardó/editó correctamente.", TipoMensaje.MsgInformacion)
GlobalDTFolios = ObjFolios.DtResultados
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
CargaDatos()
UpDatos.Update()
UpAddFolio.Update()
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolio"))
End If
ObjFolios.Dispose()
End Sub
#End Region
End Class

View File

@@ -0,0 +1,107 @@
<%@ Page Title="SIG - Catálogo de Proyectos" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatProyectos.aspx.vb" Inherits="CatProyectos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="E" Runat="Server">
Gerencial - Catálogo de Proyectos
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<li>
<asp:LinkButton ID="HlAgregarProyecto" runat="server"><i class="fa fa-plus"></i> Agregar Proyecto</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" Runat="Server">
<script language="javascript" type="text/javascript">
function C() {
return confirm('¿Está seguro que desea eliminar el Proyecto?');
}
</script>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveProyecto, Proyecto" EmptyDataText="No se encontraron Proyecto" CssClass="table table-striped table-hover Widthall ScrollAD" data-sort="true" GridLines="None">
<Columns>
<asp:TemplateField ItemStyle-Width="300px" HeaderText="Proyecto">
<ItemTemplate>
&nbsp;<asp:Literal ID="LtlProyecto" runat="server" Text='<%# Eval("Proyecto", "{0}") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtProyecto" runat="server" CausesValidation="true" MaxLength="50" Text='<%# Eval("Proyecto")%>' ValidationGroup="GrpEditGuardar" Width="194px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVProyecto" runat="server" ControlToValidate="TxtProyecto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Proyecto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpEditGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOProyecto" runat="server" HighlightCssClass="vco" TargetControlID="RFVProyecto" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="100px" HeaderText="Estatus">
<ItemTemplate>
<asp:Literal ID="LtlEstado" runat="server" Text='<%# Eval("Estatus") %>' ></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="ChkEstado" runat="server" Checked='<%# If (Eval("Estatus").ToString = "Activo", True, False) %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="100px" HeaderText="Fecha">
<ItemTemplate>
<asp:Literal ID="LtlFechaIng" runat="server" Text='<%# Eval("FechaIng", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="100px" HeaderText="Usuario">
<ItemTemplate>
<asp:Literal ID="LtlUsuario" runat="server" Text='<%# Eval("Usuario") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Editar" ItemStyle-Width="100px">
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="ActualizaProyecto" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" 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="ModalProyectos" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModalCampaña" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
<asp:Literal ID="LtlTituloModal" runat="server">Agregar Proyecto</asp:Literal></h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtProyecto" CssClass="form-control " runat="server" MaxLength="50" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVProyecto" runat="server" ControlToValidate="TxtProyecto" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>'¨Proyecto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarRegistro"></asp:RequiredFieldValidator>
<label for="<%= TxtProyecto.ClientID.ToString()%>">Proyecto:</label>
</div>
<%-- <div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DDLSucursal" CssClass="form-control input-sm select2me js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="Sucursal" DataValueField="CveSucursal" Width="240px" ValidationGroup="GrpTema"></asp:DropDownList>
<label for="<%= DdlSucursal.ClientID.ToString()%>">Sucursal:</label>
</div>--%>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LbAgregar" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpGuardarRegistro" />
<button id="BtnCancelarProyecto" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
</div>
<asp:HiddenField ID="HdnModalidadProyecto" runat="server" Value="A" ClientIDMode="Static" />
<asp:HiddenField ID="HdnIDProyecto" runat="server" Value="-1" ClientIDMode="Static" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

View File

@@ -0,0 +1,313 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class CatProyectos
Inherits ClsPaginas
'Private Property DTSucursales As DataTable
' Get
' Return CType(ViewState("DTSucursales"), DataTable)
' End Get
' Set(value As DataTable)
' ViewState("DTSucursales") = value
' End Set
'End Property
'Private Property CveSucursal As Integer
' Get
' If ViewState("CveSucursal") Is Nothing Then
' Return -1
' Else
' Return ViewState("CveSucursal").ToString.ToEntero
' End If
' End Get
' Set(value As Integer)
' ViewState("CveSucursal") = value
' End Set
'End Property
Private Property CveProyecto As Integer
Get
If ViewState("CveProyecto") Is Nothing Then
Return -1
Else
Return ViewState("CveProyecto").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("CveProyecto") = value
End Set
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'ViewState("Orden") = ""
CargaDatos()
'CargaDDL()
'Permisos
'If UsuarioActual.TienePermisoProceso(39) Then LbAgregar.Enabled = True Else LbAgregar.Enabled = False
'Permiso Modificar
'If UsuarioActual.TienePermisoProceso(40) Then GvDatos.Columns(5).Visible = True Else GvDatos.Columns(5).Visible = False
'Permiso Eliminar
'If UsuarioActual.TienePermisoProceso(41) Then GvDatos.Columns(6).Visible = True Else GvDatos.Columns(6).Visible = False
End If
End Sub
Public Sub CargaDatos()
Dim ObjProyectos As New ClsProyectos
If ObjProyectos.GetProyectos(1) Then
Application("GlobalDTProyectos") = ObjProyectos.DtResultados
GvDatos.DataSource = ObjProyectos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GvDatos.DataBind()
End If
ObjProyectos.Dispose()
UpDatos.Update()
'se regeneran los subproyectos
'If UsuarioActual.Empresa.GralSoloProyecto Then CargaSuproyectos()
'If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString(), 0)
'Else
' CargaGrid("", 0)
'End If
End Sub
Private Sub RecargaGlobal()
Dim ObjProyectos As New ClsProyectos
If ObjProyectos.GetProyectos(1) Then
GlobalDTProyectos(-1) = ObjProyectos.DtResultados
End If
ObjProyectos.Dispose()
End Sub
Private Sub CargaSuproyectos()
Dim ObjSubProyectos As New ClsSubProyectos
If ObjSubProyectos.GetSubProyectos() Then
GlobalDTSubProyectos(-1) = ObjSubProyectos.DtResultados
End If
ObjSubProyectos.Dispose()
End Sub
Protected Sub LbAgregar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LbAgregar.Click
Dim ObjProyectos As New ClsProyectos
'Dim ObjSubproyectos As New ClsSubProyectos(ObjProyectos.IniciaTransacSQL())
Dim TieneError = False
If HdnModalidadProyecto.Value = "A" Then
'Agregamos Proyecto
If Not ObjProyectos.AddProyecto(TxtProyecto.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1) Then
TieneError = True
End If
'If CveProyecto > 0 Then
' ViewState("DTProyectos") = ObjProyectos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
' GlobalDTProyectos(-1) = ObjProyectos.DtResultados
' 'Centro de Costos
' 'If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then
' ' Obtenemos Sucursal Matriz
' ' Dim CveSucursalMatriz = -1
' ' If GlobalDTSucursales().FiltraParametros(String.Format("CveEmpresa = {0} AND Sucursal = 'MATRIZ'")).Rows.Count = 1 Then
' ' CveSucursalMatriz = GlobalDTSucursales().FiltraParametros(String.Format("CveEmpresa = {0} AND Sucursal = 'MATRIZ'")).Rows(0)("CveSucursal").ToString.ToEntero
' ' Else
' ' TieneError = True
' ' End If
' ' Agregamos SubProyecto
' ' If Not TieneError Then
' ' If Not ObjSubproyectos.AddSubProyecto(CveProyecto, TxtProyecto.Text.Trim, 0, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveSucursalMatriz) Then
' ' TieneError = True
' ' End If
' ' End If
' 'End If
'Else
' TieneError = True
'End If
'se regeneran los subproyectos
'If Not TieneError Then
' If UsuarioActual.Empresa.GralSoloProyecto Then
' If ObjSubproyectos.GetSubProyectos() Then
' GlobalDTSubProyectos(-1) = ObjSubproyectos.DtResultados
' Else
' TieneError = True
' End If
' End If
'End If
If TieneError = False Then
'ObjProyectos.Commit()
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalProyectos"))
Alert("El nuevo Proyecto se guardó correctamente.", TipoMensaje.MsgInformacion)
TxtProyecto.Text = ""
'TxtProyecto.Focus()
'DDLSucursal.SelectedValue = "-1"
CargaDatos()
'Else
' ObjProyectos.RollBack()
'If (ObjProyectos.GetProyectos()) Then
' Application("GlobalDTProyectos") = ObjProyectos.DtResultados.AsEnumerable
'End If
End If
ElseIf HdnModalidadProyecto.Value = "U" Then
'CveSucursal = DDLSucursal.SelectedValue.ToEntero
If ObjProyectos.UpdateProyecto(TxtProyecto.Text, True, UsuarioActual.CveUsuario, CveProyecto, -1) Then
'ViewState("DTProyectos") = ObjProyectos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
'GlobalDTProyectos(-1) = ObjProyectos.DtResultados
''se regeneran los subproyectos
'If UsuarioActual.Empresa.GralSoloProyecto Then CargaSuproyectos()
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalProyectos"))
Alert("El Proyecto se actualizo correctamente.", TipoMensaje.MsgInformacion)
TxtProyecto.Text = ""
'TxtProyecto.Focus()
'DDLSucursal.SelectedValue = "-1"
CargaDatos()
'If (ObjProyectos.GetProyectos()) Then
' Application("GlobalDTProyectos") = ObjProyectos.DtResultados
'End If
End If
End If
ObjProyectos.Dispose()
If Not TieneError Then
RecargaGlobal()
End If
End Sub
#Region "G V D A T O S"
Protected Sub GvDatos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex <= 1 Then
e.Row.Cells(0).Width = Unit.Pixel(240)
e.Row.Cells(1).Width = Unit.Pixel(75)
e.Row.Cells(2).Width = Unit.Pixel(75)
e.Row.Cells(3).Width = Unit.Pixel(100)
e.Row.Cells(4).Width = Unit.Pixel(60)
e.Row.Cells(5).Width = Unit.Pixel(60)
End If
If e.Row.RowState = DataControlRowState.Alternate OrElse e.Row.RowState = DataControlRowState.Normal Then
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
End If
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center
End If
'If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
' e.Row.FCDropDownList("DDLSucursalEdit").DataSource = DTSucursales
' e.Row.FCDropDownList("DDLSucursalEdit").DataBind()
' e.Row.FCDropDownList("DDLSucursalEdit").SelectedValue = e.Row.DataKey("CveSucursal")
'End If
End Sub
Protected Sub GvDatos_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GvDatos.RowEditing
GvDatos.EditIndex = e.NewEditIndex
End Sub
Protected Sub GvDatos_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
End Sub
Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim TieneError = False
Dim ObjProyectos As New ClsProyectos
If ObjProyectos.RemoveProyecto(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
GvDatos.EditIndex = -1
ViewState("DTProyectos") = ObjProyectos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("El Proyecto se elimino correctamente.", TipoMensaje.MsgInformacion)
CargaDatos()
If UsuarioActual.Empresa.GralSoloProyecto Then CargaSuproyectos()
Else
TieneError = True
End If
ObjProyectos.Dispose()
If Not TieneError Then
RecargaGlobal()
End If
End Sub
Protected Sub GvDatos_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit
GvDatos.EditIndex = -1
End Sub
#End Region
#Region "Ordenamiento"
Private Sub CargaGrid(ByVal Orden As String, gvi As Integer)
If Orden <> String.Empty Then
Dim DV As New DataView(CType(ViewState("DTProyectos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
GvDatos.DataSource = DV.ToTable()
DV.Dispose()
Else
GvDatos.DataSource = CType(ViewState("DTProyectos"), DataTable)
End If
GvDatos.DataBind()
UpDatos.Update()
End Sub
#End Region
'Public Sub CargaDDL()
' Dim Objeto As New ClsSucursales
' If Objeto.GetSucursales(UsuarioActual.CveEmpresa) Then
' DTSucursales = Objeto.DtResultados
' DDLSucursal.DataSource = DTSucursales
' DDLSucursal.DataBind()
' DDLSucursal.Items.Insert(0, New ListItem("Seleccione", "-1"))
' End If
' Objeto.Dispose()
'End Sub
Private Sub HlAgregarProyecto_Click(sender As Object, e As EventArgs) Handles HlAgregarProyecto.Click
TxtProyecto.Text = ""
'DDLSucursal.SelectedIndex = 0
LtlTituloModal.Text = "Agregar Proyecto"
LbAgregar.Text = "Agregar"
HdnModalidadProyecto.Value = "A"
UpModal.Update()
RegistraScript(String.Format("$('#{0}').modal();", "ModalProyectos"))
End Sub
Public Sub ActualizaProyecto(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CveProyecto = GvRow.DataKey("CveProyecto").ToString.ToString.ToEntero
'CveSucursal = GvRow.DataKey("CveSucursal").ToString.ToEntero
TxtProyecto.Text = GvRow.DataKey("Proyecto").ToString
'DDLSucursal.SelectedValue = CveSucursal
HdnModalidadProyecto.Value = "U"
LtlTituloModal.Text = "Actualizar Proyecto"
LbAgregar.Text = "Actualizar"
UpModal.Update()
RegistraScript(String.Format("$('#{0}').modal();", "ModalProyectos"))
End Sub
End Class

View File

@@ -0,0 +1,343 @@
<%@ Page Title="SIG - Catálogo de Proyectos" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatSubProyectos.aspx.vb" Inherits="CatSubProyectos" %>
<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">
<li>
<%--<asp:LinkButton ID="LnkUpload" runat="server" OnClientClick="showmodalcontent();">--%>
<div onclick="showmodalcontent();" style="cursor: pointer;"><i class="fa fa-upload"></i>Cargar archivo</div>
<%--</asp:LinkButton>--%>
</li>
<asp:UpdatePanel runat="server" ID="UpAgregarCentroCosto">
<ContentTemplate>
<li>
<asp:LinkButton ID="ImgAddCentroCosto" runat="server" Visible="True" OnClick="BtnAgregarCentroCosto_Click"> <i class="fa fa-pencil"></i> Agregar Centro de costo</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Catálogo de Centro de Costos
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<div id="hiddenModalContent" style="display: none;">
<center>
<div id="hiddencontenido">
<div style="width:100%; text-align:right;" >
<img src="../Imagenes/cerrarX.jpg" onclick="hiddenmodalcontent();" style="cursor: pointer; margin-right:-18px;margin-top:-18px; width:15px;height:15px;" />
</div>
<div style="border-bottom:1px solid #808080; text-align:center;margin-top:-30px;margin-left :-20px;margin-right:-20px; margin-bottom:20px; ">
<h3>Carga de Archivos</h3>
</div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="UpExcel" runat="server" Text="Cargar" CssClass="btn btn-default" />
</div>
</center>
<div id="hiddenback"></div>
</div>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-body">
<table class="table table-striped" style="border: 1px solid #D3D3D3; min-width: 985px; width: 100%; display: none;">
<thead>
<tr class="Titulos">
<th width="100px">
<asp:LinkButton ID="LbCentroCosto" runat="server" CausesValidation="false" Text="" CommandArgument="CentroCosto" OnClick="LbOrden_Click">
Codigo
<asp:Literal ID="ImgCentroCosto" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="320px">
<asp:LinkButton ID="LbEstatus" runat="server" CausesValidation="false" Text="" CommandArgument="Estatus" OnClick="LbOrden_Click">
Nombre
<asp:Literal ID="ImgEstatus" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbFecha" runat="server" CausesValidation="false" Text="" CommandArgument="Fecha" OnClick="LbOrden_Click">
RFC
<asp:Literal ID="ImgFecha" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
<th width="120px">
<asp:LinkButton ID="LbUsuario" runat="server" CausesValidation="false" Text="" CommandArgument="Sucursal" OnClick="LbOrden_Click">
Sucursal
<asp:Literal ID="ImgUsuario" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</asp:LinkButton>
</th>
</tr>
</thead>
</table>
<div style="">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveSubProyecto,SubProyecto,IdSegNeg,Estatus,Serie,IVA,Calle,NoExt,NoInt,Colonia,Localidad,Municipio,Estado,Pais,CP,CveProyecto,TipoSucursal,EsSucursal,
CvePais,CveEstado,CveMunicipio,CveColonia,AplicaComercioExterior,CvePrecioLista,Correo,Telefono"
EmptyDataText="No se encontraron SubProyectos" ShowHeader="true" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" GridLines="None">
<Columns>
<asp:BoundField DataField="SubProyecto" HeaderText="Centro de costo" />
<asp:BoundField DataField="SegNeg" HeaderText="Segmento de negocio" Visible="false" />
<%-- <asp:BoundField DataField="Sucursal" DataFormatString="0:####" HeaderText="Sucursal" />--%>
<asp:BoundField DataField="UsuarioNomina" HeaderText="UsuarioNomina" />
<asp:BoundField DataField="Proyecto" HeaderText="Proyecto" />
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
<asp:BoundField DataField="FechaIng" DataFormatString="{0:d}" HeaderText="Fecha" />
<asp:BoundField DataField="Usuario" HeaderText="Usuario" />
<asp:TemplateField HeaderText="Descargar" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="downExcel" runat="server" CssClass="btn btn-circle btn-sm" BackColor="#006600" Style="padding: 4px 5px 5px 8px;" Text="<i class='fa fa-ad-excel' style='padding:0px;'></i>" OnClick="downExcel_Click"> <%--Text='<img src="../Imagenes/IconoExcel.gif" />'--%>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Editar" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center">
<EditItemTemplate>
<asp:LinkButton ID="imgU" runat="server" AlternateText="Actualizar" CausesValidation="True" CommandName="Update" CssClass="btn btn-circle btn-xs green" Text="<i class='fa fa-check'></i>" ValidationGroup="GrpGV" />
&nbsp;
<asp:LinkButton ID="imgC" runat="server" AlternateText="Cancelar" CausesValidation="False" CommandName="Cancel" CssClass="btn btn-circle btn-xs red" Text="<i class='fa fa-times'></i>" />
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="Edit_Click" CssClass="btn btn-circle btn-xs green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-xs 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>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivAgregarCentroCosto" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpAddCentroEstatus" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:HiddenField ID="HdnModalidad" runat="server" Value="I" ClientIDMode="Static" />
<asp:HiddenField ID="HdnID" runat="server" Value="-1" ClientIDMode="Static" />
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Centro de costo</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpBodyCentroCosto" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<ajax:TabContainer ID="Tab" runat="server" ActiveTabIndex="0" Width="100%" CssClass="tabBodyOverride">
<ajax:TabPanel ID="TabDatosGenerales" runat="server" HeaderText="Datos Generales">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCentroCosto" runat="server" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVCentroCosto" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtCentroCosto" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Centro de costo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtCentroCosto.ClientID.ToString()%>">Centro de costo:</label>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server">
<asp:DropDownList ID="DdlProyecto" runat="server" DataTextField="Proyecto" DataValueField="CveProyecto" CssClass="form-control select2me" Width="100%">
</asp:DropDownList>
<label for="<%= DdlProyecto.ClientID.ToString()%>">Proyecto:</label>
</div>
<div class="form-group form-md-line-input input-iconright" id="DivSegmentoNegocio" runat="server" visible="false">
<asp:DropDownList ID="DdlSegmentoNegocio" runat="server" DataTextField="Nombre" DataValueField="Id" CssClass="form-control select2me" Width="100%">
</asp:DropDownList>
<label for="<%= DdlSegmentoNegocio.ClientID.ToString()%>">Segmento Negocio:</label>
</div>
<br />
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox ID="ChkEsSucursal" AutoPostBack="true" runat="server" CssClass="form-control" Checked="false" />
<label for="<%= ChkEsSucursal.ClientID.ToString()%>">¿Es Sucursal?</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox ID="ChkEstatus" runat="server" CssClass="form-control" Checked="true" />
<label for="<%= ChkEstatus.ClientID.ToString()%>">Estatus:</label>
</div>
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox ID="ChkAplicaComercioExterior" AutoPostBack="true" OnCheckedChanged="ChkAplicaComercioExterior_CheckedChanged" runat="server" CssClass="form-control" Checked="false" />
<label for="<%= ChkAplicaComercioExterior.ClientID.ToString()%>">¿Aplica Comercio Exterior?</label>
</div>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabDatosFiscales" runat="server" HeaderText="Datos Fiscales">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtSerie" runat="server" CssClass="form-control" MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVSerie" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtSerie" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Serie''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtSerie.ClientID.ToString()%>">Serie:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtIVA" runat="server" CssClass="form-control" MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVIVA" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtIVA" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''IVA''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtIVA.ClientID.ToString()%>">IVA:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCalle" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVCalle" runat="server" CssClass="help-block errorimput miclase" ControlToValidate="TxtCalle" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Calle''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio" Enabled="false"></asp:RequiredFieldValidator>
<label for="<%= TxtCalle.ClientID.ToString()%>">Calle:</label>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtNoExt" runat="server" CssClass="form-control" MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVNoExt" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtNoExt" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''No Ext''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtNoExt.ClientID.ToString()%>">No Ext:</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtNoInt" runat="server" CssClass="form-control" MaxLength="10"></asp:TextBox>
<%--<asp:RequiredFieldValidator ID="RFVNoInt" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtNoInt" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''No Int''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio" ></asp:RequiredFieldValidator> --%>
<label for="<%= TxtNoInt.ClientID.ToString()%>">No Int:</label>
</div>
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtColonia" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVColonia" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtColonia" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Colonia''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtColonia.ClientID.ToString()%>">Colonia:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtLocalidad" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVLocalidad" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtLocalidad" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Localidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtLocalidad.ClientID.ToString()%>">Localidad:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtMunicipio" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVMunicipio" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtMunicipio" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Municipio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtMunicipio.ClientID.ToString()%>">Municipio:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtEstado" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVEstado" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtEstado" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Estado''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtEstado.ClientID.ToString()%>">Estado:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPais" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVPais" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtPais" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Pais''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtPais.ClientID.ToString()%>">Pais:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCP" runat="server" CssClass="form-control" MaxLength="5"></asp:TextBox>
<asp:RequiredFieldValidator Visible="false" ID="RFVCP" runat="server" Enabled="false" CssClass="help-block errorimput miclase" ControlToValidate="TxtCP" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''CP''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<label for="<%= TxtCP.ClientID.ToString()%>">CP:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtTelefono" runat="server" CssClass="form-control" MaxLength="10"></asp:TextBox>
<label for="<%= TxtTelefono.ClientID.ToString()%>">Telefono:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCorreo" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<label for="<%= TxtCorreo.ClientID.ToString()%>">Correo:</label>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server">
<asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" DataTextField="PrecioLista" DataValueField="CvePrecioLista" CssClass="form-control select2me" Width="100%"></asp:DropDownList>
<label for="<%= DdlPrecioLista.ClientID.ToString()%>">Lista de Precio:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox ID="ChkEsMatriz" runat="server" CssClass="form-control" />
<label for="<%= ChkEsMatriz.ClientID.ToString()%>">¿Es matríz?</label>
</div>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabComercioExterior" Visible="false" runat="server" HeaderText="Comercio Exterior">
<ContentTemplate>
<div class="row">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlPais" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="DdlPais_SelectedIndexChanged" runat="server" DataTextField="ClaveSATPaisDescripcion" DataValueField="CvePais" CssClass="form-control select2me" Width="50%">
</asp:DropDownList>
<label for="<%= DdlPais.ClientID.ToString()%>">Pais:</label>
</div>
</div>
<div class="row">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlEstado" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="DdlEstado_SelectedIndexChanged" runat="server" DataTextField="ClaveSATEstadoNombreEstado" DataValueField="CveEstado" CssClass="form-control select2me" Width="50%">
</asp:DropDownList>
<label for="<%= DdlEstado.ClientID.ToString()%>">Estado:</label>
</div>
</div>
<div class="row">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlMunicipio" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="DdlMunicipio_SelectedIndexChanged" runat="server" DataTextField="ClaveSATMunicipioDescripcion" DataValueField="CveMunicipio" CssClass="form-control select2me" Width="50%">
</asp:DropDownList>
<label for="<%= DdlMunicipio.ClientID.ToString()%>">Municipio:</label>
</div>
</div>
<div class="row">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlColonia" runat="server" AppendDataBoundItems="true" DataTextField="ClaveSATColoniaNombreAsentamiento" DataValueField="CveColonia" CssClass="form-control select2me" Width="50%">
</asp:DropDownList>
<label for="<%= DdlColonia.ClientID.ToString()%>">Colonia:</label>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
<div class="modal-footer">
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="BtnGuardar" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='material-icons'>done_all</i> Guardar</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script language="javascript" type="text/javascript">
function C() {
return confirm('¿Está seguro que desea eliminar el SubProyecto?');
}
function showmodalcontent() {
document.getElementById("hiddenModalContent").style.display = "block";
}
function hiddenmodalcontent() {
document.getElementById("hiddenModalContent").style.display = "none";
}
</script>
</asp:Content>

View File

@@ -0,0 +1,807 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports System.IO
Imports System.Data.OleDb
Partial Class CatSubProyectos
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Public Property DtSegmentosNegocio As Data.DataTable
Get
Return CType((ViewState("DtSegmentosNegocio")), Data.DataTable)
End Get
Set(value As Data.DataTable)
ViewState("DtSegmentosNegocio") = value
End Set
End Property
Public Property DTSubProyectos As Data.DataTable
Get
Return CType((ViewState("DTSubProyectos")), Data.DataTable)
End Get
Set(value As Data.DataTable)
ViewState("DTSubProyectos") = value
End Set
End Property
Private Property CveCentroCosto As Integer
Get
Return ViewState("CveCentroCosto").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveCentroCosto") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ViewState("Orden") = ""
If Not UsuarioActual.Empresa.UsaRH Then
GvDatos.Columns(2).Visible = False
End If
Dim objsubproyecto As New ClsSubProyectos
'If objsubproyecto.GetSubProyectosexcel(9, UsuarioActual.CveEmpresa) Then
' 'DatatableToExcel(objsubproyecto.DtResultados)
' objsubproyecto.DtResultados.ExportToExcel("subproyecto")
'End If
objsubproyecto.Dispose()
If Not UsuarioActual.Empresa.Tipo_CentroCosto = 3 Then
'GvDatos.Columns(0).Visible = False
'TdTituloProyecto.Visible = False
'TdProyecto.Visible = False
'LbSubProyecto.Text = "Proyecto"
GvDatos.Columns(2).Visible = False
End If
CargaProyecto()
CargaSegmentosNegocio()
'COMERCIO EXTERIOR
CargaPais()
CargaEstado()
CargaMunicipio()
CargaColonia()
CargaPrecioLista()
CargaDatos()
If UsuarioActual.Empresa.UsaContabilidad Then
GvDatos.Columns(1).Visible = True
DivSegmentoNegocio.Visible = True
End If
BtnGuardar.OnClientClick = $"ValidaGuardar();"
End If
End Sub
Private Sub RecargaGlobal()
Dim ObjSubProyectos As New ClsSubProyectos
If ObjSubProyectos.GetSubProyectos() Then
GlobalDTSubProyectos(-1) = ObjSubProyectos.DtResultados
End If
ObjSubProyectos.Dispose()
End Sub
#Region "O R D E N A M I E N T O"
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = ""
Dim Campo As String = ""
Dim Literal As Literal = Nothing
Const OrdenInicial As String = ""
Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
Campo = Arg(0)
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
ViewState("Orden") = Orden
CargaDatos()
End Sub
#End Region
#Region "C A R G A S"
Public Sub CargaDatos()
Dim ObjSub As New ClsSubProyectos
If ObjSub.GetSubProyectos() Then
GvDatos.DataSource = ObjSub.DtResultados.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
GvDatos.DataBind()
End If
ObjSub.Dispose()
UpDatos.Update()
End Sub
Private Sub CargaProyecto()
DdlProyecto.DataSource = GlobalDTProyectos(UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveProyecto", "Proyecto"})
DdlProyecto.DataBind()
End Sub
Private Sub CargaPrecioLista()
DdlPrecioLista.DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa)
DdlPrecioLista.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlPrecioLista.DataBind()
End Sub
Private Sub CargaSegmentosNegocio()
DdlSegmentoNegocio.Items.Clear()
Dim Cuenta As New ClsContPAQi(UsuarioActual.Empresa)
If Cuenta.GetSegmentosNegocio(-1, "-1") Then
DtSegmentosNegocio = Cuenta.DtResultados.FiltraParametros("Id > 0")
DtSegmentosNegocio.Rows.Add(New Object() {0, 0, " - ", "", ""})
Dim dataView As New DataView(DtSegmentosNegocio)
dataView.Sort = "Id ASC"
DtSegmentosNegocio = dataView.ToTable
End If
Cuenta.Dispose()
DdlSegmentoNegocio.DataSource = DtSegmentosNegocio : DdlSegmentoNegocio.DataBind()
DdlSegmentoNegocio.Items.Insert(0, New ListItem("-", "-1"))
For Each Gvr As GridViewRow In GvDatos.Rows
'If Gvr.DataKey("IdSegNeg").ToEntero > 0 Then
' 'COMENTADO PORQUE TRUENA | IPP - 17 AGOSTO 2017
' 'Dim Cuenta2 As New ClsContPAQi(UsuarioActual.Empresa)
' 'If Cuenta2.GetSegmentosNegocio(Gvr.DataKey("IdSegNeg").ToEntero, "-1") Then
' ' Dim DRES2 As DataRow
' ' DRES2 = Cuenta2.DtResultados(0)
' ' Gvr.Cells(1).Text = DRES2("Nombre").ToString
' 'Else
' ' Gvr.Cells(1).Text = "-"
' 'End If
' 'Cuenta2.Dispose()
' 'If DtSegmentosNegocio IsNot Nothing AndAlso DtSegmentosNegocio.Rows.Count > 0 Then
' ' Dim dr As DataRow
' ' dr = DtSegmentosNegocio.FiltroPrimero(String.Format("Id ={0}", Gvr.DataKey("IdSegNeg")))
' ' Gvr.Cells(1).Text = dr("Nombre").ToString
' 'End If
'Else
' Gvr.Cells(1).Text = "0"
'End If
Next
End Sub
#End Region
#Region "GV"
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("downExcel"))
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
If e.Row.RowIndex > 0 AndAlso e.Row.Cells(1).Visible Then
e.Row.Cells(1).Text = DtSegmentosNegocio.FiltroPrimeroValor("Nombre", $"Id = {e.Row.DataKey("IdSegNeg")}")
End If
End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim ObjSubProyectos As New ClsSubProyectos
If ObjSubProyectos.RemoveSubProyecto(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
GvDatos.EditIndex = -1
ViewState("DTSubProyectos") = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GlobalDTSubProyectos(-1) = ObjSubProyectos.DtResultados
Alert("El SubProyecto se eliminó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjSubProyectos.Dispose()
CargaDatos()
End Sub
Protected Sub GvDatos_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)
If (e.CommandName = "AgregarSubProyecto") Then
Dim ObjContpaQ As New ClsContPAQi(UsuarioActual.Empresa)
ObjContpaQ.IniciaTransacSQL()
Dim ObjSubProyectos As New ClsSubProyectos
ObjSubProyectos.IniciaTransacSQL()
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = GvDatos.Rows(index)
Dim SubProyecto = GvDatos.Rows(index).DataKey("SubProyecto").ToString
Dim CveSegmento As Integer = ObjContpaQ.AddSegmentosNegocio(SubProyecto)
Dim CveSubProyecto As Integer = GvDatos.DataKeys(index).Value.ToString.ToEntero
Dim ErrorSubProyecto As Boolean = False
If ObjSubProyectos.UpdateSubProyectoSegNeg(CveSubProyecto, CveSegmento, UsuarioActual.CveEmpresa) Then
GvDatos.EditIndex = -1
ViewState("DTSubProyectos") = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GlobalDTSubProyectos(-1) = ObjSubProyectos.DtResultados
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
Else
ErrorSubProyecto = True
End If
If CveSegmento > 0 AndAlso Not ErrorSubProyecto Then
ObjContpaQ.Commit()
ObjSubProyectos.Commit()
If ObjContpaQ.GetSegmentosNegocio(-1, "-1") Then
DtSegmentosNegocio = ObjContpaQ.DtResultados.FiltraParametros("Id > 1")
End If
CargaDatos()
Else
ObjContpaQ.RollBack()
ObjSubProyectos.RollBack()
End If
ObjSubProyectos.Dispose()
ObjContpaQ.Dispose()
End If
End Sub
Public Sub Edit_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CveCentroCosto = (GvRow.DataKey("CveSubProyecto")).ToEntero
HdnModalidad.Value = "U"
TxtCentroCosto.Text = (GvRow.DataKey("SubProyecto"))
DdlSegmentoNegocio.SelectedValueExist(GvRow.DataKey("IdSegNeg"))
ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString = "Activo", True, False)
DdlProyecto.SelectedValueExist(GvRow.DataKey("CveProyecto"))
TxtSerie.Text = (GvRow.DataKey("Serie"))
TxtIVA.Text = (GvRow.DataKey("IVA"))
TxtCalle.Text = (GvRow.DataKey("Calle"))
TxtNoExt.Text = (GvRow.DataKey("NoExt"))
TxtNoInt.Text = (GvRow.DataKey("NoInt"))
TxtColonia.Text = (GvRow.DataKey("Colonia"))
TxtLocalidad.Text = (GvRow.DataKey("Localidad"))
TxtMunicipio.Text = (GvRow.DataKey("Municipio"))
TxtEstado.Text = (GvRow.DataKey("Estado"))
TxtPais.Text = (GvRow.DataKey("Pais"))
TxtCP.Text = (GvRow.DataKey("CP"))
ChkEsMatriz.Checked = If(GvRow.DataKey("TipoSucursal").ToString.ToEntero = 1, True, False)
ChkEsSucursal.Checked = If(GvRow.DataKey("EsSucursal").ToString.ToEntero = 1, True, False)
DdlPrecioLista.SelectedIndex = 0
DdlPrecioLista.SelectedValueExist(GvRow.DataKey("CvePrecioLista"))
TxtCorreo.Text = (GvRow.DataKey("Correo"))
TxtTelefono.Text = (GvRow.DataKey("Telefono"))
'COMERCIO EXTERIOR
ChkAplicaComercioExterior.Checked = If(GvRow.DataKey("AplicaComercioExterior").ToString = "True", True, False)
DdlPais.SelectedValueExist(GvRow.DataKey("CvePais"))
CargaEstado()
DdlEstado.SelectedValueExist(GvRow.DataKey("CveEstado"))
CargaMunicipio()
DdlMunicipio.SelectedValueExist(GvRow.DataKey("CveMunicipio"))
CargaColonia()
DdlColonia.SelectedValueExist(GvRow.DataKey("CveColonia"))
AplicaComercio()
BtnGuardar.Text = "Actualizar"
CargaRequired()
UpAddCentroEstatus.Update()
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCentroCosto"))
End Sub
#End Region
#Region "G U A R D A R"
Private Function ValidaComercioExterior() As Boolean
If ChkAplicaComercioExterior.Checked Then
If Not DdlPais.SelectedValue.ToEntero > 0 Then
Alert("Tiene que seleccionar un pais para comercio exterior.", TipoMensaje.MsgAdvertencia)
Return False
End If
If Not DdlPais.SelectedValue.ToEntero > 0 Then
Alert("Tiene que seleccionar un pais para comercio exterior.", TipoMensaje.MsgAdvertencia)
Return False
End If
If Not DdlEstado.SelectedValue.ToEntero > 0 Then
Alert("Tiene que seleccionar un estado para comercio exterior.", TipoMensaje.MsgAdvertencia)
Return False
End If
If DdlPais.SelectedValue.ToEntero = 151 Then
If Not DdlMunicipio.SelectedValue.ToEntero > 0 Then
Alert("Tiene que seleccionar un municipio para comercio exterior si el pais es mexico.", TipoMensaje.MsgAdvertencia)
Return False
End If
If Not DdlColonia.SelectedValue.ToEntero > 0 Then
Alert("Tiene que seleccionar una colonia para comercio exterior si el pais es mexico.", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
End If
Return True
End Function
Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
If Not ValidaComercioExterior() Then
Exit Sub
End If
CreaProyectoSubProyectoSucursal()
End Sub
Private Sub CreaProyectoSubProyectoSucursal()
Dim ObjSubproyectos As New ClsSubProyectos
Dim CveUsuarioNomina As Integer = Nothing
Dim CveSubProyecto = -1
Dim TieneError = False
Dim TipoSucursal As Integer
Dim EsSucursal As Integer
If ChkEsMatriz.Checked = True Then TipoSucursal = 1 Else TipoSucursal = 0
If ChkEsSucursal.Checked = True Then EsSucursal = 1 Else EsSucursal = 0
'GlobalDTProyectos(-1) = ObjSubproyectos.DtResultados
ObjSubproyectos.IniciaTransacSQL()
Dim IdSeg As Integer
If DdlSegmentoNegocio.Visible = True Then IdSeg = DdlSegmentoNegocio.SelectedValue.ToEntero Else IdSeg = 0
'CREA SUBPROYECTO
If HdnModalidad.Value = "I" Then
If Not ObjSubproyectos.AddCentroCosto(TxtCentroCosto.Text.Trim, IdSeg, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim,
NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal,
CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero,
Telefono:=TxtTelefono.Text) Then
TieneError = True
Else
CveSubProyecto = ObjSubproyectos.CveSubProyecto
End If
Else
If Not ObjSubproyectos.UpdateCentroCosto(CveCentroCosto, TxtCentroCosto.Text.Trim, IdSeg, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim,
NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal,
CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero,
Telefono:=TxtTelefono.Text) Then
TieneError = True
End If
End If
If Not TieneError Then
ObjSubproyectos.Commit()
If HdnModalidad.Value = "I" Then
Alert("La nueva Sucursal se guardó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("La Sucursal se actualizo correctamente.", TipoMensaje.MsgInformacion)
End If
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarCentroCosto"))
CargaDatos()
RecargaGlobal()
Else
ObjSubproyectos.RollBack()
End If
'se regeneran los subproyectos
'If Not TieneError Then
' If UsuarioActual.Empresa.GralSoloProyecto Then
' If ObjSubproyectos.GetSubProyectos() Then
' GlobalDTSubProyectos(-1) = ObjSubproyectos.DtResultados
' UpDatos.Update()
' Else
' TieneError = True
' End If
' End If
'End If
If DdlSegmentoNegocio.Visible = True Then
CargaSegmentosNegocio()
End If
ObjSubproyectos.Dispose()
If HdnModalidad.Value = "I" Then
If UsuarioActual.Empresa.Funcionalidad(523) <> "" Then
Dim ObjOC As New ClsOC
ObjOC.IniciaTransacSQL()
Dim CveUsuario As Integer
Dim CveEstatus As Integer
Dim ArregloUsuarios As String() = UsuarioActual.Empresa.Funcionalidad(523).ToString.Split(","c)
Dim YaExiste As Boolean = False
Dim DTEstatus As DataTable = GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros("TipoTermino IN (1, 2)")
For Each item In ArregloUsuarios
CveUsuario = item.ToString.ToEntero
For Each row As DataRow In DTEstatus.Rows
CveEstatus = row("CveEstatus").ToString.ToEntero
If Not ObjOC.AddEstatusUsuarios(CveEstatus, CveSubProyecto, CveUsuario, True, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
YaExiste = True
End If
Next
Next
If YaExiste Then
ObjOC.RollBack()
Else
ObjOC.Commit()
End If
ObjOC.Dispose()
End If
End If
End Sub
#End Region
#Region "E X C E L"
Protected Sub downExcel_Click(sender As Object, e As EventArgs)
Dim Gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
'TxtApellidoPaterno.Text = Gvr.DataKey("APaterno")
Dim subproyecto As Integer
Try
subproyecto = Gvr.DataKey("CveSubProyecto").ToEntero
Catch ex As Exception
subproyecto = 0
End Try
If subproyecto > 0 Then
Dim objsubproyecto As New ClsSubProyectos
If objsubproyecto.GetSubProyectosexcel(subproyecto, UsuarioActual.CveEmpresa) Then
'DatatableToExcel(objsubproyecto.DtResultados)
objsubproyecto.DtResultados.ExportToExcel("subproyecto")
End If
objsubproyecto.Dispose()
End If
End Sub
Protected Sub UpExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UpExcel.Click
If (FileUpload1.HasFile AndAlso IO.Path.GetExtension(FileUpload1.FileName) = ".xlsx") Then
Dim FileName As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
Dim Extension As String = Path.GetExtension(FileUpload1.PostedFile.FileName)
Dim FolderPath As String = Request.ApplicationPath + "Temp\"
Dim FilePath As String = Server.MapPath(FolderPath + FileName)
FileUpload1.SaveAs(FilePath)
Dim DTExcel As New Data.DataTable
Dim conn As Odbc.OdbcConnection = Nothing
Dim ErrorExcel = False
Try
conn = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & FilePath & ";")
conn.Open()
Dim cmd = conn.CreateCommand()
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * FROM [subproyecto$]"
Dim da = New Odbc.OdbcDataAdapter(cmd)
da.Fill(DTExcel)
Dim objsubproyectos As New ClsSubProyectos
Dim objcontpaqi As New ClsContPAQi(UsuarioActual.Empresa)
Dim resultado As Boolean = False
Dim DTError As New DataTable
'COLUMNAS DEL REPORTE (GRID)
DTError.Columns.Add("Fila", GetType(String))
DTError.Columns.Add("Clasificacion", GetType(String))
DTError.Columns.Add("SubProyecto", GetType(String))
DTError.Columns.Add("CuentaGasto", GetType(String))
DTError.Columns.Add("CuentaAnticipo", GetType(String))
DTError.Columns.Add("CuentaInventario", GetType(String))
Dim hayerrorcol As Boolean = False
Dim errores As String = "<table> <tr style=""color:#FFFFCC;background-color:orange;font-weight:bold;""><td style='width:250px'>Clasificación</td><td style='width:250px'>SubProyecto</td><td>CuentaGasto</td><td>CuentaAnticipo</td><td>CuentaInventario</td></tr>"
Dim mensajea As String = "el Archivo se cargado Correctamente"
For index As Integer = 0 To DTExcel.Rows.Count - 1
Dim CveClasificacion As Integer = DTExcel.Rows(index)("CveClasificacion").ToString.ToEntero
Dim CveSubProyecto As Integer = DTExcel.Rows(index)("CveSubProyecto").ToString.ToEntero
Dim idcuentagasto As Integer = -1
Dim idcuentaanticipo As Integer = -1
Dim idcuentaInventario As Integer = -1
Dim namecuentagasto As String = ""
Dim namecuentaanticipo As String = ""
Dim namecuentaInventario As String = ""
Dim cuentagasto As String = DTExcel.Rows(index)("CuentaGasto").ToString
cuentagasto = (cuentagasto.ToString.Trim.Replace("-", ""))
Dim cuentaanticipo As String = DTExcel.Rows(index)("CuentaAnticipo").ToString
cuentaanticipo = (cuentaanticipo.ToString.Trim.Replace("-", ""))
Dim cuentaInventario As String = DTExcel.Rows(index)("CuentaInventario").ToString
cuentaInventario = (cuentaInventario.ToString.Trim.Replace("-", ""))
Dim NEcuentagasto As Boolean = False
Dim NEcuentaanticipo As Boolean = False
Dim NEcuentaInventario As Boolean = False
If (Not (cuentagasto Is Nothing)) AndAlso cuentagasto.Length > 4 Then
If objcontpaqi.GetCuentas(-1, cuentagasto, -1, 1) Then
If objcontpaqi.DtResultados.Rows.Count > 0 Then
idcuentagasto = objcontpaqi.DtResultados.Rows(0)("Id").ToString.ToEntero
namecuentagasto = cuentagasto & " - " & objcontpaqi.DtResultados.Rows(0)("Nombre").ToString
Else
NEcuentagasto = True
End If
Else
NEcuentagasto = True
End If
End If
If (Not (cuentaanticipo Is Nothing)) AndAlso cuentaanticipo.Length > 4 Then
If objcontpaqi.GetCuentas(-1, cuentaanticipo, -1, 1) Then
If objcontpaqi.DtResultados.Rows.Count > 0 Then
idcuentaanticipo = objcontpaqi.DtResultados.Rows(0)("Id").ToString.ToEntero
namecuentaanticipo = cuentaanticipo & " - " & objcontpaqi.DtResultados.Rows(0)("Nombre").ToString
Else
NEcuentaanticipo = True
End If
Else
NEcuentaanticipo = True
End If
End If
If (Not (cuentaInventario Is Nothing)) AndAlso cuentaInventario.Length > 4 Then
If objcontpaqi.GetCuentas(-1, cuentaInventario, -1, 1) Then
If objcontpaqi.DtResultados.Rows.Count > 0 Then
idcuentaInventario = objcontpaqi.DtResultados.Rows(0)("Id").ToString.ToEntero
namecuentaInventario = cuentaInventario.ToString & " - " & objcontpaqi.DtResultados.Rows(0)("Nombre").ToString
Else
NEcuentaInventario = True
End If
Else
NEcuentaInventario = True
End If
End If
If (idcuentagasto > 0 Or idcuentaanticipo > 0 Or idcuentaInventario > 0) Then
If objsubproyectos.UpdateSubProyectoExcel(UsuarioActual.CveEmpresa, CveClasificacion, CveSubProyecto, idcuentagasto, idcuentaanticipo, idcuentaInventario, namecuentagasto, namecuentaanticipo, namecuentaInventario) Then
Else
resultado = True
End If
End If
If NEcuentagasto Or NEcuentaanticipo Or NEcuentaInventario Then
hayerrorcol = True
Dim Row As DataRow = Nothing
Row = DTError.NewRow
Row("Fila") = (index + 1).ToString
Row("Clasificacion") = DTExcel.Rows(index)("Clasificacion").ToString
Row("SubProyecto") = DTExcel.Rows(index)("SubProyecto").ToString
Row("CuentaGasto") = If(NEcuentagasto, cuentagasto, "")
Row("CuentaAnticipo") = If(NEcuentaanticipo, cuentaanticipo, "")
Row("CuentaInventario") = If(NEcuentaInventario, cuentaInventario, "")
DTError.Rows.Add(Row)
mensajea = "<br/><br/> El Archivo ha sido Cargado Correctamente <br/><br/> se han omitido los Siguientes Registros"
errores = String.Format("{0}<tr><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>", errores, Row("Clasificacion").ToString, Row("SubProyecto").ToString, Row("CuentaGasto").ToString, Row("CuentaAnticipo").ToString, Row("CuentaInventario").ToString)
End If
Next
objcontpaqi.Dispose()
objsubproyectos.Dispose()
If resultado Then
Alert("ocurrio un error al guardar los datos")
Else
Alert(mensajea & " <div style=""width:350px;height:200px;overflow:scroll"">" & errores & " </div>")
End If
'GridView1.Caption = Path.GetFileName("Lista de errores en carga")
'GridView1.DataSource = DTError
'GridView1.DataBind()
Catch ex As Exception
ErrorExcel = True
Alert("Ocurrio un error al leer el Excel: " + ex.ToString, TipoMensaje.MsgError)
End Try
conn.Close()
Else
Alert("No es un archivo de excel valido")
End If
End Sub
Private Sub Import_To_Grid(ByVal FilePath As String, ByVal Extension As String, ByVal isHDR As String)
Dim conStr As String = ""
Select Case Extension
Case ".xls"
'Excel 97-03
conStr = ConfigurationManager.ConnectionStrings("Excel03ConString") _
.ConnectionString
Exit Select
Case ".xlsx"
'Excel 07
conStr = ConfigurationManager.ConnectionStrings("Excel07ConString") _
.ConnectionString
Exit Select
End Select
conStr = String.Format(conStr, FilePath, isHDR)
Dim connExcel As New OleDbConnection(conStr)
Dim cmdExcel As New OleDbCommand()
Dim oda As New OleDbDataAdapter()
Dim dt As New DataTable()
cmdExcel.Connection = connExcel
'Get the name of First Sheet
connExcel.Open()
Dim dtExcelSchema As DataTable
dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
Dim SheetName As String = dtExcelSchema.Rows(0)("TABLE_NAME").ToString()
connExcel.Close()
'Read Data from First Sheet
connExcel.Open()
cmdExcel.CommandText = "SELECT * From [" & SheetName & "]"
oda.SelectCommand = cmdExcel
oda.Fill(dt)
connExcel.Close()
''Bind Data to GridView
'GridView1.Caption = Path.GetFileName(FilePath)
'GridView1.DataSource = dt
'GridView1.DataBind()
End Sub
Public Sub BtnAgregarCentroCosto_Click(sender As Object, e As EventArgs)
CveCentroCosto = -1
HdnModalidad.Value = "I"
TxtCentroCosto.Text = ""
ChkEstatus.Checked = True
ChkEsMatriz.Checked = False
ChkEsSucursal.Checked = False
ChkAplicaComercioExterior.Checked = False
TabComercioExterior.Visible = False
TxtSerie.Text = ""
TxtIVA.Text = "0.16"
TxtCalle.Text = ""
TxtNoExt.Text = ""
TxtNoInt.Text = ""
TxtColonia.Text = ""
TxtLocalidad.Text = ""
TxtMunicipio.Text = ""
TxtEstado.Text = ""
TxtPais.Text = ""
TxtCP.Text = ""
TxtCorreo.Text = ""
TxtTelefono.Text = ""
DdlPais.SelectedValueExist("-1")
DdlPrecioLista.SelectedValueExist("-1")
CargaEstado()
CargaMunicipio()
CargaColonia()
If UsuarioActual.Empresa.UsaContabilidad Then
CargaSegmentosNegocio()
End If
BtnGuardar.Text = "Agregar"
UpAddCentroEstatus.Update()
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCentroCosto"))
End Sub
Private Sub CargaRequired()
If ChkEsSucursal.Checked = True Then
RFVSerie.Enabled = True
RFVIVA.Enabled = True
RFVCalle.Enabled = True
RFVNoExt.Enabled = True
RFVColonia.Enabled = True
RFVLocalidad.Enabled = True
RFVMunicipio.Enabled = True
RFVEstado.Enabled = True
RFVPais.Enabled = True
RFVCP.Enabled = True
RFVSerie.Visible = True
RFVIVA.Visible = True
RFVCalle.Visible = True
RFVNoExt.Visible = True
RFVColonia.Visible = True
RFVLocalidad.Visible = True
RFVMunicipio.Visible = True
RFVEstado.Visible = True
RFVPais.Visible = True
RFVCP.Visible = True
Else
RFVSerie.Enabled = False
RFVIVA.Enabled = False
RFVCalle.Enabled = False
RFVNoExt.Enabled = False
RFVColonia.Enabled = False
RFVLocalidad.Enabled = False
RFVMunicipio.Enabled = False
RFVEstado.Enabled = False
RFVPais.Enabled = False
RFVCP.Enabled = False
RFVSerie.Visible = False
RFVIVA.Visible = False
RFVCalle.Visible = False
RFVNoExt.Visible = False
RFVColonia.Visible = False
RFVLocalidad.Visible = False
RFVMunicipio.Visible = False
RFVEstado.Visible = False
RFVPais.Visible = False
RFVCP.Visible = False
End If
End Sub
Private Sub ChkEsSucursal_CheckedChanged(sender As Object, e As EventArgs) Handles ChkEsSucursal.CheckedChanged
CargaRequired()
End Sub
#End Region
#Region "COMERCIO EXTERIOR"
Private Sub CargaPais()
DdlPais.DataSource = GlobalDTPais()
DdlPais.DataBind()
DdlPais.SelectedValueExist("151")
End Sub
Private Sub CargaEstado()
DdlEstado.Items.Clear()
If DdlPais.SelectedValue.ToEntero > 0 Then
DdlEstado.DataSource = GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString)
End If
DdlEstado.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlEstado.DataBind()
End Sub
Private Sub CargaMunicipio()
DdlMunicipio.Items.Clear()
If DdlEstado.SelectedValue.ToEntero > 0 Then
DdlMunicipio.DataSource = GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString)
End If
DdlMunicipio.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlMunicipio.DataBind()
End Sub
Private Sub CargaColonia()
DdlColonia.Items.Clear()
If DdlMunicipio.SelectedValue.ToEntero > 0 Then
DdlColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString)
End If
DdlColonia.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlColonia.DataBind()
End Sub
Protected Sub DdlPais_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaEstado()
CargaMunicipio()
CargaColonia()
End Sub
Protected Sub DdlEstado_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaMunicipio()
CargaColonia()
End Sub
Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaColonia()
End Sub
Protected Sub ChkAplicaComercioExterior_CheckedChanged(sender As Object, e As EventArgs)
AplicaComercio()
End Sub
Private Sub AplicaComercio()
If ChkAplicaComercioExterior.Checked Then
TabComercioExterior.Visible = True
Else
TabComercioExterior.Visible = False
End If
UpBodyCentroCosto.Update()
End Sub
#End Region
End Class

View File

@@ -0,0 +1,124 @@
<%@ Page Title="Catálogo de Sucursales" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatSucursales.aspx.vb" Inherits="CatSucursales" %>
<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 Sucursales
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<li>
<%--<img alt="Nueva Sucursal" onclick="AbrirVentana('/Planeacion/Sucursal.aspx', 700, 500, 'N', 'Sucursal')" src="/Imagenes/BotonAgregar.gif" style="cursor: pointer;" />--%>
<%--<asp:LinkButton ID="LnkUpload" runat="server" OnClientClick="showmodalcontent();">--%>
<div onclick="AbrirVentana('/Planeacion/Sucursal.aspx', 700, 500, 'N', 'Sucursal')" style="cursor: pointer;"><i class="fa fa-plus"></i> Agregar Sucursal</div>
<%--</asp:LinkButton>--%>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table> <%-- rules="all" style="border-collapse: collapse;"--%>
<tr class="Titulos">
<td style="width:250px"><asp:LinkButton ID="LbSucursal" runat="server" CausesValidation="false" Text="Sucursal"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgSucursal" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td style="width:100px"><asp:LinkButton ID="LbSerie" runat="server" CausesValidation="false" Text="Serie"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgSerie" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td style="width:100px"><asp:LinkButton ID="LbIVA" runat="server" CausesValidation="false" Text="IVA (%)"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgIVA" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td style="width:150px"><asp:LinkButton ID="LbFormatoFactura" runat="server" CausesValidation="false" Text="Formato Factura"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgFormatoFactura" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td style="width:100px"><asp:LinkButton ID="LbEstado" runat="server" CausesValidation="false" Text="Estado"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgEstatus" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td style="width:100px"><asp:LinkButton ID="LbFecha" runat="server" CausesValidation="false" Text="Fecha"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgFecha" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td style="width:100px"><asp:LinkButton ID="LbUsuario" runat="server" CausesValidation="false" Text="Usuario"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgUsuario" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveSucursal" EmptyDataText="No se encontraron Sucursales registradas"
ToolTip="Listado de Sucursales" CssClass="table table-striped table-advance table-hover" ShowHeader="false" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlSucursal" runat="server" Text='<%# Eval("Sucursal", "&nbsp;{0}") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtSucursal" runat="server" CausesValidation="true" MaxLength="20" Text='<%# Eval("Sucursal") %>' ValidationGroup="GrpGV" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVSucursal" runat="server" ControlToValidate="TxtSucursal" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sucursal''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOSucursal" runat="server" HighlightCssClass="vco" TargetControlID="RFVSucursal" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlSerie" runat="server" Text='<%# Eval("Serie", "&nbsp;{0}") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtSerie" runat="server" CausesValidation="true" MaxLength="2" Text='<%# Eval("Serie") %>' ValidationGroup="GrpGV" Width="54px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlIVA" runat="server" Text='<%# Eval("IVA", "{0:N2}%") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtIVA" runat="server" CausesValidation="true" MaxLength="4" Text='<%# Eval("IVA", "{0:N2}") %>' ValidationGroup="GrpGV" Width="59px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVIVA" runat="server" ControlToValidate="TxtIVA" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''IVA''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGV"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVIVA" runat="server" ControlToValidate="TxtIVA" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''IVA''</b> no tiene el formato correcto, solo números." Operator="DataTypeCheck" Type="Currency" ValidationGroup="GrpGV"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOIVA1" runat="server" HighlightCssClass="vco" TargetControlID="RFVIVA" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCOIVA2" runat="server" HighlightCssClass="vco" TargetControlID="CVIVA" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlFormato" runat="server" Text="Cargar Factura"></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<a class="Texto" href="javascript:AbrirVentana('/UploadFile.aspx?Tipo=FormatoFactura', 350, 110, 'N', 'CargarArchivo');">Cargar Factura</a>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlEstado" runat="server" Text='<%# Eval("Estatus") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="ChkEstado" runat="server" Checked='<%# If (Eval("Estatus").ToString = "Activo", True, False) %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlUsuario" runat="server" Text='<%# Eval("Usuario") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField HeaderText="Editar">
<EditItemTemplate>
<center>
<asp:ImageButton ID="imgU" runat="server" AlternateText="Actualizar" CausesValidation="True" CommandName="Update" ImageUrl="/Imagenes/Btn_Update.png" ValidationGroup="GrpGV" />
&nbsp;<asp:ImageButton ID="imgC" runat="server" AlternateText="Cancelar" CausesValidation="False" CommandName="Cancel" ImageUrl="/Imagenes/Btn_Cancel.png" />
</center>
</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" CommandName="Edit" ImageUrl="/Imagenes/Btn_Edit.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar">
<ItemTemplate>
<asp:ImageButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" ImageUrl="/Imagenes/Btn_Delete.png" OnClientClick="javascript:return C();" />
</ItemTemplate>
</asp:TemplateField>--%>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script language="javascript" type="text/javascript">
function C() {
return confirm('¿Está seguro que desea eliminar la Sucursal?');
}
</script>
</asp:Content>

View File

@@ -0,0 +1,270 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports System.Linq
Imports Extensiones
Partial Class CatSucursales
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ViewState("Orden") = ""
ViewState("OSucursal") = "Sucursal DESC"
ViewState("OSerie") = "Serie DESC"
ViewState("OIVA") = "IVA DESC"
ViewState("OFormatoFactura") = "FormatoFactura DESC"
ViewState("OEstado") = "Estado DESC"
ViewState("OFecha") = "Fecha DESC"
ViewState("OUsuario") = "Usuario DESC"
CargaDatos()
'Permiso Registro
'If PermisoRegistro Then
' LbAgregar.Enabled = True
'Else
' LbAgregar.Enabled = False
'End If
End If
End Sub
Public Sub CargaDatos()
Dim ObjSucursales As New ClsSucursales
If ObjSucursales.GetSucursales() Then
'GlobalDTSucursales = ObjSucursales.DtResultados
ViewState("DTSucursales") = ObjSucursales.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Else
Me.GvDatos.DataSource = Nothing
End If
ObjSucursales.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End Sub
'Pendiente upload
'Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click
' Dim ObjSucursales As New ClsSucursales
' If ObjSucursales.AddSucursal(TxtSucursal.Text.Trim, TxtSerie.Text.Trim, TxtIVA.Text.Trim.ToDouble, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", "", "", "", "", "", "", "") Then
' TxtSucursal.Text = ""
' TxtSerie.Text = ""
' TxtIVA.Text = ""
' Alert("La nueva Sucursal se guardó correctamente.", TipoMensaje.MsgInformacion)
' UpTitulos.Update()
' GlobalDTSucursales = ObjSucursales.DtResultados
' ViewState("DTSucursales") = ObjSucursales.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
' If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
' Else
' CargaGrid("")
' End If
' End If
' ObjSucursales.Dispose()
'End Sub
Private Sub CargaGrid(Orden As String)
If Orden <> String.Empty Then
Dim DV As New DataView(CType(ViewState("DTSucursales"), DataTable), "", Orden, DataViewRowState.CurrentRows)
GvDatos.DataSource = DV.ToTable()
DV.Dispose()
Else
GvDatos.DataSource = CType(ViewState("DTSucursales"), DataTable)
End If
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(250)
e.Row.Cells(1).Width = Unit.Pixel(100)
e.Row.Cells(2).Width = Unit.Pixel(100)
e.Row.Cells(3).Width = Unit.Pixel(150)
e.Row.Cells(4).Width = Unit.Pixel(100)
e.Row.Cells(5).Width = Unit.Pixel(100)
e.Row.Cells(6).Width = Unit.Pixel(100)
'e.Row.Cells(7).Width = Unit.Pixel(50)
'e.Row.Cells(8).Width = Unit.Pixel(50)
End If
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
Dim Liga As String = "<a class=""Texto"" href=""javascript:AbrirVentana('/Planeacion/Sucursal.aspx?CveSucursal=" & e.Row.DBCampo("CveSucursal") & "', 700, 500, 'N', 'Sucursal')"">"
e.Row.FCLiteral("LtlSucursal").Text = Liga & e.Row.FCLiteral("LtlSucursal").Text & "</a>"
e.Row.FCLiteral("LtlSerie").Text = Liga & e.Row.FCLiteral("LtlSerie").Text & "</a>"
e.Row.FCLiteral("LtlIVA").Text = Liga & e.Row.FCLiteral("LtlIVA").Text & "</a>"
e.Row.FCLiteral("LtlEstado").Text = Liga & e.Row.FCLiteral("LtlEstado").Text & "</a>"
e.Row.FCLiteral("LtlFecha").Text = Liga & e.Row.FCLiteral("LtlFecha").Text & "</a>"
e.Row.FCLiteral("LtlUsuario").Text = Liga & e.Row.FCLiteral("LtlUsuario").Text & "</a>"
If System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\Formatos\" & e.Row.DBCampo("FormatoFactura")) Then
e.Row.FCLiteral("LtlFormato").Text = "<a class=""Texto"" href=""/Empresas/" & UsuarioActual.CveEmpresa & "/Formatos/" & e.Row.DBCampo("FormatoFactura") & """>Ver</a>"
Else
e.Row.FCLiteral("LtlFormato").Text = "<a class=""Texto"" href=""javascript:AbrirVentana('/UploadFile.aspx?Tipo=FormatoFactura', 350, 110, 'N', 'CargarArchivo');"">Cargar Factura</a>"
End If
End If
End Sub
#Region " ORDENAMIENTO "
Protected Sub LbSucursal_Click(sender As Object, e As System.EventArgs) Handles LbSucursal.Click, ImgSucursal.Click
If ViewState("OSucursal").ToString() = "Sucursal DESC" Then
ViewState("OSucursal") = "Sucursal ASC"
ImgSucursal.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OSucursal") = "Sucursal DESC"
ImgSucursal.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OSucursal")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbSerie_Click(sender As Object, e As System.EventArgs) Handles LbSerie.Click, ImgSerie.Click
If ViewState("OSerie").ToString() = "Serie DESC" Then
ViewState("OSerie") = "Serie ASC"
ImgSerie.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OSerie") = "Serie DESC"
ImgSerie.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OSerie")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbIVA_Click(sender As Object, e As System.EventArgs) Handles LbIVA.Click, ImgIVA.Click
If ViewState("OIVA").ToString() = "IVA DESC" Then
ViewState("OIVA") = "IVA ASC"
ImgIVA.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OIVA") = "IVA DESC"
ImgIVA.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OIVA")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbFormatoFactura_Click(sender As Object, e As System.EventArgs) Handles LbFormatoFactura.Click, ImgFormatoFactura.Click
If ViewState("OFormatoFactura").ToString() = "FormatoFactura DESC" Then
ViewState("OFormatoFactura") = "FormatoFactura ASC"
ImgFormatoFactura.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OFormatoFactura") = "FormatoFactura DESC"
ImgFormatoFactura.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OFormatoFactura")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbEstado_Click(sender As Object, e As System.EventArgs) Handles LbEstado.Click, ImgEstatus.Click
If ViewState("OEstado").ToString() = "Estado DESC" Then
ViewState("OEstado") = "Estado ASC"
ImgEstatus.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OEstado") = "Estado DESC"
ImgEstatus.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OEstado")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbFecha_Click(sender As Object, e As System.EventArgs) Handles LbFecha.Click, LbFecha.Click
If ViewState("OFecha").ToString() = "Fecha DESC" Then
ViewState("OFecha") = "Fecha ASC"
ImgFecha.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OFecha") = "Fecha DESC"
ImgFecha.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OFecha")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbUsuario_Click(sender As Object, e As System.EventArgs) Handles LbUsuario.Click, LbUsuario.Click
If ViewState("OUsuario").ToString() = "Usuario DESC" Then
ViewState("OUsuario") = "Usuario ASC"
ImgUsuario.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OUsuario") = "Usuario DESC"
ImgUsuario.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OUsuario")
CargaGrid(ViewState("Orden").ToString())
End Sub
#End Region
'Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
' Dim ObjSucursales As New ClsSucursales
' If ObjSucursales.RemoveClasificacion(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
' GvDatos.EditIndex = -1
' GlobalDTSucursales = ObjSucursales.DtResultados
' ViewState("DTSucursales") = ObjSucursales.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
' Alert("La Sucursal se eliminó correctamente.", TipoMensaje.MsgInformacion)
' End If
' ObjSucursales.Dispose()
' If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
' Else
' CargaGrid("")
' End If
'End Sub
'Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit
' GvDatos.EditIndex = -1
' If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
' Else
' CargaGrid("")
' End If
'End Sub
'Pendiente Upload
'Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
' Dim ObjSucursales As New ClsSucursales
' Dim Sucursal As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtSucursal"), TextBox).Text.Trim
' Dim Serie As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtSerie"), TextBox).Text.Trim
' Dim IVA As Double = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtIVA"), TextBox).Text.Trim.ToDouble
' Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstado").Checked
' Dim CveSucursal As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero
' If ObjSucursales.UpdateSucursal(Sucursal, Serie, IVA, "", Estatus, UsuarioActual.CveUsuario, CveSucursal, "", "", "", "", "", "", "", "", "") Then
' GvDatos.EditIndex = -1
' GlobalDTSucursales = ObjSucursales.DtResultados
' ViewState("DTSucursales") = ObjSucursales.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
' End If
' ObjSucursales.Dispose()
' If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
' Else
' CargaGrid("")
' End If
'End Sub
'Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing
' GvDatos.EditIndex = e.NewEditIndex
' If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
' Else
' CargaGrid("")
' End If
'End Sub
End Class

View File

@@ -0,0 +1,130 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatTiposEventos.aspx.vb" Inherits="AF_CatTiposEventos" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="H" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" Runat="Server">
Catálogo de Tipos de Eventos
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" Runat="Server">
<script language="javascript" type="text/javascript">
function C() {
return confirm('¿Está seguro que desea eliminar el Tipo de Evento?');
}
</script>
<asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table border="1" rules="all" style="border-collapse: collapse;">
<tr class="Titulos">
<td width="250px"><asp:LinkButton ID="LbTipo" runat="server" CausesValidation="false" Text="Tipo"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgTipo" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td width="250px"><asp:LinkButton ID="LbTipoReferencia" runat="server" CausesValidation="false" Text="Tipo Referencia"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgTipoReferencia" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td width="100px"><asp:LinkButton ID="LbEstadoEvento" runat="server" CausesValidation="false" Text="Estado"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgEstadoEvento" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td width="100px"><asp:LinkButton ID="LbFechaIng" runat="server" CausesValidation="false" Text="FechaIng"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgFechaIng" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td width="100px"><asp:LinkButton ID="LbUsuario" runat="server" CausesValidation="false" Text="Usuario"></asp:LinkButton>&nbsp;<asp:ImageButton ID="ImgUsuario" runat="server" CausesValidation="false" ImageUrl="/Imagenes/FlechasAbajo.gif" /></td>
<td width="103">Comandos</td>
</tr>
<tr>
<td>
<asp:TextBox ID="TxtTipo" runat="server" CausesValidation="true" MaxLength="50" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTipo" runat="server" ControlToValidate="TxtTipo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCTipo" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipo" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
<td><asp:TextBox ID="TxtTipoReferencia" runat="server" CausesValidation="true" MaxLength="50" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTipoReferencia" runat="server" ControlToValidate="TxtTipoReferencia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''TipoReferencia''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCTipoReferencia" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipoReferencia" Width="300px"></ajax:ValidatorCalloutExtender></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><asp:LinkButton ID="LbAgregar" runat="server" CausesValidation="true" CssClass="Texto" Text="Agregar" ValidationGroup="GrpGuardar"></asp:LinkButton></td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveTipoEvento" EmptyDataText="No se encontraron Tipos Registrados" ToolTip="Listado de Tipos">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlTipo" runat="server" Text='<%# Eval("Tipo", "&nbsp;{0}") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtTipo" runat="server" CausesValidation="true" MaxLength="50" Text='<%# Eval("Tipo") %>' ValidationGroup="GrpGV" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTipo" runat="server" ControlToValidate="TxtTipo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCTipo" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipo" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlTipoReferencia" runat="server" Text='<%# Eval("TipoReferencia", "&nbsp;{0}") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtTipoReferencia" runat="server" CausesValidation="true" MaxLength="50" Text='<%# Eval("TipoReferencia") %>' ValidationGroup="GrpGV" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTipoReferencia" runat="server" ControlToValidate="TxtTipoReferencia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''TipoReferencia''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCTipoReferencia" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipoReferencia" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlEstadoEvento" runat="server" Text='<%# Eval("Estado") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="ChkEstado" runat="server" Checked='<%# If (Eval("Estado").ToString = "Activo", True, False) %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlFechaIng" runat="server" Text='<%# Eval("FechaIng", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlUsuario" runat="server" Text='<%# Eval("Usuario") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Editar">
<EditItemTemplate>
<center>
<asp:ImageButton ID="imgU" runat="server" AlternateText="Actualizar" CausesValidation="True" CommandName="Update" ImageUrl="/Imagenes/Btn_Update.png" ValidationGroup="GrpGV" />
&nbsp;<asp:ImageButton ID="imgC" runat="server" AlternateText="Cancelar" CausesValidation="False" CommandName="Cancel" ImageUrl="/Imagenes/Btn_Cancel.png" />
</center>
</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" CommandName="Edit" ImageUrl="/Imagenes/Btn_Edit.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar">
<ItemTemplate>
<asp:ImageButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" ImageUrl="/Imagenes/Btn_Delete.png" OnClientClick="javascript:return C();" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpProgress" runat="server" DisplayAfter="0">
<ProgressTemplate>
<div id="overlay">
<div id="modalprogress">
<div id="theprogress">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>La información se está procesando...</td>
</tr>
<tr>
<td><img src="/Imagenes/Cargando.gif" style="border-width: 0px;" alt="" /></td>
</tr>
</table>
</center>
</div>
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</asp:Content>

View File

@@ -0,0 +1,230 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports System.Linq
Imports Extensiones
Partial Class AF_CatTiposEventos
Inherits ClsPaginas
Public Property PuedeEditar As Boolean
Get
Return CBool(ViewState("PuedeEditar"))
End Get
Set(value As Boolean)
ViewState("PuedeEditar") = value
End Set
End Property
Public Property PuedeEliminar As Boolean
Get
Return CBool(ViewState("PuedeEditar"))
End Get
Set(value As Boolean)
ViewState("PuedeEditar") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ViewState("Orden") = ""
ViewState("OTipo") = "Tipo DESC"
ViewState("OTipoReferencia") = "TipoReferencia DESC"
ViewState("OEstado") = "Estado DESC"
ViewState("OFechaIng") = "FechaIng DESC"
ViewState("OUsuario") = "Usuario DESC"
CargaDatos()
End If
End Sub
Private Sub CargaDatos()
Dim ObjTiposEventos As New ClsTiposEventos()
'CARGA TIPOS EVENTOS
If ObjTiposEventos.GetTiposEventos() Then
ViewState("DTTiposEventos") = ObjTiposEventos.DtResultados
GlobalDTTiposEventos = ObjTiposEventos.DtResultados
Else
Me.GvDatos.DataSource = Nothing
End If
ObjTiposEventos.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
ObjTiposEventos.Dispose()
End Sub
Private Sub CargaGrid(Orden As String)
If Orden <> String.Empty Then
Dim DV As New DataView(CType(ViewState("DTTiposEventos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
GvDatos.DataSource = DV.ToTable()
DV.Dispose()
Else
GvDatos.DataSource = CType(ViewState("DTTiposEventos"), DataTable)
End If
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub LbUsuario_Click(sender As Object, e As System.EventArgs) Handles LbUsuario.Click, ImgUsuario.Click
If ViewState("OUsuario").ToString() = "Usuario DESC" Then
ViewState("OUsuario") = "Usuario ASC"
ImgUsuario.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OUsuario") = "Usuario DESC"
ImgUsuario.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OUsuario")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbTipoReferencia_Click(sender As Object, e As System.EventArgs) Handles LbTipoReferencia.Click, ImgTipoReferencia.Click
If ViewState("OTipoReferencia").ToString() = "TipoReferencia DESC" Then
ViewState("OTipoReferencia") = "TipoReferencia ASC"
ImgTipoReferencia.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OTipoReferencia") = "TipoReferencia DESC"
ImgTipoReferencia.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OTipoReferencia")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbEstadoEvento_Click(sender As Object, e As System.EventArgs) Handles LbEstadoEvento.Click, ImgEstadoEvento.Click
If ViewState("OEstadoEvento").ToString() = "EstadoEvento DESC" Then
ViewState("OEstadoEvento") = "EstadoEvento ASC"
ImgEstadoEvento.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OEstadoEvento") = "EstadoEvento DESC"
ImgEstadoEvento.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OEstadoEvento")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbTipo_Click(sender As Object, e As System.EventArgs) Handles LbTipo.Click, ImgTipo.Click
If ViewState("OTipo").ToString() = "Tipo DESC" Then
ViewState("OTipo") = "Tipo ASC"
ImgTipo.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OTipo") = "Tipo DESC"
ImgTipo.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OTipo")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub LbFechaIng_Click(sender As Object, e As System.EventArgs) Handles LbFechaIng.Click, ImgFechaIng.Click
If ViewState("OFechaIng").ToString() = "FechaIng DESC" Then
ViewState("OFechaIng") = "FechaIng ASC"
ImgFechaIng.ImageUrl = "/Imagenes/FlechasArriba.gif"
Else
ViewState("OFechaIng") = "FechaIng DESC"
ImgFechaIng.ImageUrl = "/Imagenes/FlechasAbajo.gif"
End If
ViewState("Orden") = ViewState("OFechaIng")
CargaGrid(ViewState("Orden").ToString())
End Sub
Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing
GvDatos.EditIndex = e.NewEditIndex
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End Sub
Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit
GvDatos.EditIndex = -1
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End Sub
Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
Dim ObjTiposEventos As New ClsTiposEventos
Dim Tipo As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtTipo"), TextBox).Text.Trim
Dim TipoReferencia As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtTipoReferencia"), TextBox).Text.Trim
Dim Estado As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstado").Checked
Dim CveTipoEvento As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero
If ObjTiposEventos.UpdateTiposEventos(Tipo, TipoReferencia, Estado, CveTipoEvento) Then
GvDatos.EditIndex = -1
ViewState("DTTiposEventos") = ObjTiposEventos.DtResultados
GlobalDTTiposEventos = ObjTiposEventos.DtResultados
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
End If
ObjTiposEventos.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim ObjTiposEventos As New ClsTiposEventos
If ObjTiposEventos.RemoveTiposEventos(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
GvDatos.EditIndex = -1
ViewState("DTTiposEventos") = ObjTiposEventos.DtResultados
GlobalDTTiposEventos = ObjTiposEventos.DtResultados
Alert("El Registro se eliminó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjTiposEventos.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(250)
e.Row.Cells(1).Width = Unit.Pixel(250)
e.Row.Cells(2).Width = Unit.Pixel(100)
e.Row.Cells(3).Width = Unit.Pixel(100)
e.Row.Cells(4).Width = Unit.Pixel(100)
e.Row.Cells(5).Width = Unit.Pixel(50)
e.Row.Cells(6).Width = Unit.Pixel(50)
End If
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
End If
End Sub
Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click
Dim ObjTiposEventos As New ClsTiposEventos
If ObjTiposEventos.AddTiposEventos(TxtTipo.Text.Trim, TxtTipoReferencia.Text.Trim, UsuarioActual.CveUsuario) Then
TxtTipo.Text = ""
Alert("El nuevo Departamento se guardó correctamente.", TipoMensaje.MsgInformacion)
UpTitulos.Update()
ViewState("DTTiposEventos") = ObjTiposEventos.DtResultados
GlobalDTTiposEventos = ObjTiposEventos.DtResultados
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End If
ObjTiposEventos.Dispose()
End Sub
End Class

View File

@@ -0,0 +1,105 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpEventos.aspx.vb" Inherits="PopUpEventos" %>
<%@ Register Assembly="eWorld.UI, Version=2.0.6.2393, Culture=neutral, PublicKeyToken=24d65337282035f2" Namespace="eWorld.UI" TagPrefix="ew" %>
<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 Eventos
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table border="0" class="contenido">
<tr>
<td>
<div>
<fieldset>
<legend><b>Programación de Eventos</b></legend>
<table border="0">
<tr id="LblTipoEvento" runat="server">
<td>Tipo:</td>
<td>
<asp:DropDownList ID="DdlTipo" runat="server" AppendDataBoundItems="true" DataTextField="Tipo" DataValueField="CveTipoEvento" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 200px !important;" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTipo" runat="server" ControlToValidate="DdlTipo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Activo Fijo''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOTipo" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipo" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Descripción:</td>
<td>
<asp:TextBox ID="TxtTexto" runat="server" MaxLength="70" Width="200px" TextMode="MultiLine" Height="100px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTexto" runat="server" ControlToValidate="TxtTexto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Texto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETexto" runat="server" HighlightCssClass="vco" TargetControlID="RFVTexto" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
<tr>
<td>Fecha:</td>
<td>
<asp:TextBox ID="TxtFechaEvento" runat="server" MaxLength="13" Width="70px"></asp:TextBox>
<asp:ImageButton runat="server" ID="ImgFechaEvento" ImageUrl="/Imagenes/calendar.png" ImageAlign="AbsMiddle" Width="16px" Height="16px" AlternateText="Click para ver el Calendario" />
<ajax:MaskedEditExtender ID="MEEFechaEvento" runat="server" TargetControlID="TxtFechaEvento" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaEvento" TargetControlID="TxtFechaEvento" PopupButtonID="ImgFechaEvento" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaEvento" runat="server" ControlToValidate="TxtFechaEvento" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''FechaEvento''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaEvento" runat="server" ControlToValidate="TxtFechaEvento" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''FechaEvento''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFechaEvento1" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaEvento" Width="350px"></ajax:ValidatorCalloutExtender>
&nbsp;
<ajax:ValidatorCalloutExtender ID="VCOFechaEvento2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaEvento" Width="350px"></ajax:ValidatorCalloutExtender>
&nbsp;
</td>
</tr>
<tr>
<td>Hora:</td>
<td>
<ew:TimePicker ID="TxtHora" runat="server" ControlDisplay="TextBoxImage" ImageUrl="/Imagenes/tool_timer.png" PopupWidth="100px" Width="70px" DisableTextBoxEntry="True" PopupHeight="150px" RoundUpMinutes="True" MilitaryTime="True" Culture="Spanish (Mexico)" LowerBoundTime="07:00" UpperBoundTime="20:30">
<TimeStyle CssClass="Texto" />
</ew:TimePicker>
<ew:CustomValidator ID="CVHora" runat="server" ClientValidationFunction="RevisaHora" ControlToValidate="TxtHora" Display="None" ErrorMessage="El campo <b>''Hora''</b> es necesario, por favor seleccione la hora correcta." ValidationGroup="Guardar" ValidateEmptyText="true"></ew:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VcoHora" runat="server" HighlightCssClass="vco" TargetControlID="CVHora" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:CheckBox ID="ChkFueEfectuado" Text="Fué Efectuado:" TextAlign="Left" runat="server" />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:UpdatePanel ID="UpGuardar" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar" class="btn btn-primary" />
<asp:Button ID="BtnEliminar" runat="server" Text="Eliminar" class="btn btn-danger" />
<asp:ValidationSummary ID="VS" runat="server" DisplayMode="BulletList" ShowSummary="true" ValidationGroup="GrpGuardar" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</fieldset>
</div>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script language="javascript" type="">
function RefrescarAnterior() {
//window.parent.MuestraAlerta("Información", "El Archivo se guardó correctamente.", "I", 1, "");
window.parent.RefrecarEvento();
window.parent.tb_remove();
//if (navigator.appName == "Microsoft Internet Explorer") {
// window.parent.LnkUpload.focus();
// }
}
</script>
</asp:Content>

View File

@@ -0,0 +1,144 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class PopUpEventos
Inherits ClsPaginas
Private ReadOnly Property CveEvento As Integer
Get
Return ViewState("CveEvento").ToString.ToEntero
End Get
End Property
Private ReadOnly Property TipoReferencia As String
Get
Return ViewState("TipoReferencia").ToString
End Get
End Property
Private ReadOnly Property Referencia As String
Get
Return ViewState("Referencia").ToString
End Get
End Property
'Request("TipoReferencia"), Request("Referencia")
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CType(Me.Master, BaseMasterPage).EsPopup = True
CType(Me.Master, BaseMasterPage).PopupWidth = 350
RegistraScript("$get('tdContenido').style.height='100px'")
If Request("TipoReferencia") IsNot Nothing AndAlso Request("TipoReferencia").Length > 0 Then
ViewState("TipoReferencia") = Request("TipoReferencia")
Else
ViewState("TipoReferencia") = "-1"
End If
If Request("Referencia") IsNot Nothing AndAlso Request("Referencia").Length > 0 Then
ViewState("Referencia") = Request("Referencia")
Else
ViewState("Referencia") = "-1"
End If
CargaTiposEventos()
If Request("CveEvento") IsNot Nothing AndAlso IsNumeric(Request("CveEvento")) AndAlso Request("CveEvento").ToEntero > 0 Then
ViewState("CveEvento") = Request("CveEvento")
CargarDatos()
Else
ViewState("CveEvento") = -1
End If
End If
End Sub
Public Sub CargarDatos()
Dim ObjEventos As New ClsEventos
If ObjEventos.GetEventos("-1", "-1", False, -1, UsuarioActual.CveEmpresa, False, CveEvento) Then
If ObjEventos.DtResultados.Rows.Count > 0 Then
DdlTipo.SelectedValue = ObjEventos.CveTipoEvento.ToString
TxtTexto.Text = ObjEventos.Texto
TxtFechaEvento.Text = ObjEventos.FechaEvento.ToShortDateString
TxtHora.SelectedTime = ObjEventos.FechaEvento
ChkFueEfectuado.Checked = ObjEventos.FueEfectuado
If ChkFueEfectuado.Checked Then
BtnGuardar.Enabled = False
BtnEliminar.Enabled = False
End If
End If
End If
ObjEventos.Dispose()
End Sub
Private Sub CargaTiposEventos()
If TipoReferencia <> "-1" Then
DdlTipo.DataSource = GlobalDTTiposEventos.FiltraParametros("TipoReferencia = '" & TipoReferencia & "'")
BtnEliminar.Enabled = False
BtnGuardar.Text = "Agregar"
ChkFueEfectuado.Visible = False
Else
DdlTipo.DataSource = GlobalDTTiposEventos
End If
DdlTipo.DataBind()
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
Dim ObjEventos As New ClsEventos
Dim Tmp As Integer
Dim FechaHora As String = TxtHora.SelectedTime.ToShortTimeString.ToString
If FechaHora.Contains("p") = True OrElse FechaHora.Contains("P") = True Then
Tmp = CInt(FechaHora.Substring(0, 2))
If Tmp <> 12 Then
Tmp = Tmp + 12
End If
FechaHora = Tmp & FechaHora.Substring(2, FechaHora.Length - 2)
End If
FechaHora = FechaHora.Replace("p.m.", "")
FechaHora = FechaHora.Replace("P.M.", "")
FechaHora = FechaHora.Replace("a.m.", "")
FechaHora = FechaHora.Replace("A.M.", "")
FechaHora = FechaHora.Trim
FechaHora = TxtFechaEvento.Text & " " & FechaHora
If CveEvento = -1 Then
If ObjEventos.AddEventos(DdlTipo.SelectedValue.ToEntero, TxtTexto.Text.Trim, TipoReferencia, Referencia, FechaHora.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("Se guardó correctamente.", TipoMensaje.MsgInformacion, "RefrescarAnterior();")
End If
Else
If ObjEventos.UpdateEventos(TxtTexto.Text.Trim, FechaHora.ToDate, ChkFueEfectuado.Checked, CveEvento.ToEntero) Then
Alert("Se guardó correctamente.", TipoMensaje.MsgInformacion, "RefrescarAnterior();")
End If
End If
ObjEventos.Dispose()
End Sub
Public Sub CargarHora()
Dim Tmp As Integer
Dim FechaHora As String = TxtHora.SelectedTime.ToShortTimeString.ToString
If FechaHora.Contains("p") = True OrElse FechaHora.Contains("P") = True Then
Tmp = CInt(FechaHora.Substring(0, 2))
If Tmp <> 12 Then
Tmp = Tmp + 12
End If
FechaHora = Tmp & FechaHora.Substring(2, FechaHora.Length - 2)
End If
FechaHora = FechaHora.Replace("p.m.", "")
FechaHora = FechaHora.Replace("P.M.", "")
FechaHora = FechaHora.Replace("a.m.", "")
FechaHora = FechaHora.Replace("A.M.", "")
FechaHora = FechaHora.Trim
FechaHora = TxtFechaEvento.Text & " " & FechaHora
End Sub
Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click
Dim ObjEventos As New ClsEventos
If ObjEventos.RemoveEventos(CveEvento.ToEntero) Then
Alert("Se ha eliminado satisfactoriamente.", TipoMensaje.MsgInformacion)
End If
End Sub
End Class

219
Planeacion/Sucursal.aspx Normal file
View File

@@ -0,0 +1,219 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Sucursal.aspx.vb" Inherits="Sucursal" %>
<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">
Sucursal
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding-top: 20px;">
<tr>
<td align="left">
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ajax:TabContainer ID="Tab" runat="server" ActiveTabIndex="0" Width="100%" CssClass="tabBodyOverride">
<ajax:TabPanel HeaderText="Información" ID="TabPanel1" runat="server">
<ContentTemplate>
<table border="0" class="contenido">
<tr>
<td>
<div>
<fieldset>
<legend><b>Descripción</b></legend>
<table border="0">
<tr>
<td>Nombre:</td>
<td>
<asp:TextBox ID="TxtSucursal" runat="server" CausesValidation="true" MaxLength="20" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVSucursal" runat="server" ControlToValidate="TxtSucursal" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sucursal''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOSucursal" runat="server" HighlightCssClass="vco" TargetControlID="RFVSucursal" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Serie:</td>
<td>
<asp:TextBox ID="TxtSerie" runat="server" CausesValidation="true" MaxLength="15" ValidationGroup="GrpGuardar" Width="59px"></asp:TextBox>
</td>
</tr>
<tr>
<td>IVA:</td>
<td>
<asp:TextBox ID="TxtIVA" runat="server" CausesValidation="true" MaxLength="4" ValidationGroup="GrpGuardar" Width="59px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVIVA" runat="server" ControlToValidate="TxtIVA" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''IVA''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVIVA" runat="server" ControlToValidate="TxtIVA" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''IVA''</b> no tiene el formato correcto, solo números." Operator="DataTypeCheck" Type="Currency" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOIVA1" runat="server" HighlightCssClass="vco" TargetControlID="RFVIVA" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCOIVA2" runat="server" HighlightCssClass="vco" TargetControlID="CVIVA" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Calle:</td>
<td>
<asp:TextBox ID="TxtCalle" runat="server" CausesValidation="true" MaxLength="50" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVCalle" runat="server" ControlToValidate="TxtCalle" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Calle''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOCalle" runat="server" HighlightCssClass="vco" TargetControlID="RFVCalle" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Número Exterior:</td>
<td>
<asp:TextBox ID="TxtNoExt" runat="server" CausesValidation="true" MaxLength="50" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVNoExt" runat="server" ControlToValidate="TxtNoExt" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Número Exterior''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCONoExt" runat="server" HighlightCssClass="vco" TargetControlID="RFVNoExt" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Número Interior:</td>
<td>
<asp:TextBox ID="TxtNoInt" runat="server" CausesValidation="true" MaxLength="50" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Colonia:</td>
<td>
<asp:TextBox ID="TxtColonia" runat="server" CausesValidation="true" MaxLength="50" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVColonia" runat="server" ControlToValidate="TxtColonia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Colonia''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOColonia" runat="server" HighlightCssClass="vco" TargetControlID="RFVColonia" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Localidad:</td>
<td>
<asp:TextBox ID="TxtLocalidad" runat="server" CausesValidation="true" MaxLength="40" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVLocalidad" runat="server" ControlToValidate="TxtLocalidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Localidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOLocalidad" runat="server" HighlightCssClass="vco" TargetControlID="RFVLocalidad" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Municipio:</td>
<td>
<asp:TextBox ID="TxtMunicipio" runat="server" CausesValidation="true" MaxLength="25" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVMunicipio" runat="server" ControlToValidate="TxtMunicipio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Municipio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOMunicipio" runat="server" HighlightCssClass="vco" TargetControlID="RFVMunicipio" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Estado:</td>
<td>
<asp:TextBox ID="TxtEstado" runat="server" CausesValidation="true" MaxLength="20" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVEstado" runat="server" ControlToValidate="TxtEstado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Estado''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOEstado" runat="server" HighlightCssClass="vco" TargetControlID="RFVEstado" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>País:</td>
<td>
<asp:TextBox ID="TxtPais" runat="server" CausesValidation="true" MaxLength="50" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVPais" runat="server" ControlToValidate="TxtPais" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''País''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOPais" runat="server" HighlightCssClass="vco" TargetControlID="RFVPais" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>CP:</td>
<td>
<asp:TextBox ID="TxtCP" runat="server" CausesValidation="true" MaxLength="5" ValidationGroup="GrpGuardar" Width="244px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVCP" runat="server" ControlToValidate="TxtCP" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''CP''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOCP1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCP" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td>Es Matriz?<td>
<td> <asp:CheckBox ID="Matriz" runat="server" /> </td>
</tr>
<%--<tr>
<td>Formato Factura, TipoFormato:</td>
<td><a id="HLVer" runat="server" class="Texto" href="javascript:AbrirVentana('/UploadFile.aspx?Tipo=FormatoFactura', 350, 110, 'N', 'CargarArchivo');">Cargar Factura</a>&nbsp;<a class="Texto" href="javascript:AbrirVentana('/UploadFile.aspx?Tipo=FormatoFactura', 350, 110, 'N', 'CargarArchivo');">Cargar Factura</a></td>
</tr>--%>
</table>
</fieldset>
</div>
</td>
<td width="15px">&nbsp;</td>
</tr>
</table>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel HeaderText="Sistema" ID="TabPanel2" runat="server">
<ContentTemplate>
<table border="0" class="contenido">
<tr>
<td>
<div>
<fieldset>
<legend><b>Sistema</b></legend>
<table border="0">
<tr>
<td>Estado:</td>
<td>
<asp:CheckBox ID="ChkEstado" runat="server" Text="(Activado = Si, Desactivado = No)" /></td>
</tr>
<tr>
<td>Fecha de Captura:</td>
<td>
<asp:Label ID="LblFechaCaptura" runat="server"></asp:Label></td>
</tr>
<tr>
<td>Usuario Capturó:</td>
<td>
<asp:Label ID="LblUsuarioCapturo" runat="server"></asp:Label></td>
</tr>
</table>
</fieldset>
</div>
</td>
<td width="15px">&nbsp;</td>
</tr>
</table>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="center">
<asp:UpdatePanel ID="UpGuardar" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar" class="btn btn-primary" />
<asp:Button ID="BtnEliminar" runat="server" Text="Eliminar" class="btn btn-danger" />
<input type="button" value="Cancelar" onclick="javascript: window.close();" class="btn btn-danger" />
<asp:ValidationSummary ID="VS" runat="server" DisplayMode="BulletList" ShowSummary="true" ValidationGroup="GrpGuardar" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script language="javascript" type="text/javascript">
function SetText(ObjFrom, ObjTo) {
ObjTo.innerText = ObjFrom.value;
}
function SetText2(ObjTo, Value) {
ObjTo.innerText = Value;
}
function getSelectedText(Obj, IfIsNull) {
if (Obj.selectedIndex == -1)
return IfIsNull;
else
return Obj.options[Obj.selectedIndex].text;
}
</script>
</asp:Content>

187
Planeacion/Sucursal.aspx.vb Normal file
View File

@@ -0,0 +1,187 @@
Option Explicit On
Option Strict On
Imports Extensiones
Imports System.Data
Partial Class Sucursal
Inherits ClsPaginas
Private ReadOnly Property CveSucursal As Integer
Get
Return ViewState("CveSucursal").ToString.ToEntero
End Get
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CType(Me.Master, BaseMasterPage).EsPopup = True
CType(Me.Master, BaseMasterPage).PopupWidth = 700
RegistraScript("$get('tdContenido').style.height='400px'")
If Request("CveSucursal") IsNot Nothing AndAlso IsNumeric(Request("CveSucursal")) AndAlso Request("CveSucursal").ToEntero > 0 Then
ViewState("CveSucursal") = Request("CveSucursal")
CargaDatos()
'Configuración de Modalidad Update
BtnGuardar.Text = "Guardar Cambios"
Else
'Configuración de Modalidad Insert
ViewState("CveSucursal") = -1
ChkEstado.Enabled = False
ChkEstado.Checked = True
LblFechaCaptura.Text = Now.ToShortDateString()
LblUsuarioCapturo.Text = UsuarioActual.Usuario
BtnEliminar.Visible = False
End If
End If
End Sub
Private Sub CargaDatos()
Dim DT As New DataTable
'GlobalDTSucursales.FiltraParametros("CveSucursal = " & CveSucursal)
If DT.Rows.Count > 0 Then
TxtSucursal.Text = DT.Rows(0)("Sucursal").ToString
TxtSerie.Text = DT.Rows(0)("Serie").ToString
TxtIVA.Text = DT.Rows(0)("IVA").ToString
TxtCalle.Text = DT.Rows(0)("Calle").ToString
TxtNoExt.Text = DT.Rows(0)("NoExt").ToString
TxtNoInt.Text = DT.Rows(0)("NoInt").ToString
TxtColonia.Text = DT.Rows(0)("Colonia").ToString
TxtLocalidad.Text = DT.Rows(0)("Localidad").ToString
TxtMunicipio.Text = DT.Rows(0)("Municipio").ToString
TxtEstado.Text = DT.Rows(0)("Estado").ToString
TxtPais.Text = DT.Rows(0)("Pais").ToString
TxtCP.Text = DT.Rows(0)("CP").ToString
'TxtCP.Text = DT.Rows(0)("CP").ToString
Session("FileUpload") = DT.Rows(0)("TipoSucursal").ToString
If DT.Rows(0)("TipoSucursal").ToString.ToEntero = 1 Then
Matriz.Checked = True
Else
Matriz.Checked = False
End If
If System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\Formatos\" & DT.Rows(0)("FormatoFactura").ToString) Then
'DirectCast("HLVer", HtmlLink). = "<a class=""Texto"" href=""/Empresas/" & UsuarioActual.CveEmpresa & "/Formatos/" & e.Row.DBCampo("FormatoFactura") & """>Ver</a>"
End If
ChkEstado.Checked = If(DT.Rows(0)("Estatus").ToString = "Activo", True, False)
LblFechaCaptura.Text = DT.Rows(0)("Fecha").ToString
LblUsuarioCapturo.Text = DT.Rows(0)("Usuario").ToString
Else
Alert("La Sucursal solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
BtnGuardar.Enabled = False
End If
If DT IsNot Nothing Then DT.Dispose()
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
If CveSucursal = -1 Then
If UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then
CreaProyectoSubProyectoSucursal()
Else
CreaSucursal()
End If
Else
Dim ObjSucursales As New ClsSucursales()
If ObjSucursales.UpdateSucursal(TxtSucursal.Text.Trim, TxtSerie.Text.Trim, TxtIVA.Text.Trim.ToDouble, Session("FileUpload").ToString, ChkEstado.Checked, UsuarioActual.CveUsuario, CveSucursal, TxtCalle.Text.Trim,
TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtLocalidad.Text.Trim, TxtMunicipio.Text.Trim, TxtEstado.Text.Trim, TxtPais.Text.Trim, TxtCP.Text.Trim, IIf(Matriz.Checked, 1, 0).ToString.ToEntero) Then
CargaDatos()
UpDatos.Update()
updateGlobaldt()
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "CerrarVentana(); window.parent.location.reload();")
Else
Alert("Ocurrió un error al guardar la Sucursal. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
ObjSucursales.Dispose()
End If
End Sub
Private Sub updateGlobaldt()
Dim ObjSucursales As New ClsSucursales()
If ObjSucursales.GetSucursales() Then Application("GlobalDTSucursales") = ObjSucursales.DtResultados Else Application("GlobalDTSucursales") = Nothing
ObjSucursales.Dispose()
End Sub
Private Sub CreaSucursal()
Dim ObjSucursales As New ClsSucursales()
If ObjSucursales.AddSucursal(TxtSucursal.Text.Trim, TxtSerie.Text.Trim, TxtIVA.Text.Trim.ToDouble, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtCalle.Text.Trim,
TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtLocalidad.Text.Trim, TxtMunicipio.Text.Trim, TxtEstado.Text.Trim, TxtPais.Text.Trim, TxtCP.Text.Trim, IIf(Matriz.Checked, 1, 0).ToString.ToEntero) > 0 Then
updateGlobaldt()
Alert("La Sucursal se guardó correctamente.", TipoMensaje.MsgInformacion, "CerrarVentana(); window.parent.location.reload();")
Else
Alert("Ocurrió un error al guardar la Sucursal. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
ObjSucursales.Dispose()
End Sub
Private Sub CreaProyectoSubProyectoSucursal()
Dim ObjProyectos As New ClsProyectos
Dim ObjSubproyectos As New ClsSubProyectos(ObjProyectos.IniciaTransacSQL())
Dim ObjSucursales As New ClsSucursales(ObjProyectos.IniciaTransacSQL())
Dim TieneError = False
'CREA PROYECTO
Dim CveProyecto = ObjProyectos.AddProyecto(TxtSucursal.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveSucursal.ToEntero)
If CInt(CveProyecto) > 0 Then
GlobalDTProyectos(-1) = ObjProyectos.DtResultados
Dim CveSucursal = ObjSucursales.AddSucursal(TxtSucursal.Text.Trim, TxtSerie.Text.Trim, TxtIVA.Text.Trim.ToDouble, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtCalle.Text.Trim,
TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtLocalidad.Text.Trim, TxtMunicipio.Text.Trim, TxtEstado.Text.Trim, TxtPais.Text.Trim, TxtCP.Text.Trim, IIf(Matriz.Checked, 1, 0).ToString.ToEntero)
'CREA SUCURSAL
If CveSucursal > 0 Then
'CREA SUBPROYECTO
If Not ObjSubproyectos.AddSubProyecto(CInt(CveProyecto), TxtSucursal.Text.Trim, 0, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveSucursal) Then
TieneError = True
End If
Else
TieneError = True
End If
Else
TieneError = True
End If
'se regeneran los subproyectos
If Not TieneError Then
If UsuarioActual.Empresa.GralSoloProyecto Then
If ObjSubproyectos.GetSubProyectos() Then
GlobalDTSubProyectos(-1) = ObjSubproyectos.DtResultados
Else
TieneError = True
End If
End If
End If
If Not TieneError Then
ObjProyectos.Commit()
Alert("La nueva Sucursal se guardó correctamente.", TipoMensaje.MsgInformacion, "opener.location.reload();window.close();")
Else
ObjProyectos.RollBack()
Alert("Ocurrió un error al registrar la Sucursal. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
ObjProyectos.Dispose()
End Sub
Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click
Dim ObjSucursal As New ClsSucursales()
If ObjSucursal.RemoveSucursal(CveSucursal) Then
Alert("La Sucursal se eliminó correctamente.", TipoMensaje.MsgInformacion, "opener.location.reload();window.close();")
End If
ObjSucursal.Dispose()
End Sub
End Class

View File

@@ -0,0 +1,95 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RegBoletas.aspx.vb" Inherits="Temporal_RegBoletas" %>
<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="E" Runat="Server">
Registro de boletas
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel ID="UpRegBoletas" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<div class="portlet light smmallpadding bordered ">
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom ">
<asp:UpdatePanel runat="server" ID="UpDatos" UpdateMode="Conditional">
<ContentTemplate>
<table border="0">
<tr>
<td>Boleta:</td>
<td>
<asp:TextBox ID="TxtBoleta" runat="server" CssClass="form-control input-sm" ValidationGroup="GrpGuardar"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros2" runat="server" TargetControlID="TxtBoleta" FilterType="Custom, Numbers" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtBoleta" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Boleta''</b> es necesario, por favor ingréselo." ValidationGroup="GrpRecibir"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator1" Width="350px"></ajax:ValidatorCalloutExtender>
</td>
<td>
<asp:LinkButton ID="LbAgregarBoleta" ValidationGroup="GrpRecibir" runat="server" CssClass="btn btn-circle btn-sm green" Text="+"></asp:LinkButton>
</td>
</tr>
<tr id="trConsejero" runat="server" visible="false">
<td>No. Consejero:</td>
<td>
<asp:TextBox ID="TxtConsejero" runat="server" CssClass="form-control input-sm" ValidationGroup="GrpGuardar"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros" runat="server" TargetControlID="TxtConsejero" FilterType="Custom, Numbers" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TxtConsejero" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''No. Consejero''</b> es necesario, por favor ingréselo." ValidationGroup="GrpRecibir"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator2" Width="350px"></ajax:ValidatorCalloutExtender>
</td>
<td>
<asp:LinkButton ID="LbAddConsejero" ValidationGroup="GrpGuardar" runat="server" CssClass="btn btn-circle btn-sm green" Text="+"></asp:LinkButton>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdatePanel runat="server" ID="UPGv" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView runat="server" Width="60%" DataKeyNames="NumBoleta, CveConsejero" EmptyDataText="Aún no se ha registrado boleta" AutoGenerateColumns="false" GridLines="none" ID="GVDatos" CssClass="table table-striped table-advance table-hover">
<Columns>
<asp:BoundField HeaderText="# Consejero" DataField="NumConsejero" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30%" />
<asp:BoundField HeaderText="Nombre" DataField="Nombre" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="70%" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Desea Elminar?" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
<script>
function ActivaBoleta(Boleta) {
if (Boleta != "") {
$("#trConsejero").css("visibility", "visible");
$("#C_TxtBoleta").attr('readonly', true);
}
}
</script>
</asp:Content>

View File

@@ -0,0 +1,111 @@
Option Strict On
Option Explicit On
Imports Extensiones
Imports System.Data
Partial Class Temporal_RegBoletas
Inherits ClsPaginas
#Region "P R O P I E D A D E S "
Public Property DTConsejeros As DataTable
Get
Return CType(ViewState("DTConsejeros"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTConsejeros") = value
End Set
End Property
Public Property NumBoleta As Integer
Get
Return CType(ViewState("NumBoleta"), Integer)
End Get
Set(value As Integer)
ViewState("NumBoleta") = value
End Set
End Property
Public Property VotosBoleta As Integer
Get
Return CType(ViewState("VotosBoleta"), Integer)
End Get
Set(value As Integer)
ViewState("VotosBoleta") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
VotosBoleta = 0
End If
End Sub
Protected Sub LbAddConsejero_Click(sender As Object, e As EventArgs) Handles LbAddConsejero.Click
Dim Boleta As New ClsTemporal
DTConsejeros = New DataTable()
Dim NumConsejero As Integer = TxtConsejero.Text.ToEntero
Dim CveConsejero As Integer
NumBoleta = TxtBoleta.Text.ToEntero
If Boleta.GetTempConsejeros Then
DTConsejeros = Boleta.DtResultados.FiltraParametros($"NumConsejero = {NumConsejero} ")
If DTConsejeros.Rows.Count > 0 Then
CveConsejero = DTConsejeros.Rows(0)("CveConsejero").ToString.ToEntero
If Boleta.AddTempVotos(CveConsejero, NumBoleta) Then
VotosBoleta += 1
Else
Alert("Ocurrió un error al agregar el voto", TipoMensaje.MsgError)
End If
Else
Alert("El consejero no existe, revise el número de consejero", TipoMensaje.MsgAdvertencia)
End If
End If
TxtConsejero.Text = ""
UpDatos.Update()
Boleta.Dispose()
CargaGrid()
End Sub
Private Sub CargaGrid()
Dim Boleta As New ClsTemporal
If Boleta.GetTempVotos(NumBoleta) AndAlso Boleta.DtResultados.Rows.Count > 0 Then
GVDatos.DataSource = Boleta.DtResultados
Else
GVDatos.DataSource = Nothing
End If
Boleta.Dispose()
GVDatos.DataBind()
UPGv.Update()
End Sub
Private Sub LbAgregarBoleta_Click(sender As Object, e As EventArgs) Handles LbAgregarBoleta.Click
If TxtBoleta.Text <> "" Then
TxtBoleta.Enabled = False
LbAgregarBoleta.Visible = False
trConsejero.Visible = True
End If
UpDatos.Update()
End Sub
Private Sub GVDatos_DataBound(sender As Object, e As EventArgs) Handles GVDatos.DataBound
If GVDatos.Rows.Count >= 25 Then
Alert("Esta boleta está completa, continue con otra boleta por favor.")
TxtBoleta.Text = ""
TxtBoleta.Enabled = True
LbAgregarBoleta.Visible = True
trConsejero.Visible = False
UpDatos.Update()
End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVDatos.RowDeleting
Dim Objeto As New ClsTemporal
If Objeto.RemoveTempVotos(GVDatos.Rows(e.RowIndex).DataKey("NumBoleta").ToEntero, GVDatos.Rows(e.RowIndex).DataKey("CveConsejero").ToEntero) Then
Alert("Se eliminó correctamente.")
End If
CargaGrid()
End Sub
End Class

Binary file not shown.