using Extensiones; using System; using System.Web.UI.WebControls; public partial class Acumuladores_RepAcumuladoresVigencia : ClsPaginas { #region PROPIEDADES private bool Consultado { get { return Consultado = (bool)ViewState["Consultado"]; } set { ViewState["Consultado"] = value; } } #endregion #region Exporta Excel PDF protected void LnkExcel_Click(object sender, EventArgs e) { if (Consultado) { GvAcum.ExportToExcelG("RepAcumuladoresVigencia " + NowADS().ToString("dd-MM-yyyy"), "Reporte de Vigencia de Acumuladores", UsuarioActual); } else { Alert("Por favor realice una consulta primero."); } } /* protected void LnkPdf_Click(object sender, EventArgs e) { if (Consultado) { GvAcum.GenerarReportePDF("Reporte de Autorizaciones de Ventas"); } else { Alert("Por favor realice una consulta primero."); } }*/ public override void VerifyRenderingInServerForm(System.Web.UI.Control control) { } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InicializaValores(); } } private void InicializaValores() { Consultado = false; CargaCombos(); txtFechaI.Text = NowADS().FirstDayOfMonth().AddMonths(-24).ToShortDateString(); txtFechaF.Text = NowADS().LastDayOfMonth().AddMonths(-6).ToShortDateString(); UpFiltros.Update(); } private void CargaCombos() { CargarCentrosDeCosto(null, DdlSubProyecto, null, LblSubProyecto); DdlClasificaciones.DataSource = get_GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros("Categoria = 'ACUMULADORES'"); DdlClasificaciones.DataBind(); DdlClasificaciones.Items.Insert(0, new ListItem("Todos", "-1")); DdlMarcas.DataSource = get_GlobalDTGralMarcas(UsuarioActual.CveEmpresa); DdlMarcas.DataBind(); DdlMarcas.Items.Insert(0, new ListItem("Todas", "-1")); } protected void BtnConsultar_Click(object sender, EventArgs e) { Consulta(); Consultado = true; } private void Consulta() { ClsAcumuladores ObjAcum = new ClsAcumuladores(); if (ObjAcum.GetVigencias(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), DdlMarcas.SelectedValue.ToEntero(), DdlClasificaciones.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero())) { GvAcum.DataSource = ObjAcum.DtResultados; } ObjAcum.Dispose(); GvAcum.DataBind(); UpDatos.Update(); } /*protected void GvAcum_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowIndex == 0) { e.Row.Cells[0].Text = "Total"; e.Row.CssClass = "Totales"; } } }*/ }