Implementacion de módulo de Exportación y Partidas

This commit is contained in:
SLopez
2025-06-26 11:59:56 -07:00
parent 0e6fa86ee5
commit 1305ad5572
7 changed files with 2517 additions and 6 deletions

810
Export/ExpDetalle.aspx Normal file
View File

@@ -0,0 +1,810 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ExpDetalle.aspx.cs" Inherits="Export_ExpDetalle" %>
<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">
Exportación:
<asp:Label runat="server" Text="Exportación" ID="LblExp"></asp:Label>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
<li id="liImprimir" runat="server">
<asp:LinkButton ID="LBImprimir" runat="server" OnClick="LBImprimir_Click"><i style="font-weight:bold" class="fa fa-file-pdf-o"></i> Exportar PDF</asp:LinkButton>
</li>
</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">
<div class="whitoutcol" style="width: 100%;">
<div class="portlet light xspadding bordered" style="width: 100%; padding-left: 7px">
<asp:UpdatePanel ID="UpFactura" runat="server">
<ContentTemplate>
<div style="display: flex; align-items: center; gap: 10px; width: 100%;">
<div class="form-group form-md-line-input input-iconright" style="width: 200px;">
<asp:DropDownList ID="DdlVentas" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="Folio" DataValueField="CveVenta" AutoPostBack="true" OnSelectedIndexChanged="DdlVentas_SelectedIndexChanged"></asp:DropDownList>
<label for="<%= DdlVentas.ClientID.ToString()%>">Número de Factura:</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="width: 150px;">
<asp:TextBox ID="TxtFechaFact" CssClass="form-control" runat="server" MaxLength="50" ReadOnly="true" Enabled="false"></asp:TextBox>
<ajax:MaskedEditExtender ID="MEEFechaFact" runat="server" TargetControlID="TxtFechaFact" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<label for="<%= TxtFechaFact.ClientID.ToString()%>">Fecha de Factura:</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="width: 180px;">
<asp:DropDownList ID="DdlTipoExp" runat="server" CssClass="select2me form-control">
<asp:ListItem Value="-1" Text="Seleccione" Selected="True" />
<asp:ListItem Value="1" Text="(IMP) Importación" />
<asp:ListItem Value="2" Text="(EXP) Exportación/retorno" />
<asp:ListItem Value="3" Text="(TRA) Tránsitos" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTipoExp" runat="server" ControlToValidate="DdlTipoExp" Display="None" InitialValue="-1" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Exportación''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETipoExp" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipoExp" Width="350px"></ajax:ValidatorCalloutExtender>
<label for="<%= DdlTipoExp.ClientID.ToString()%>">Tipo Exportación:</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="width: 180px; margin-bottom: 5px;">
<asp:DropDownList ID="DdlExpEstatus" runat="server" CssClass="select2me form-control">
<asp:ListItem Value="-1" Text="Seleccione" Selected="True" />
<asp:ListItem Value="1" Text="Tránsito" />
<asp:ListItem Value="2" Text="Completa" />
</asp:DropDownList>
<label for="<%= DdlExpEstatus.ClientID.ToString()%>">Estatus:</label>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DdlVentas" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<div style="display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px;">
<div class="form-group form-md-line-input input-iconright" style="width: 200px;">
<asp:DropDownList ID="DdlClavePedimento" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="ClaveSATPedimentoDescripcion" DataValueField="CvePedimento"></asp:DropDownList>
<label for="<%= DdlClavePedimento.ClientID.ToString()%>">Clave pedimento:</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="width: 150px;">
<asp:TextBox ID="TxtNumPed" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender ID="meeTxtPedimento" runat="server"
ClearMaskOnLostFocus="false"
TargetControlID="TxtNumPed"
Mask="99--99--9999--9999999"
MaskType="Number"
InputDirection="LeftToRight"
AcceptNegative="None"
ErrorTooltipEnabled="True" />
<label for="<%= TxtNumPed.ClientID.ToString()%>" style="margin: 0; white-space: nowrap;">Número de Pedimento:</label>
</div>
<table>
<tr>
<td align="Center" style="width: 100px">Fecha de Pedimento:</td>
<td align="left" style="width: 100px">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:TextBox ID="TxtFechaPedim" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" ValidationGroup="GrpGuardar" Width="100px" ClientIDMode="Static"></asp:TextBox>
<ajax:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TxtFechaPedim" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaPedim" TargetControlID="TxtFechaPedim" PopupButtonID="ImgFechaPedim" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaPedim" runat="server" ControlToValidate="TxtFechaPedim" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Pedimento''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaPedim" runat="server" ControlToValidate="TxtFechaPedim" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Pedimento''</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="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaPedim" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaPedim" Width="350px"></ajax:ValidatorCalloutExtender>
</ContentTemplate>
</asp:UpdatePanel>
<span class="input-group-btn ">
<asp:LinkButton runat="server" ID="ImgFechaPedim" class="btn default"> <i class="fa fa-calendar"></i> </asp:LinkButton>
</span>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding-top: 20px;">
<tr>
<td align="left">
<ajax:TabContainer ID="Tab" runat="server" Width="100%">
<ajax:TabPanel ID="TabFactura" runat="server" HeaderText="Factura">
<ContentTemplate>
<div class="portlet light xspadding bordered" style="width: 350px;">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Pedimento</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body" style="display: flex; align-items: center; gap: 10px; width: 100%;">
<div class="form-group form-md-line-input input-iconright" style="width: 150px;">
<asp:TextBox ID="TxtTipoCambio" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTETipoCambio" runat="server" TargetControlID="TxtTipoCambio" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtTipoCambio.ClientID.ToString()%>">Tipo de Cambio:</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="width: 150px;">
<asp:DropDownList ID="DdlIncoterm" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="ClaveSATIncotermDescripcion" DataValueField="CveIncoterm"></asp:DropDownList>
<label for="<%= DdlIncoterm.ClientID.ToString()%>">Incoterm:</label>
</div>
</div>
</div>
<ajax:TabContainer runat="server" Width="100%">
<ajax:TabPanel ID="TabCliente" runat="server" HeaderText="Cliente">
<ContentTemplate>
<asp:UpdatePanel ID="UpCliente" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row" style="margin-left: 0px; margin-right: 0px;">
<div class="whitoutcol" style="width: 49%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Cliente</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" class="col-sm-4" Text="Nombre Exportador:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlExp" Width="100%" data-metodo="getproveedores" UsaWebService="true" runat="server" DataTextField="RazonSocial" DataValueField="CveProveedor" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Nombre Importador:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlImp" Width="100%" data-metodo="getproveedores" UsaWebService="true" runat="server" DataTextField="RazonSocial" DataValueField="CveProveedor" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Nombre Consignatario:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlCon" Width="100%" data-metodo="getproveedores" UsaWebService="true" runat="server" DataTextField="RazonSocial" DataValueField="CveProveedor" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
</div>
</div>
</div>
<div class="whitoutcol" style="width: 49%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Dirección</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Clave Dir. Exportador:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlDirExp" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="Direccion" DataValueField="CveProveedorSucursal"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDirExp" runat="server" ControlToValidate="DdlDirExp" Display="None" InitialValue="-1" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Clave Dir. Exportador''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDirExp" runat="server" HighlightCssClass="vco" TargetControlID="RFVDirExp" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Clave Dir. Consignatario:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlDirCon" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="Direccion" DataValueField="CveProveedorSucursal"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDirCon" runat="server" ControlToValidate="DdlDirCon" Display="None" InitialValue="-1" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Clave Dir. Consignatario''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDirCon" runat="server" HighlightCssClass="vco" TargetControlID="RFVDirCon" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabAgentes" runat="server" HeaderText="Agentes">
<ContentTemplate>
<asp:UpdatePanel ID="UpAgentes" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row" style="margin-left: 0px; margin-right: 0px;">
<div class="whitoutcol" style="width: 49%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Agentes Aduanales</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Agente A. Mexicano:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlAgenteMex" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="Agente" DataValueField="CveAgente" AutoPostBack="true" OnSelectedIndexChanged="DdlAgenteMex_SelectedIndexChanged"></asp:DropDownList>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Agente A. Extranjero:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlAgenteExt" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="Agente" DataValueField="CveAgente" AutoPostBack="true" OnSelectedIndexChanged="DdlAgenteExt_SelectedIndexChanged"></asp:DropDownList>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Clave Aduana:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlClaveAduana" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="ClaveSATAduanaSeccionDescripcion" DataValueField="CveSATAduanaSeccion"></asp:DropDownList>
</div>
</div>
</div>
</div>
</div>
<div class="whitoutcol" style="width: 49%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Patentes</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-2" Text="Patente:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:TextBox ID="TxtPatente" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text="" ReadOnly="true" Enabled="false"></asp:TextBox>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-2" Text="Tax I.D.:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:TextBox ID="TxtTaxId" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text="" ReadOnly="true" Enabled="false"></asp:TextBox>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DdlAgenteMex" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="DdlAgenteExt" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabTransportista" runat="server" HeaderText="Transportista">
<ContentTemplate>
<asp:UpdatePanel ID="UpTransportista" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row" style="margin-left: 0px; margin-right: 0px;">
<div class="whitoutcol" style="width: 49%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Vehículos</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Descripción Contenedor:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlDescContenedor" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="" DataValueField=""></asp:DropDownList>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Compañía Transportista:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 300px;">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlCompTransportista" Width="100%" data-metodo="getproveedores" UsaWebService="true" runat="server" DataTextField="RazonSocial" DataValueField="CveProveedor" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="Placa:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 300px;">
<asp:TextBox ID="TxtPlaca" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<label for="<%= TxtPlaca.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="SCAC:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 300px;">
<asp:TextBox ID="TxtSCAC" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<label for="<%= TxtSCAC.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-4" Text="CAAT:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 300px;">
<asp:TextBox ID="TxtCAAT" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<label for="<%= TxtCAAT.ClientID.ToString()%>"></label>
</div>
</div>
</div>
</div>
</div>
<div class="whitoutcol" style="width: 49%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Otros</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Medio Transporte:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlMedioTran" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="ClaveSATMedioTransporteDescripcion" DataValueField="CveMedioTransporte"></asp:DropDownList>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Tipo Contenedor:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 300px;">
<asp:DropDownList ID="DdlTipoContenedor" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="ClaveSATContenedorDescripcion" DataValueField="CveContenedorVehiculo"></asp:DropDownList>
</div>
</div>
<hr style="margin: 18px 8px 15px 0px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Sello 1:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 300px;">
<asp:TextBox ID="TxtSello1" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<label for="<%= TxtSello1.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Sello 2:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 300px;">
<asp:TextBox ID="TxtSello2" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<label for="<%= TxtSello2.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Sello 3:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 300px;">
<asp:TextBox ID="TxtSello3" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<label for="<%= TxtSello3.ClientID.ToString()%>"></label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-left: 0px; margin-right: 0px;">
<div class="whitoutcol" style="width: 49%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Flete</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<div class="col-md-6">
<div class="whitoutcol" style="width: 100%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Incrementables</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Transp.:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize col-md-6" style="width: 100%;">
<asp:TextBox ID="TxtIncFletes" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEIncFletes" runat="server" TargetControlID="TxtIncFletes" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtIncFletes.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Seguros:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtIncSeguro" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEIncSeguro" runat="server" TargetControlID="TxtIncSeguro" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtIncSeguro.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Embalaje:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtIncEmbalajes" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEIncEmbalajes" runat="server" TargetControlID="TxtIncEmbalajes" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtIncEmbalajes.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Costo Envases:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtIncEmbalaje" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEIncEmbalaje" runat="server" TargetControlID="TxtIncEmbalaje" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtIncEmbalaje.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Conexos:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtIncConexos" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEIncConexos" runat="server" TargetControlID="TxtIncConexos" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtIncConexos.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Total:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 100%;">
<asp:TextBox ID="TxtTotalInc" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text="" ReadOnly="true" Enabled="false"></asp:TextBox>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="whitoutcol" style="width: 100%;">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Decrementables</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-left:8px">
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Transp.:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtDecFlete" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEDecFlete" runat="server" TargetControlID="TxtDecFlete" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtDecFlete.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Seguros:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtDecSeguro" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEDecSeguro" runat="server" TargetControlID="TxtDecSeguro" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtDecSeguro.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Carga:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtDecCarga" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEDecCarga" runat="server" TargetControlID="TxtDecCarga" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtDecCarga.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Gastos Descarga:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtDecDescarga" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEDecDescarga" runat="server" TargetControlID="TxtDecDescarga" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtDecDescarga.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Otros Gastos:"></asp:Label>
<div class="form-group form-md-line-input linewhitsize" style="width: 100%;">
<asp:TextBox ID="TxtDecOtros" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text=""></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEDecOtros" runat="server" TargetControlID="TxtDecOtros" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtDecOtros.ClientID.ToString()%>"></label>
</div>
</div>
<div class="form-group row" style="width: 100%;">
<asp:Label runat="server" CssClass="col-sm-3" Text="Total:"></asp:Label>
<div class="whitoutcol whitoutcol" style="width: 100%;">
<asp:TextBox ID="TxtTotalDec" runat="server" CssClass="form-control input-sm" MaxLength="300" Width="100%" Text="" ReadOnly="true" Enabled="false"></asp:TextBox>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabNotas" runat="server" HeaderText="Notas">
<ContentTemplate>
<table border="0" width="100%">
<tr align="left">
<td>Notas: &nbsp;</td>
</tr>
<tr align="left">
<td>
<asp:TextBox ID="TxtNotas" runat="server" Rows="4" TextMode="MultiLine" Width="100%"></asp:TextBox></td>
</tr>
</table>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabPartidas" runat="server" HeaderText="Partidas">
<ContentTemplate>
<asp:UpdatePanel ID="UpPartidas" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button runat="server" ID="BtnAgregarPartida" OnClick="BtnAgregarPartida_Click" Text="Agregar Partida" CssClass="btn btn-primary" style="margin-top: 5px;" />
<br />
<br />
<asp:GridView ID="GVPartidas" runat="server" data-sort="true" AutoGenerateColumns="False" DataKeyNames="CveExportacionDetalle" OnRowCommand="GVPartidas_RowCommand" ShowFooter="true" OnRowDataBound="GVPartidas_RowDataBound" Width="100%" EmptyDataText="No se encontraron Partidas" ToolTip="Partidas" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None">
<Columns>
<%--asp:TemplateField HeaderText="Id" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:LinkButton ID="LnkExpDetalle" runat="server" Text='<%# Eval("CveExportacionDetalle") %>' CommandName="EditarPartida" CommandArgument='<%# Eval("CveExportacionDetalle") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField--%>
<asp:TemplateField HeaderText="Producto / Servicio" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblPS" runat="server" Text='<%# Eval("PSCodigo")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="País de Origen" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblPaisOrigen" runat="server" Text='<%# Eval("ClaveSATPais")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unidad de Medida" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblUM" runat="server" Text='<%# Eval("UnidadMedida")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Valor Total USD" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblPrecio" runat="server" Text='<%# Eval("Precio", "{0:#,###.####}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Valor Total MXP" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblValorTotalMXP" runat="server" Text='<%# Eval("ValorTotalMXP", "{0:#,###.####}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total de Empaque" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblTotalEmpaque" runat="server" Text='<%# Eval("Cantidad", "{0:#,###.####}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fracción Arancelaria" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblFraccAran" runat="server" Text='<%# Eval("FraccionArancelaria")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unidad Aduana" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblUnidadAduana" runat="server" Text='<%# Eval("UnidadAduana")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cantidad Exportada" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblCantidad" runat="server" Text='<%# Eval("Cantidad", "{0:#,###.####}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Peso Unit. KG" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblPesoUnitario" runat="server" Text='<%# Eval("PesoUnitario", "{0:#,###.####}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Peso Bruto" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblPesoBruto" runat="server" Text='<%# Eval("PesoBruto", "{0:#,###.####}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Editar" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<ItemTemplate>
<asp:LinkButton data-toggle="tooltip" title="Editar" ID="LnkEditarPartida" CommandName="EditarPartida" CommandArgument='<%# Eval("CveExportacionDetalle") %>' CssClass="btn btn-circle btn-sm green" runat="server" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<ItemTemplate>
<asp:LinkButton ID="LnkEliminarPartida" runat="server" CommandName="EliminarPartida" CommandArgument='<%# Eval("CveExportacionDetalle") %>' CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar la Partida?" data-btn-ok-label="Sí" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
<br />
<table width="100%">
<tr>
<td align="center">
<asp:Button runat="server" ID="BtnGuardar" OnClick="BtnExpGuardar_Click" Text="Guardar" CssClass="btn btn-primary" ValidationGroup="GrpGuardar" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="DModalPartida" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpPSS" class="modal-dialog" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<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="H1" runat="server">Agregar Partida</h4>
</div>
<div id="DVBodyAddProducto" style="overflow: auto!important">
<div class="modal-body">
<asp:UpdatePanel ID="UpBodyAddProducto" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPPClasificacion" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlPS" runat="server" CssClass=" form-control input-sm select2me" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="DdlPS_SelectedIndexChanged" DataTextField="PSCodigo" DataValueField="CvePS" Width="100%" ValidationGroup="GprAgregaPS"></asp:DropDownList></td>
<label for="<%= DdlPS.ClientID.ToString()%>">Productos / Servicio:</label>
<asp:RequiredFieldValidator ID="RFVDdlPS" runat="server" ControlToValidate="DdlPS" Display="None" InitialValue="-1" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Productos / Servicio''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDdlPS" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlPS" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DdlPS" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPPUM" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlUM" runat="server" CssClass=" form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Width="100"></asp:DropDownList></td>
<label for="<%= DdlUM.ClientID.ToString()%>">Unidad de Medida:</label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlPaisOrigen" runat="server" CssClass=" form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="ClaveSATPais" DataValueField="CvePais" Width="100"></asp:DropDownList></td>
<label for="<%= DdlPaisOrigen.ClientID.ToString()%>">País de Origen:</label>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecio" ClientIDMode="Static" runat="server" CssClass=" form-control " CausesValidation="true" MaxLength="12" ValidationGroup="GprAgregaPS"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumerosTxtPrecio" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtPrecio.ClientID.ToString()%>">Valor Total USD:</label>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCantidad" ClientIDMode="Static" runat="server" CssClass=" form-control " CausesValidation="true" MaxLength="12" ValidationGroup="GprAgregaPS"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTECantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtCantidad.ClientID.ToString()%>">Cantidad Exportada:</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPesoUnitario" ClientIDMode="Static" runat="server" CssClass=" form-control " CausesValidation="true" MaxLength="12" ValidationGroup="GprAgregaPS"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEPesoUnitario" runat="server" TargetControlID="TxtPesoUnitario" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtPesoUnitario.ClientID.ToString()%>">Peso Unitario KG:</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright" align="right" id="DivAgregarOtraPartida" runat="server">
<label>Continuar agregando:</label>
<asp:CheckBox ID="ChkSeguirAgregandoPartidas" runat="server" Checked="true" />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="modal-footer">
<asp:UpdatePanel ID="UpAddProductoBotones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:Button ID="BtnPartidaGuardar" OnClick="BtnPartidaGuardar_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="GprAgregaPS" />
<asp:Button ID="BtnPartidaActualizar" OnClick="BtnPartidaGuardar_Click" runat="server" Text="Actualizar" CssClass="btn btn-primary" ValidationGroup="GprAgregaPS" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

