Cambios ExpDetalle Importacion

This commit is contained in:
Luis Carlos Quijada
2025-07-08 17:02:23 -06:00
parent bc0548336b
commit 38352b3d81
3 changed files with 145 additions and 17 deletions

View File

@@ -70,14 +70,26 @@
</div> </div>
<div class="form-group form-md-line-input input-iconright" style="width: 150px;"> <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> <asp:TextBox ID="TxtNumPed" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender ID="meeTxtPedimento" runat="server" <ajaxToolkit:MaskedEditExtender
ClearMaskOnLostFocus="false" ID="meeTxtPedimento"
runat="server"
TargetControlID="TxtNumPed" TargetControlID="TxtNumPed"
Mask="99--99--9999--9999999" Mask="99--99--9999--9999999"
MaskType="Number" MaskType="None"
ClearMaskOnLostFocus="false"
InputDirection="LeftToRight" InputDirection="LeftToRight"
AcceptNegative="None" AcceptNegative="None"
ErrorTooltipEnabled="True" /> ErrorTooltipEnabled="True" />
<asp:CustomValidator
ID="cvNumPed"
runat="server"
ControlToValidate="TxtNumPed"
ErrorMessage="El número de pedimento está incompleto o tiene un formato incorrecto."
ForeColor="Red"
Display="Dynamic"
ValidationGroup="GrpGuardar"
ClientValidationFunction="validaPedimento" />
<label for="<%= TxtNumPed.ClientID.ToString()%>" style="margin: 0; white-space: nowrap;">Número de Pedimento:</label> <label for="<%= TxtNumPed.ClientID.ToString()%>" style="margin: 0; white-space: nowrap;">Número de Pedimento:</label>
</div> </div>
<table> <table>
@@ -132,6 +144,14 @@
<asp:TextBox ID="TxtTipoCambio" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox> <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="." /> <ajax:FilteredTextBoxExtender ID="FTETipoCambio" runat="server" TargetControlID="TxtTipoCambio" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtTipoCambio.ClientID.ToString()%>">Tipo de Cambio:</label> <label for="<%= TxtTipoCambio.ClientID.ToString()%>">Tipo de Cambio:</label>
<asp:RequiredFieldValidator
ID="RFVTipoCambio"
runat="server"
ControlToValidate="TxtTipoCambio"
ErrorMessage="El tipo de cambio es obligatorio."
Display="Dynamic"
ForeColor="Red"
ValidationGroup="GrpGuardar" />
</div> </div>
<div class="form-group form-md-line-input input-iconright" style="width: 150px;"> <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> <asp:DropDownList ID="DdlIncoterm" CssClass="form-control select2me" AppendDataBoundItems="true" Style="width: 100%;" runat="server" DataTextField="ClaveSATIncotermDescripcion" DataValueField="CveIncoterm"></asp:DropDownList>
@@ -842,5 +862,12 @@
</div> </div>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
<script type="text/javascript">
function validaPedimento(sender, args) {
// Regex: 2 dígitos, --, 2 dígitos, --, 4 dígitos, --, 7 dígitos
var regex = /^\d{2}--\d{2}--\d{4}--\d{7}$/;
args.IsValid = regex.test(args.Value);
}
</script>
</asp:Content> </asp:Content>

View File

@@ -53,6 +53,21 @@
width: 100%; width: 100%;
height: 500px; height: 500px;
} }
#<%= GVExportaciones.ClientID %> .btn,
#<%= GVExportaciones.ClientID %> .btn-circle {
display: inline-block !important;
width: auto !important;
min-width: 0 !important;
max-width: none !important;
vertical-align: middle !important;
margin-bottom: 0 !important;
margin-right: 4px;
float: none !important;
clear: none !important;
}
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
@@ -148,11 +163,11 @@
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel ID="upDatosExp" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="upDatosExp" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<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"> <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" OnRowDataBound="GVExportaciones_RowDataBound" OnRowCreated="GVExportaciones_RowCreated">
<Columns> <Columns>
<asp:TemplateField HeaderText="Exportación" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <ItemTemplate>
<asp:HyperLink ID="HlExpDetalle" runat="server" Text='<%# Eval("CveExportacion") %>' NavigateUrl='<%# Eval("CveExportacion", "ExpDetalle.aspx?CveExportacion={0}") %>'>></asp:HyperLink> <asp:HyperLink ID="HlExpDetalle" runat="server" Text='<%# Eval("CveExportacion") %>'></asp:HyperLink>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="FechaIng" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="100px" HeaderText="Fecha de Ingreso" DataFormatString="{0:d}" /> <asp:BoundField DataField="FechaIng" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="100px" HeaderText="Fecha de Ingreso" DataFormatString="{0:d}" />
@@ -224,14 +239,28 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Editar" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px"> <asp:TemplateField HeaderText="Acciones" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="120px">
<ItemTemplate> <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> <span style="white-space: nowrap;">
</ItemTemplate> <asp:HyperLink
</asp:TemplateField> ID="HlEditar"
<asp:TemplateField HeaderText="Eliminar" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px"> runat="server"
<ItemTemplate> CssClass="btn btn-circle btn-sm green"
<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í" /> Text="<i class='fa fa-pencil'></i>"
ToolTip="Editar">
</asp:HyperLink>
&nbsp;
<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í" />
</span>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>

