using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI.WebControls; using Extensiones; using System.Data; using static Extensiones.ModExtensiones; using Microsoft.Reporting.WebForms; using System.Web.UI.HtmlControls; using System.Text; public partial class Ventas_RepVentasAutorizaciones : ClsPaginas { #region PROPIEDADES private DataTable DtDatos { get { return DtDatos = (DataTable)ViewState["DtDatos"]; } set { ViewState["DtDatos"] = value; } } private bool Consultado { get { return Consultado = (bool)ViewState["Consultado"]; } set { ViewState["Consultado"] = value; } } #endregion protected void LnkExcel_Click(object sender, EventArgs e) { if (Consultado) { GvDatos.ExportToExcelG("RepVentasAutorizaciones" + NowADS().ToString("dd-MM-yyyy"), "Reporte de Autorizaciones de Ventas", UsuarioActual); } else { Alert("Por favor realice una consulta primero."); } } protected void LnkPdf_Click(object sender, EventArgs e) { if (Consultado) { GvDatos.GenerarReportePDF("Reporte de Autorizaciones de Ventas"); } else { Alert("Por favor realice una consulta primero."); } } public override void VerifyRenderingInServerForm(System.Web.UI.Control control) { } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Consultado = false; InicializaValores(); } } private void InicializaValores() { //Carga SubProyectos DdlSubProyecto.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1); DdlSubProyecto.DataBind(); //Carga Usuarios DdlUsuario.DataSource = get_GlobalDTUsuarios(-1,UsuarioActual.CveEmpresa); DdlUsuario.DataBind(); //Carga Estatus Factura //DdlEstatusFactura DdlClientes.setEsWebService(true); txtFechaI.Text = NowADS().ToShortDateString(); txtFechaF.Text = NowADS().ToShortDateString(); } protected void BtnConsultar_Click(object sender, EventArgs e) { Consulta(); Consultado = true; } private void Consulta() { ClsVentas ObjVentas = new ClsVentas(); int CveCliente = (DdlClientes.SelectedValue.ToEntero() > 0) ? DdlClientes.SelectedValue.ToEntero() : -1; if (ObjVentas.GetReporteVentasAutorizaciones(DdlUsuario.SelectedValue.ToEntero(), DdlEstatusFactura.SelectedValue.ToEntero(), DdlSubProyecto.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), CveCliente, UsuarioActual.CveEmpresa )) { GvDatos.DataSource = ObjVentas.DtResultados; DtDatos = ObjVentas.DtResultados; } ObjVentas.Dispose(); GvDatos.DataBind(); UpDatos.Update(); } }