941
Export/ExpDetalle.aspx.cs Normal file
View File

@@ -0,0 +1,941 @@
using ADSNetLibrary.Helpers;
using CrystalDecisions.ReportAppServer.DataDefModel;
//using DocumentFormat.OpenXml.Wordprocessing;
using Extensiones;
using HigLabo.Core;
using Profact.TimbraCFDI;
using Profact.TimbraCFDI.Complementos.ComercioExterior10;
using StackExchange.Redis;
using System;
using System.Activities;
using System.Activities.Expressions;
using System.Activities.Statements;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ModExtensiones = Extensiones.ModExtensiones;
public partial class Export_ExpDetalle : ClsPaginas
{
#region Propiedades
private int CveExportacion
{
get { return (ViewState["CveExportacion"] == null) ? -1 : Convert.ToInt32(ViewState["CveExportacion"]); }
set { ViewState["CveExportacion"] = value; }
}
private int CveExportacionDetalle
{
get { return (ViewState["CveExportacionDetalle"] == null) ? -1 : Convert.ToInt32(ViewState["CveExportacionDetalle"]); }
set { ViewState["CveExportacionDetalle"] = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CveExportacion = !string.IsNullOrEmpty(Request["CveExportacion"]) ? Request["CveExportacion"].ToEntero() : -1;
InicializarValores();
CargaDatos();
}
else
{
ActualizarValores();
}
}
protected void InicializarValores()
{
int CveEmpresa = UsuarioActual.CveEmpresa;
// Factura
ClsVentas Ventas = new ClsVentas();
// El problema es que solo se obtienen los registros donde CveUsuarioConsulta = Sis_UsuariosSubProyectos.CveUsuario en la BD
if (Ventas.GetVentas(CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -1, -1, DateTime.Today.AddMonths(-1).ToString(), ModExtensiones.MaxFecha.ToString(), "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario))
{
DdlVentas.Items.Clear();
DdlVentas.DataSource = Ventas.DtResultados;
DdlVentas.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlVentas.DataBind();
}
Ventas.Dispose();
// Fecha de Factura
//TxtFechaFact.Text = DateTime.Today.ToString();
// Clave Pedimento
DdlClavePedimento.Items.Clear();
DdlClavePedimento.DataSource = GlobalDTClavePedimento;
DdlClavePedimento.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlClavePedimento.DataBind();
// Incoterm
DdlIncoterm.Items.Clear();
DdlIncoterm.DataSource = GlobalDTIncoterm;
DdlIncoterm.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlIncoterm.DataBind();
// Agente A. Mexicano
DdlAgenteMex.Items.Clear();
DdlAgenteMex.DataSource = get_GlobalDTGralAgentes(-1, CveEmpresa);
DdlAgenteMex.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlAgenteMex.DataBind();
// Agente A. Extranjero
DdlAgenteExt.Items.Clear();
DdlAgenteExt.DataSource = get_GlobalDTGralAgentes(-1, CveEmpresa);
DdlAgenteExt.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlAgenteExt.DataBind();
// Clave Aduana
DdlClaveAduana.Items.Clear();
DdlClaveAduana.DataSource = GlobalDTSATAduanasSeccion;
DdlClaveAduana.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlClaveAduana.DataBind();
// Medio Transporte
DdlMedioTran.Items.Clear();
DdlMedioTran.DataSource = GlobalDTSATMediosTransporte;
DdlMedioTran.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlMedioTran.DataBind();
// Tipo Contenedor
DdlTipoContenedor.Items.Clear();
DdlTipoContenedor.DataSource = GlobalDTSATContenedores;
DdlTipoContenedor.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlTipoContenedor.DataBind();
}
protected void CargaDatos()
{
if (CveExportacion != -1)
{
DataTable DTExportaciones = new DataTable();
ClsExportaciones Exportaciones = new ClsExportaciones();
if (Exportaciones.GetExportacion(CveExportacion, UsuarioActual.CveEmpresa))
{
DTExportaciones = Exportaciones.DtResultados;
if (DTExportaciones.Rows.Count > 0)
{
LblExp.Text = DTExportaciones.FiltroPrimeroValor("CveExportacion");
string CveVenta = Exportaciones.DtResultados.FiltroPrimeroValor("CveVenta");
if (CveVenta != "" && CveVenta != "-1")
{
if (DdlVentas.Items.FindByValue(CveVenta) == null)
{
string Folio = Exportaciones.DtResultados.FiltroPrimeroValor("SerieFolio");
DdlVentas.Items.Insert(1, new ListItem(Folio, CveVenta));
}
DdlVentas.SelectedValue = CveVenta;
TxtFechaFact.Text = DTExportaciones.FiltroPrimeroValor("FechaFact");
}
//TxtNumFact.Text = DTExportaciones.FiltroPrimeroValor("SerieFolio");
DdlTipoExp.SelectedValue = DTExportaciones.FiltroPrimeroValor("TipoExportacion");
DdlClavePedimento.SelectedValue = DTExportaciones.FiltroPrimeroValor("CvePedimento");
TxtNumPed.Text = DTExportaciones.FiltroPrimeroValor("NumeroPedimento");
TxtFechaPedim.Text = DTExportaciones.FiltroPrimeroValor("FechaPedimento");
DdlExpEstatus.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveExportacionEstatus");
TxtTipoCambio.Text = DTExportaciones.FiltroPrimeroValor("TipoCambio");
DdlIncoterm.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveIncoterm");
DdlExp.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveClienteExportador");
DdlExp.SelectedText = DTExportaciones.FiltroPrimeroValor("ClienteExportador");
DdlImp.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveClienteImportador");
DdlImp.SelectedText = DTExportaciones.FiltroPrimeroValor("ClienteImportador");
DdlCon.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveClienteConsignatario");
DdlCon.SelectedText = DTExportaciones.FiltroPrimeroValor("ClienteConsignatario");
DdlAgenteMex.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveAgente");
DdlAgenteExt.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveAgenteExtranjero");
DdlClaveAduana.SelectedValue = DTExportaciones.FiltroPrimeroValor("ClaveAduana");
DdlCompTransportista.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveProveedor");
DdlCompTransportista.SelectedText = DTExportaciones.FiltroPrimeroValor("Proveedor");
TxtPlaca.Text = DTExportaciones.FiltroPrimeroValor("ContenedorPlaca");
TxtSCAC.Text = DTExportaciones.FiltroPrimeroValor("SCAC");
TxtCAAT.Text = DTExportaciones.FiltroPrimeroValor("CAAT");
DdlMedioTran.SelectedValue = DTExportaciones.FiltroPrimeroValor("MedioTransporte");
DdlTipoContenedor.SelectedValue = DTExportaciones.FiltroPrimeroValor("TipoContenedor");
TxtSello1.Text = DTExportaciones.FiltroPrimeroValor("Sello1");
TxtSello2.Text = DTExportaciones.FiltroPrimeroValor("Sello2");
TxtSello3.Text = DTExportaciones.FiltroPrimeroValor("Sello3");
ClsExportaciones Gastos = new ClsExportaciones();
if (Gastos.GetGastos(CveExportacion))
{
DataTable DTGastos = Gastos.DtResultados;
if (DTGastos.Rows.Count > 0)
{
TxtIncFletes.Text = DTGastos.FiltroPrimeroValor("IncFletes");
TxtIncSeguro.Text = DTGastos.FiltroPrimeroValor("IncSeguro");
TxtIncEmbalajes.Text = DTGastos.FiltroPrimeroValor("IncEmbalajes");
TxtIncEmbalaje.Text = DTGastos.FiltroPrimeroValor("IncEmbalaje");
TxtIncConexos.Text = DTGastos.FiltroPrimeroValor("IncConexos");
TxtDecFlete.Text = DTGastos.FiltroPrimeroValor("DecFlete");
TxtDecSeguro.Text = DTGastos.FiltroPrimeroValor("DecSeguro");
TxtDecCarga.Text = DTGastos.FiltroPrimeroValor("DecCarga");
TxtDecDescarga.Text = DTGastos.FiltroPrimeroValor("DecDescarga");
TxtDecOtros.Text = DTGastos.FiltroPrimeroValor("DecOtros");
}
}
Gastos.Dispose();
TxtNotas.Text = DTExportaciones.FiltroPrimeroValor("Notas");
ActualizarValores(); // Se actualizan los valores que dependen de otros campos
DdlDirExp.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveDirExportador"); // Seleccionar las Dir DESPUÉS de llenar el dropdown
DdlDirCon.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveDirConsignatario");
CargarPartidas();
}
}
Exportaciones.Dispose();
}
else
{
liImprimir.Visible = false;
}
}
protected void ActualizarValores()
{
int CveEmpresa = UsuarioActual.CveEmpresa;
// Factura
if (IsPostBack)
{
ClsVentas Ventas = new ClsVentas();
string CveVenta = DdlVentas.Text;
string SerieFolio = DdlVentas.SelectedItem.Text;
string Serie = "-1";
string Folio = "-1";
if (CveVenta != "" && CveVenta != "-1")
{
if (SerieFolio.Contains("-"))
{
var partes = SerieFolio.Split('-');
Serie = partes[0];
Folio = partes[1];
}
else
{
Folio = SerieFolio;
}
if (Ventas.GetVentas(CveEmpresa, "-1", Serie, Folio.ToEntero(), "-1", -1, -1, -1, -1, ModExtensiones.MinFecha.ToString(), ModExtensiones.MaxFecha.ToString(), "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario))
{
TxtFechaFact.Text = Ventas.DtResultados.FiltroPrimeroValor("Fecha"); ;
}
Ventas.Dispose();
}
else
{
TxtFechaFact.Text = "";
}
}
// Clave Dir. Exportador
string CveExportador = DdlExp.SelectedValue;
if (CveExportador != "" && CveExportador != "-1")
{
string CveDirExp = DdlDirExp.Text;
DdlDirExp.Items.Clear();
DdlDirExp.DataSource = get_GlobalDTProveedorSucursales(CveExportador.ToEntero(), CveEmpresa);
DdlDirExp.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlDirExp.DataBind();
if (CveDirExp != "" && CveDirExp != "-1")
{
ListItem ItemDirExp = DdlDirExp.Items.FindByValue(CveDirExp);
if (ItemDirExp != null)
DdlDirExp.SelectedValue = CveDirExp;
}
}
// Clave Dir. Consignatario
string CveConsignatario = DdlCon.SelectedValue;
if (CveConsignatario != "" && CveConsignatario != "-1")
{
string CveDirCon = DdlDirCon.Text;
DdlDirCon.Items.Clear();
DdlDirCon.DataSource = get_GlobalDTProveedorSucursales(CveConsignatario.ToEntero(), CveEmpresa);
DdlDirCon.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlDirCon.DataBind();
if (CveDirCon != "" && CveDirCon != "-1")
{
ListItem ItemDirCon = DdlDirCon.Items.FindByValue(CveDirCon);
if (ItemDirCon != null)
DdlDirCon.SelectedValue = CveDirCon;
}
}
// Agentes Aduanales
ClsExportaciones Exportaciones = new ClsExportaciones();
string CveAgenteMx = DdlAgenteMex.Text;
string CveAgenteExt = DdlAgenteExt.Text;
if (CveAgenteMx != "" && CveAgenteMx != "-1")
{
if (Exportaciones.GetAgentes(CveAgenteMx.ToEntero(), CveEmpresa))
{
TxtPatente.Text = Exportaciones.DtResultados.FiltroPrimeroValor("Cedula");
}
Exportaciones.Dispose();
}
else
{
TxtPatente.Text = "";
}
if (CveAgenteExt != "" && CveAgenteExt != "-1")
{
if (Exportaciones.GetAgentes(CveAgenteExt.ToEntero(), CveEmpresa))
{
TxtTaxId.Text = Exportaciones.DtResultados.FiltroPrimeroValor("Cedula");
}
Exportaciones.Dispose();
}
else
{
TxtTaxId.Text = "";
}
// Incrementables y Decrementables
decimal TotalInc = ModExtensiones.ToDecimal(TxtIncFletes.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtIncSeguro.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtIncEmbalajes.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtIncEmbalaje.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtIncConexos.Text.Replace(",", "").Trim());
TxtTotalInc.Text = TotalInc.ToString("#,###.####");
decimal TotalDec = ModExtensiones.ToDecimal(TxtDecFlete.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtDecSeguro.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtDecCarga.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtDecDescarga.Text.Replace(",", "").Trim()) +
ModExtensiones.ToDecimal(TxtDecOtros.Text.Replace(",", "").Trim());
TxtTotalDec.Text = TotalDec.ToString("#,###.####");
}
protected void BtnExpGuardar_Click(object sender, EventArgs e)
{
string CveClienteExportador = DdlExp.SelectedValue;
string CveClienteImportador = DdlImp.SelectedValue;
string CveClienteConsignatario = DdlCon.SelectedValue;
if (string.IsNullOrEmpty(CveClienteExportador) || string.IsNullOrEmpty(CveClienteImportador) || string.IsNullOrEmpty(CveClienteConsignatario) ||
CveClienteExportador == "-1" || CveClienteImportador == "-1" || CveClienteConsignatario == "-1")
{
Alert("Debe seleccionar un Exportador, Importador y un Consignatario.", ModExtensiones.TipoMensaje.MsgAdvertencia);
return;
}
string NumeroPedimento = TxtNumPed.Text;
DateTime FechaPedimento = TxtFechaPedim.Text.ToDate();
int CveVenta = DdlVentas.Text.ToEntero();
decimal TipoCambio = ModExtensiones.ToDecimal(TxtTipoCambio.Text);
int TipoExportacion = DdlTipoExp.Text.ToEntero();
int CveExportacionEstatus = DdlExpEstatus.Text.ToEntero();
int CveAgente = DdlAgenteMex.Text.ToEntero();
int ClaveAduana = DdlClaveAduana.Text.ToEntero();
int CveProveedor = DdlCompTransportista.SelectedValue.ToEntero();
int MedioTransporte = DdlMedioTran.Text.ToEntero();
int TipoContenedor = DdlTipoContenedor.Text.ToEntero();
string Sello1 = TxtSello1.Text;
string Sello2 = TxtSello2.Text;
string Sello3 = TxtSello3.Text;
string SCAC = TxtSCAC.Text;
string CAAT = TxtCAAT.Text;
string ContenedorPlaca = TxtPlaca.Text;
int CveEmpresa = UsuarioActual.CveEmpresa;
int CveUsuario = UsuarioActual.CveUsuario;
int CveDirExportador = DdlDirExp.Text.ToEntero();
int CveDirConsignatario = DdlDirCon.Text.ToEntero();
int CveIncoterm = DdlIncoterm.Text.ToEntero();
string Notas = TxtNotas.Text;
int CvePedimento = DdlClavePedimento.Text.ToEntero();
int CveAgenteExtranjero = DdlAgenteExt.Text.ToEntero();
decimal IncFletes = ModExtensiones.ToDecimal(TxtIncFletes.Text);
decimal IncSeguro = ModExtensiones.ToDecimal(TxtIncSeguro.Text);
decimal IncEmbalajes = ModExtensiones.ToDecimal(TxtIncEmbalajes.Text);
decimal IncEmbalaje = ModExtensiones.ToDecimal(TxtIncEmbalaje.Text);
decimal IncConexos = ModExtensiones.ToDecimal(TxtIncConexos.Text);
decimal DecFlete = ModExtensiones.ToDecimal(TxtDecFlete.Text);
decimal DecSeguro = ModExtensiones.ToDecimal(TxtDecSeguro.Text);
decimal DecCarga = ModExtensiones.ToDecimal(TxtDecCarga.Text);
decimal DecDescarga = ModExtensiones.ToDecimal(TxtDecDescarga.Text);
decimal DecOtros = ModExtensiones.ToDecimal(TxtDecOtros.Text);
ClsExportaciones Exportaciones = new ClsExportaciones();
if (CveExportacion == -1)
{
int ExportacionGuardada = Exportaciones.AddExportacion(
NumeroPedimento,
FechaPedimento,
CveVenta,
TipoCambio,
TipoExportacion,
CveExportacionEstatus,
CveClienteExportador.ToEntero(),
CveClienteImportador.ToEntero(),
CveClienteConsignatario.ToEntero(),
CveAgente,
ClaveAduana,
CveProveedor,
MedioTransporte,
TipoContenedor,
Sello1,
Sello2,
Sello3,
SCAC,
CAAT,
ContenedorPlaca,
CveEmpresa,
CveUsuario,
CveDirExportador,
CveDirConsignatario,
CveIncoterm,
Notas,
CvePedimento,
CveAgenteExtranjero
);
if (ExportacionGuardada != -1)
{
Exportaciones.AddGastos(
IncFletes,
IncSeguro,
IncEmbalajes,
IncEmbalaje,
IncConexos,
DecFlete,
DecSeguro,
DecCarga,
DecDescarga,
DecOtros,
ExportacionGuardada
);
// AQUÍ SE VAN A GUARDAR LAS PARTIDAS TEMPORALES
DataTable DTPartidas = ViewState["Partidas"] as DataTable;
if (DTPartidas != null)
{
foreach (DataRow row in DTPartidas.Rows)
{
int CvePS = row["CvePS"].ToEntero();
int CveUnidadMedida = row["CveUnidadMedida"].ToEntero();
int CvePais = row["CvePais"].ToEntero();
decimal Precio = ModExtensiones.ToDecimal(row["Precio"].ToString());
decimal Cantidad = ModExtensiones.ToDecimal(row["Cantidad"].ToString());
decimal PesoUnitario = ModExtensiones.ToDecimal(row["PesoUnitario"].ToString());
ClsExportaciones Partidas = new ClsExportaciones();
Partidas.AddPartida(CvePS, CveUnidadMedida, Precio, CveEmpresa, CveUsuario, ExportacionGuardada, Cantidad, PesoUnitario, CvePais);
Partidas.Dispose();
}
}
//string Liga = "document.location.href=\"/Export/RepExportaciones.aspx\";";
string Liga = $"document.location.href=\"/Export/ExpDetalle.aspx?CveExportacion={ExportacionGuardada}\";";
Alert("La Exportación se ha agregado correctamente.", JSBtnAceptar: Liga);
}
Exportaciones.Dispose();
}
else
{
bool Continuar = Exportaciones.UpdateExportacion(
CveExportacion,
NumeroPedimento,
FechaPedimento,
CveVenta,
TipoCambio,
TipoExportacion,
CveExportacionEstatus,
CveClienteExportador.ToEntero(),
CveClienteImportador.ToEntero(),
CveClienteConsignatario.ToEntero(),
CveAgente,
ClaveAduana,
CveProveedor,
MedioTransporte,
TipoContenedor,
Sello1,
Sello2,
Sello3,
SCAC,
CAAT,
ContenedorPlaca,
CveEmpresa,
CveUsuario,
CveDirExportador,
CveDirConsignatario,
CveIncoterm,
Notas,
CvePedimento,
CveAgenteExtranjero
);
if (Continuar)
{
Exportaciones.UpdateGastos(
IncFletes,
IncSeguro,
IncEmbalajes,
IncEmbalaje,
IncConexos,
DecFlete,
DecSeguro,
DecCarga,
DecDescarga,
DecOtros,
CveExportacion
);
Exportaciones.Dispose();
CargarPartidas();
Alert("La Exportación se ha actualizado correctamente.");
}
Exportaciones.Dispose();
}
}
protected void CargarPartidas()
{
DataTable DTPartidas = new DataTable();
ClsExportaciones Partidas = new ClsExportaciones();
if (CveExportacion != -1)
{
if (Partidas.GetPartidas(UsuarioActual.CveEmpresa, CveExportacion))
{
DTPartidas = Partidas.DtResultados;
if (DTPartidas.Rows.Count > 0)
{
GVPartidas.DataSource = DTPartidas;
GVPartidas.DataBind();
UpPartidas.Update();
}
}
}
else
{
DTPartidas = ViewState["Partidas"] as DataTable;
if (DTPartidas != null)
{
GVPartidas.DataSource = DTPartidas;
GVPartidas.DataBind();
UpPartidas.Update();
}
}
Partidas.Dispose();
}
protected void CargarUnidadMedida(string CvePS = "-1", string CveUnidadMedida = "-1")
{
int CveEmpresa = UsuarioActual.CveEmpresa;
DdlUM.Items.Clear();
if (CvePS != "" && CvePS != "-1")
{
if (UsuarioActual.Empresa.UsaInventarios)
DdlUM.DataSource = get_GlobalDTProductosServiciosEquivalencias(CvePS.ToEntero(), -1, CveEmpresa);
else
DdlUM.DataSource = get_GlobalDTUnidadesMedida(CveEmpresa);
DdlUM.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlUM.DataBind();
DdlUM.SelectedValueExist(CveUnidadMedida);
}
else
{
DdlUM.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlUM.SelectedValue = "-1";
}
}
protected void AbrirModalPartida(int GVPartidasRowIndex = -1)
{
RegistraScript("$('#DModalPartida').modal();");
int CveEmpresa = UsuarioActual.CveEmpresa;
DdlPS.Items.Clear();
DdlPS.DataSource = get_GlobalDTPS(CveEmpresa);
DdlPS.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlPS.DataBind();
DdlUM.Items.Clear();
DdlPaisOrigen.Items.Clear();
DdlPaisOrigen.DataSource = GlobalDTGralPaises;
DdlPaisOrigen.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlPaisOrigen.DataBind();
if (CveExportacionDetalle != -1)
{
ChkSeguirAgregandoPartidas.Checked = false;
DivAgregarOtraPartida.Visible = false;
BtnPartidaGuardar.Visible = false;
BtnPartidaActualizar.Visible = true;
ClsExportaciones Partidas = new ClsExportaciones();
if (Partidas.GetPartidas(CveEmpresa, CveExportacion, CveExportacionDetalle))
{
DataTable DTPartidas = Partidas.DtResultados;
if (DTPartidas.Rows.Count > 0)
{
string CvePS = DTPartidas.FiltroPrimeroValor("CvePS");
DdlPS.SelectedValue = CvePS;
DdlPaisOrigen.SelectedValue = DTPartidas.FiltroPrimeroValor("CvePais"); ;
TxtPrecio.Text = DTPartidas.FiltroPrimeroValor("Precio");
TxtCantidad.Text = DTPartidas.FiltroPrimeroValor("Cantidad");
TxtPesoUnitario.Text = DTPartidas.FiltroPrimeroValor("PesoUnitario");
CargarUnidadMedida(CvePS, DTPartidas.FiltroPrimeroValor("CveUnidadMedida"));
}
}
Partidas.Dispose();
}
else
{
if (GVPartidasRowIndex >= 0)
{
ChkSeguirAgregandoPartidas.Checked = false;
DivAgregarOtraPartida.Visible = false;
BtnPartidaGuardar.Visible = false;
BtnPartidaActualizar.Visible = true;
DataTable DTTemp = ViewState["Partidas"] as DataTable;
if (GVPartidasRowIndex < DTTemp.Rows.Count)
{
string CvePS = DTTemp.Rows[GVPartidasRowIndex]["CvePS"].ToString();
DdlPS.SelectedValue = CvePS;
DdlPaisOrigen.SelectedValue = DTTemp.Rows[GVPartidasRowIndex]["CvePais"].ToString();
TxtPrecio.Text = DTTemp.Rows[GVPartidasRowIndex]["Precio"].ToString();
TxtCantidad.Text = DTTemp.Rows[GVPartidasRowIndex]["Cantidad"].ToString();
TxtPesoUnitario.Text = DTTemp.Rows[GVPartidasRowIndex]["PesoUnitario"].ToString();
CargarUnidadMedida(CvePS, DTTemp.Rows[GVPartidasRowIndex]["CveUnidadMedida"].ToString());
}
}
else
{
ChkSeguirAgregandoPartidas.Checked = true;
DivAgregarOtraPartida.Visible = true;
BtnPartidaGuardar.Visible = true;
BtnPartidaActualizar.Visible = false;
TxtPrecio.Text = "";
TxtCantidad.Text = "";
TxtPesoUnitario.Text = "";
}
}
UpPSS.Update();
}
protected void GVPartidas_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "EditarPartida")
{
CveExportacionDetalle = -1;
int GVPartidasRowIndex = -1;
if (CveExportacion == -1)
{
Control control = (Control)e.CommandSource;
GridViewRow GVPartidasRow = (GridViewRow)control.NamingContainer;
GVPartidasRowIndex = GVPartidasRow.RowIndex;
DataTable DTTemp = ViewState["Partidas"] as DataTable;
DTTemp.Rows[GVPartidasRowIndex]["Actualizar"] = true;
}
else
{
CveExportacionDetalle = e.CommandArgument.ToEntero();
}
AbrirModalPartida(GVPartidasRowIndex);
}
if (e.CommandName == "EliminarPartida")
{
if (CveExportacion != -1)
{
ClsExportaciones Partidas = new ClsExportaciones();
bool Continuar = Partidas.RemovePartida(e.CommandArgument.ToEntero());
Partidas.Dispose();
if (Continuar)
{
Alert("La Partida se ha eliminado correctamente.", ModExtensiones.TipoMensaje.ToastInformacion);
}
}
else
{
Control control = (Control)e.CommandSource;
GridViewRow GVPartidasRow = (GridViewRow)control.NamingContainer;
int GVPartidasRowIndex = GVPartidasRow.RowIndex;
DataTable DTTemp = ViewState["Partidas"] as DataTable;
if (GVPartidasRowIndex >= 0 && GVPartidasRowIndex < DTTemp.Rows.Count)
{
DTTemp.Rows.RemoveAt(GVPartidasRowIndex);
ViewState["Partidas"] = DTTemp;
Alert("La Partida se ha eliminado correctamente.", ModExtensiones.TipoMensaje.ToastInformacion);
}
}
CargarPartidas();
}
}
protected void GVPartidas_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer && GVPartidas.Rows.Count > 0)
{
decimal TotalPrecio = 0;
decimal TotalMXP = 0;
decimal TotalEmpaque = 0;
decimal PesoUnitario = 0;
decimal PesoBruto = 0;
foreach (GridViewRow row in GVPartidas.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
Label lblPrecio = (Label)row.FindControl("lblPrecio");
Label lblValorTotalMXP = (Label)row.FindControl("lblValorTotalMXP");
Label lblTotalEmpaque = (Label)row.FindControl("lblTotalEmpaque");
Label lblPesoUnitario = (Label)row.FindControl("lblPesoUnitario");
Label lblPesoBruto = (Label)row.FindControl("lblPesoBruto");
if (lblPrecio != null && lblPrecio.Text != "")
TotalPrecio += Convert.ToDecimal(lblPrecio.Text.Replace(",", "").Trim());
if (lblValorTotalMXP != null && lblValorTotalMXP.Text != "")
TotalMXP += Convert.ToDecimal(lblValorTotalMXP.Text.Replace(",", "").Trim());
if (lblTotalEmpaque != null && lblTotalEmpaque.Text != "")
TotalEmpaque += Convert.ToDecimal(lblTotalEmpaque.Text.Replace(",", "").Trim());
if (lblPesoUnitario != null && lblPesoUnitario.Text != "")
PesoUnitario += Convert.ToDecimal(lblPesoUnitario.Text.Replace(",", "").Trim());
if (lblPesoBruto != null && lblPesoBruto.Text != "")
PesoBruto += Convert.ToDecimal(lblPesoBruto.Text.Replace(",", "").Trim());
}
}
e.Row.Cells[0].Text = "Totales:";
e.Row.Cells[2].Text = TotalPrecio.ToString("#,###.####");
e.Row.Cells[3].Text = TotalMXP.ToString("#,###.####");
e.Row.Cells[4].Text = TotalEmpaque.ToString("#,###.####");
e.Row.Cells[7].Text = TotalEmpaque.ToString("#,###.####");
e.Row.Cells[8].Text = PesoUnitario.ToString("#,###.####");
e.Row.Cells[9].Text = PesoBruto.ToString("#,###.####");
e.Row.Font.Bold = true;
e.Row.BackColor = System.Drawing.Color.LightGray;
}
}
protected void BtnAgregarPartida_Click(object sender, EventArgs e)
{
CveExportacionDetalle = -1;
AbrirModalPartida();
}
protected void CrearPartidaTemporal(DataTable DTTemp, bool Actualizar = false)
{
int CvePS = DdlPS.Text.ToEntero();
string PSCodigo = DdlPS.SelectedItem.Text;
int CveUnidadMedida = (DdlUM.Text == "") ? -1 : DdlUM.Text.ToEntero();
string UnidadMedida = (CveUnidadMedida == -1) ? "" : DdlUM.SelectedItem.Text;
int CvePais = (DdlPaisOrigen.Text == "") ? -1 : DdlPaisOrigen.Text.ToEntero();
string ClaveSATPais = (CvePais == -1) ? "" : DdlPaisOrigen.SelectedItem.Text;
decimal Precio = ModExtensiones.ToDecimal(TxtPrecio.Text);
decimal ValorTotalMXP = Precio * ModExtensiones.ToDecimal(TxtTipoCambio.Text);
decimal Cantidad = ModExtensiones.ToDecimal(TxtCantidad.Text);
decimal PesoUnitario = ModExtensiones.ToDecimal(TxtPesoUnitario.Text);
decimal PesoBruto = PesoUnitario * Cantidad;
int CveEmpresa = UsuarioActual.CveEmpresa;
int CveUsuario = UsuarioActual.CveUsuario;
string FraccionArancelaria = "";
string UnidadAduana = "";
string CveFraccionArancelaria = get_GlobalDTPS(CveEmpresa, CvePS).FiltroPrimeroValor("CveFraccionArancelaria");
if (CveFraccionArancelaria != "" && GlobalDTFraccionArancelaria.Any())
{
DataTable DTFraccArancelaria = GlobalDTFraccionArancelaria.CopyToDataTable();
DataRow RowFA = DTFraccArancelaria.FiltroPrimeroPK("CveFraccionArancelaria", CveFraccionArancelaria);
FraccionArancelaria = RowFA["ClaveSATFraccionArancelariaDescripcion"].ToString();
UnidadAduana = RowFA["ClaveSATUnidadAduanaDescripcion"].ToString();
}
if (!Actualizar)
{
DataRow PartidaRow = DTTemp.NewRow();
PartidaRow["CvePS"] = CvePS;
PartidaRow["PSCodigo"] = PSCodigo;
PartidaRow["CveUnidadMedida"] = CveUnidadMedida;
PartidaRow["UnidadMedida"] = UnidadMedida;
PartidaRow["CvePais"] = CvePais;
PartidaRow["ClaveSATPais"] = ClaveSATPais;
PartidaRow["Precio"] = Precio;
PartidaRow["ValorTotalMXP"] = ValorTotalMXP;
PartidaRow["Cantidad"] = Cantidad;
PartidaRow["PesoUnitario"] = PesoUnitario;
PartidaRow["PesoBruto"] = PesoBruto;
PartidaRow["CveEmpresa"] = CveEmpresa;
PartidaRow["CveUsuario"] = CveUsuario;
PartidaRow["FraccionArancelaria"] = FraccionArancelaria;
PartidaRow["UnidadAduana"] = UnidadAduana;
PartidaRow["Actualizar"] = false;
DTTemp.Rows.Add(PartidaRow);
}
else
{
DataRow[] filas = DTTemp.Select("Actualizar = true");
DataRow PartidaRow = filas[0];
PartidaRow["CvePS"] = CvePS;
PartidaRow["PSCodigo"] = PSCodigo;
PartidaRow["CveUnidadMedida"] = CveUnidadMedida;
PartidaRow["UnidadMedida"] = UnidadMedida;
PartidaRow["CvePais"] = CvePais;
PartidaRow["ClaveSATPais"] = ClaveSATPais;
PartidaRow["Precio"] = Precio;
PartidaRow["ValorTotalMXP"] = ValorTotalMXP;
PartidaRow["Cantidad"] = Cantidad;
PartidaRow["PesoUnitario"] = PesoUnitario;
PartidaRow["PesoBruto"] = PesoBruto;
PartidaRow["CveEmpresa"] = CveEmpresa;
PartidaRow["CveUsuario"] = CveUsuario;
PartidaRow["FraccionArancelaria"] = FraccionArancelaria;
PartidaRow["UnidadAduana"] = UnidadAduana;
PartidaRow["Actualizar"] = false;
}
ViewState["Partidas"] = DTTemp;
}
protected void BtnPartidaGuardar_Click(object sender, EventArgs e)
{
int CvePS = DdlPS.Text.ToEntero();
int CveUnidadMedida = (DdlUM.Text == "") ? -1 : DdlUM.Text.ToEntero();
int CvePais = (DdlPaisOrigen.Text == "") ? -1 : DdlPaisOrigen.Text.ToEntero();
decimal Precio = ModExtensiones.ToDecimal(TxtPrecio.Text);
decimal ValorTotalMXP = Precio * ModExtensiones.ToDecimal(TxtTipoCambio.Text);
decimal Cantidad = ModExtensiones.ToDecimal(TxtCantidad.Text);
decimal PesoUnitario = ModExtensiones.ToDecimal(TxtPesoUnitario.Text);
decimal PesoBruto = PesoUnitario * Cantidad;
int CveUsuario = UsuarioActual.CveUsuario;
ClsExportaciones Partidas = new ClsExportaciones();
if (CveExportacionDetalle == -1)
{
if (CveExportacion == -1)
{
string Mensaje = "La Partida se ha agregado correctamente. Recuerde guardar la Exportación para conservar los cambios.";
if (ViewState["Partidas"] == null)
{
DataTable DTTemp = new DataTable();
DTTemp.Columns.Add("CveExportacionDetalle", typeof(int));
DTTemp.Columns.Add("CvePS", typeof(int));
DTTemp.Columns.Add("PSCodigo", typeof(string));
DTTemp.Columns.Add("CveUnidadMedida", typeof(int));
DTTemp.Columns.Add("UnidadMedida", typeof(string));
DTTemp.Columns.Add("CvePais", typeof(int));
DTTemp.Columns.Add("ClaveSATPais", typeof(string));
DTTemp.Columns.Add("Precio", typeof(decimal));
DTTemp.Columns.Add("ValorTotalMXP", typeof(decimal));
DTTemp.Columns.Add("Cantidad", typeof(decimal));
DTTemp.Columns.Add("PesoUnitario", typeof(decimal));
DTTemp.Columns.Add("PesoBruto", typeof(decimal));
DTTemp.Columns.Add("CveEmpresa", typeof(int));
DTTemp.Columns.Add("CveUsuario", typeof(int));
DTTemp.Columns.Add("FraccionArancelaria", typeof(string));
DTTemp.Columns.Add("UnidadAduana", typeof(string));
DTTemp.Columns.Add("Actualizar", typeof(bool));
CrearPartidaTemporal(DTTemp);
}
else
{
Button btn = sender as Button;
DataTable DTTemp = ViewState["Partidas"] as DataTable;
bool Actualizar = false;
if (btn.ID == "BtnPartidaActualizar")
{
Actualizar = true;
Mensaje = "La Partida se ha actualizado correctamente. Recuerde guardar la Exportación para conservar los cambios.";
}
CrearPartidaTemporal(DTTemp, Actualizar);
}
//RegistraScript("$('#DModalPartida').modal('hide');");
Alert(Mensaje, ModExtensiones.TipoMensaje.ToastInformacion);
}
else
{
bool Continuar = Partidas.AddPartida(CvePS, CveUnidadMedida, Precio, UsuarioActual.CveEmpresa, CveUsuario, CveExportacion, Cantidad, PesoUnitario, CvePais);
Partidas.Dispose();
if (Continuar)
{
//RegistraScript("$('#DModalPartida').modal('hide');");
Alert("La Partida se ha agregado correctamente.", ModExtensiones.TipoMensaje.ToastInformacion);
}
}
}
else
{
bool Continuar = Partidas.UpdatePartida(CveExportacionDetalle, CvePS, CveUnidadMedida, Precio, CveUsuario, Cantidad, PesoUnitario, CvePais);
Partidas.Dispose();
if (Continuar)
{
//RegistraScript("$('#DModalPartida').modal('hide');");
Alert("La Partida se ha actualizado correctamente.", ModExtensiones.TipoMensaje.ToastInformacion);
}
}
if (ChkSeguirAgregandoPartidas.Checked == false)
{
RegistraScript("$('#DModalPartida').modal('hide');");
}
else
{
DdlUM.Items.Clear();
DdlPS.SelectedValue = "-1";
DdlPaisOrigen.SelectedValue = "-1";
TxtPrecio.Text = "";
TxtCantidad.Text = "";
TxtPesoUnitario.Text = "";
UpPSS.Update();
}
CargarPartidas();
}
protected void DdlPS_SelectedIndexChanged(object sender, EventArgs e)
{
CargarUnidadMedida(DdlPS.Text, DdlUM.Text);
UpPSS.Update();
}
protected void ImprimirReporte(string Formato = "PDF")
{
FileInfo Archivo = new FileInfo(string.Format("{0}Empresas/Grales/Formatos/FacturaImportacion.mrt", UsuarioActual.Empresa.Ruta));
}
protected void LBImprimir_Click(object sender, EventArgs e)
{
/*if (DtDatos != null)
{
ImprimirReporte();
}
else
{
CargaDatos();
if (DtDatos != null)
Alert("No se encontró información para el reporte.", ModExtensiones.TipoMensaje.MsgAdvertencia);
else
ImprimirReporte();
}*/
ImprimirReporte();
}
protected void DdlVentas_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void DdlAgenteMex_SelectedIndexChanged(object sender, EventArgs e)
{
// Debe existir esta definición para que se haga postback.
// El valor de TxtPatente ya se actualiza en ActualizarValores()
}
protected void DdlAgenteExt_SelectedIndexChanged(object sender, EventArgs e)
{
// Debe existir esta definición para que se haga postback.
// El valor de TxtTaxId ya se actualiza en ActualizarValores()
}
}

