Cambios Importaciones RepExportaciones

This commit is contained in:
Luis Carlos Quijada
2025-07-03 18:36:26 -06:00
parent 47c6fbba2a
commit fee2367eec
2 changed files with 52 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
Exportaciones
<asp:Literal ID="LtlTitulo" runat="server"></asp:Literal>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
<li>
@@ -45,7 +45,7 @@
</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">
<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">
<Columns>
<asp:TemplateField HeaderText="Exportación" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>

View File

@@ -25,6 +25,8 @@ public partial class Export_RepExportaciones : ClsPaginas
set { ViewState["CveExportacion"] = value; }
}
public string EmptyDataTextPersonalizado { get; set; }
public string ToolTipPersonalizado { get; set; }
private bool EsImportacion
{
get{ return (ViewState["EsImportacion"] == null) ? false : Boolean.Parse(ViewState["EsImportacion"].ToString()); }
@@ -35,14 +37,35 @@ public partial class Export_RepExportaciones : ClsPaginas
{
if (!IsPostBack)
{
// Primero, inicializa la bandera
EsImportacion = false;
if (Request["Opcion"] != null)
if (Request["Opcion"] != null && Request["Opcion"] == "I")
{
if (Request["Opcion"] == "I")
EsImportacion = true;
}
LtlPeriodoseleccionado.Text = EsImportacion ? "Importaciones" : "Exportaciones";
Page.Title = EsImportacion ? "Importaciones" : "Exportaciones";
// Ahora sí, usa la bandera para los textos
if (EsImportacion)
{
LtlTitulo.Text = "Importaciones";
EmptyDataTextPersonalizado = "No se encontraron importaciones";
ToolTipPersonalizado = "Importaciones";
HLAgregarExp.Text = "<i class='fa fa-plus'></i> Agregar Importación";
HLAgregarExp.NavigateUrl = "ExpDetalle.aspx?CveExportacion=-1&Opcion=I";
}
else
{
LtlTitulo.Text = "Exportaciones";
EmptyDataTextPersonalizado = "No se encontraron exportaciones";
ToolTipPersonalizado = "Exportaciones";
HLAgregarExp.Text = "<i class='fa fa-plus'></i> Agregar Exportación";
HLAgregarExp.NavigateUrl = "ExpDetalle.aspx?CveExportacion=-1";
}
GVExportaciones.EmptyDataText = EmptyDataTextPersonalizado;
GVExportaciones.ToolTip = ToolTipPersonalizado;
CargaExportaciones();
}
}
@@ -61,7 +84,11 @@ public partial class Export_RepExportaciones : ClsPaginas
protected void EditarExp_Click(object sender, EventArgs e)
{
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
Response.Redirect($"/Export/ExpDetalle.aspx?CveExportacion={gvRow.DataKey("CveExportacion")}", true);
string cve = gvRow.DataKey("CveExportacion").ToString();
string url = EsImportacion
? $"/Export/ExpDetalle.aspx?CveExportacion={cve}&Opcion=I"
: $"/Export/ExpDetalle.aspx?CveExportacion={cve}";
Response.Redirect(url, true);
upDatosExp.Update();
}
protected void EliminarExp_Click(object sender, EventArgs e)
@@ -76,4 +103,21 @@ public partial class Export_RepExportaciones : ClsPaginas
Alert("La Exportación se ha eliminado correctamente.");
}
}
}
protected void GVExportaciones_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink hl = (HyperLink)e.Row.FindControl("HlExpDetalle");
if (hl != null)
{
string cve = DataBinder.Eval(e.Row.DataItem, "CveExportacion").ToString();
if (EsImportacion)
hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cve}&Opcion=I";
else
hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cve}";
}
}
}
}