View File

@@ -28,7 +28,7 @@ public partial class Export_RepExportaciones : ClsPaginas
private bool EsImportacion private bool EsImportacion
{ {
get{ return (ViewState["EsImportacion"] == null) ? false : Boolean.Parse(ViewState["EsImportacion"].ToString()); } get { return (ViewState["EsImportacion"] == null) ? false : Boolean.Parse(ViewState["EsImportacion"].ToString()); }
set { ViewState["EsImportacion"] = value; } set { ViewState["EsImportacion"] = value; }
} }
public string EmptyDataTextPersonalizado { get; set; } public string EmptyDataTextPersonalizado { get; set; }
@@ -43,7 +43,7 @@ public partial class Export_RepExportaciones : ClsPaginas
if (Request["Opcion"] != null) if (Request["Opcion"] != null)
{ {
if (Request["Opcion"] == "I") if (Request["Opcion"] == "I")
EsImportacion = true; EsImportacion = true;
} }
Page.Title = EsImportacion ? "Importaciones" : "Exportaciones"; Page.Title = EsImportacion ? "Importaciones" : "Exportaciones";
@@ -86,7 +86,7 @@ public partial class Export_RepExportaciones : ClsPaginas
} }
protected void CargaExportaciones() protected void CargaExportaciones()
{ {
bool EsExportacion = !EsImportacion; bool EsExportacion = !EsImportacion;
string SubProyectos = DdlSubProyecto.GetSelectedValuesM(); string SubProyectos = DdlSubProyecto.GetSelectedValuesM();
SubProyectos = SubProyectos == "" ? "-1" : SubProyectos; SubProyectos = SubProyectos == "" ? "-1" : SubProyectos;
@@ -125,4 +125,76 @@ public partial class Export_RepExportaciones : ClsPaginas
Alert("La Exportación se ha eliminado correctamente."); Alert("La Exportación se ha eliminado correctamente.");
} }
} }
}
protected void GVExportaciones_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var dataItem = (System.Data.DataRowView)e.Row.DataItem;
int cveExportacion = Convert.ToInt32(dataItem["CveExportacion"]);
HyperLink hl = (HyperLink)e.Row.FindControl("HlExpDetalle");
// Usa la bandera EsImportacion de la página
if (EsImportacion)
hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}&Opcion=I";
else
hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}";
// EDITAR
HyperLink hlEditar = (HyperLink)e.Row.FindControl("HlEditar");
if (EsImportacion)
hlEditar.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}&Opcion=I";
else
hlEditar.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}";
// Tipo Exportación
Label lblTipoExp = (Label)e.Row.FindControl("lblTipoExp");
if (lblTipoExp != null)
{
string valor = dataItem["TipoExportacion"].ToString();
switch (valor)
{
case "1":
lblTipoExp.Text = "(IMP) Importación";
break;
case "2":
lblTipoExp.Text = "(EXP) Exportación/retorno";
break;
case "3":
lblTipoExp.Text = "(TRA) Tránsitos";
break;
default:
lblTipoExp.Text = "Desconocido";
break;
}
}
// Estatus
Label lblEstatus = (Label)e.Row.FindControl("lblEstatus");
if (lblEstatus != null)
{
string valor = dataItem["CveExportacionEstatus"].ToString();
switch (valor)
{
case "1":
lblEstatus.Text = "Tránsito";
break;
case "2":
lblEstatus.Text = "Completa";
break;
default:
lblEstatus.Text = "Desconocido";
break;
}
}
}
}
protected void GVExportaciones_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
// Cambia el texto del primer encabezado (ajusta el índice si no es la primera columna)
e.Row.Cells[0].Text = EsImportacion ? "Importación" : "Exportación";
}
}
}