View File

@@ -0,0 +1,144 @@
<%@ Page Title="Exportaciones" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepExportaciones.aspx.cs" Inherits="Export_RepExportaciones" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
<!--link href="/Metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css" rel="stylesheet" /-->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
Exportaciones
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
<li>
<asp:HyperLink ID="HLAgregarExp" NavigateUrl="ExpDetalle.aspx?CveExportacion=-1" runat="server" > <i class="fa fa-plus"></i> Agregar Exportación</asp:HyperLink>
</li>
</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="upDatosExp" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet light portlet xspadding bordered " style="margin-bottom: 0px; padding: 8px;" id="form_wizard_1">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject font-green bold uppercase">Información
<asp:Literal ID="LtlPeriodoseleccionado" runat="server"></asp:Literal></span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<%--<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>--%>
</div>
<div class="actions">
<div class="btn-group">
<div>
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVExportaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVExportaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
</div>
<div class="portlet-body form">
<asp:GridView ID="GVExportaciones" runat="server" data-sort="true" AutoGenerateColumns="False" DataKeyNames="CveExportacion" Width="100%" EmptyDataText="No se encontraron Exportaciones" ToolTip="Exportaciones" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Exportación" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:HyperLink ID="HlExpDetalle" runat="server" Text='<%# Eval("CveExportacion") %>' NavigateUrl='<%# Eval("CveExportacion", "ExpDetalle.aspx?CveExportacion={0}") %>'>></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FechaIng" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="100px" HeaderText="Fecha de Ingreso" DataFormatString="{0:d}" />
<asp:TemplateField HeaderText="Usuario" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblUsuario" runat="server" Text='<%# Eval("Usuario")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Número de Factura" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblNumFact" runat="server" Text='<%# Eval("SerieFolio")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha de Factura" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblFechaFact" runat="server" Text='<%# Eval("FechaFact", "{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tipo de Cambio" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblTipoCambio" runat="server" Text='<%# Eval("TipoCambio")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tipo Exportación" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblTipoExp" runat="server" Text='<%# Eval("TipoExportacion")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblEstatus" runat="server" Text='<%# Eval("CveExportacionEstatus")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Número de Pedimento" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblNumeroPedimento" runat="server" Text='<%# Eval("NumeroPedimento")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Pedimento" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblFechaPedimento" runat="server" Text='<%# Eval("FechaPedimento", "{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Nombre Exportador" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblClienteExp" runat="server" Text='<%# Eval("ClienteExportador")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="RFC Importador" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRFCImp" runat="server" Text='<%# Eval("RFCImp")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Nombre Importador" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblClienteImp" runat="server" Text='<%# Eval("ClienteImportador")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="RFC Consignatario" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRFCCon" runat="server" Text='<%# Eval("RFCCon")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Nombre Consignatario" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblClienteCon" runat="server" Text='<%# Eval("ClienteConsignatario")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Editar" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<ItemTemplate>
<asp:LinkButton data-toggle="tooltip" title="Editar" ID="LnkEditar" OnClick="EditarExp_Click" CssClass="btn btn-circle btn-sm green" runat="server" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<ItemTemplate>
<asp:LinkButton ID="LnkEliminar" runat="server" OnClick="EliminarExp_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar la Exportación?" data-btn-ok-label="Sí" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

View File

@@ -0,0 +1,61 @@
using DocumentFormat.OpenXml.Wordprocessing;
using Extensiones;
using StackExchange.Redis;
using System;
using System.Activities;
using System.Activities.Expressions;
using System.Activities.Statements;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
using static Stimulsoft.Report.Export.DeflaterHuffman;
public partial class Export_RepExportaciones : ClsPaginas
{
#region Propiedades
private int CveExportacion
{
get { return (ViewState["CveExportacion"] == null) ? -1 : Convert.ToInt32(ViewState["CveExportacion"]); }
set { ViewState["CveExportacion"] = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CargaExportaciones();
}
}
protected void CargaExportaciones()
{
ClsExportaciones Exportaciones = new ClsExportaciones();
if (Exportaciones.GetExportacion(-1, UsuarioActual.CveEmpresa))
{
GVExportaciones.DataSource = Exportaciones.DtResultados;
GVExportaciones.DataBind();
}
Exportaciones.Dispose();
upDatosExp.Update();
}
protected void EditarExp_Click(object sender, EventArgs e)
{
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
Response.Redirect($"/Export/ExpDetalle.aspx?CveExportacion={gvRow.DataKey("CveExportacion")}", true);
upDatosExp.Update();
}
protected void EliminarExp_Click(object sender, EventArgs e)
{
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
ClsExportaciones Exportaciones = new ClsExportaciones();
bool Continuar = Exportaciones.RemoveExportacion(gvRow.DataKey("CveExportacion").ToEntero());
Exportaciones.Dispose();
if (Continuar)
{
CargaExportaciones();
Alert("La Exportación se ha eliminado correctamente.");
}
}
}