Пример #1
0
    protected void btnGenerarReporte_Click(object sender, EventArgs e)
    {
        DateTime?fechaInicio          = null;
        DateTime?fechaFin             = null;
        string   productos            = Utils.ObtenerIdsSeleccionados(lbxProducto);
        string   configuracionReporte = "";

        if (txtFechaInicioVigencia.Text != "")
        {
            fechaInicio = DateTime.ParseExact(txtFechaInicioVigencia.Text, "yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture);
        }
        if (txtFechaFinVigencia.Text != "")
        {
            fechaFin = DateTime.ParseExact(txtFechaFinVigencia.Text, "yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture);
        }

        if (("," + productos + ",").Contains(",ALL,"))
        {
            configuracionReporte += "MOSTRAR_COLUMNA_DEPARTAMENTO=1,MOSTRAR_COLUMNA_CIUDAD=1,MOSTRAR_COLUMNA_PRODUCTO=1";
        }

        DataTable dsReporte = Reporte.GenerarInformeProduccionNueva(Utils.ObtenerIdsSeleccionados(lbxCompania), productos,
                                                                    Utils.ObtenerIdsSeleccionados(lbxEstadoNegocio), Utils.ObtenerIdsSeleccionados(lbxDepartamento), Utils.ObtenerIdsSeleccionados(lbxCiudad), fechaInicio, fechaFin);

        Utils.DeshabilitarFormatoExportacion(rvReporte, new string[] { "PDF", "WORD", "WORDOPENXML" });

        rvReporte.ProcessingMode         = ProcessingMode.Local;
        rvReporte.LocalReport.ReportPath = Server.MapPath("~/App_Code/Reportes/InformeProduccionNueva.rdlc");

        ReportParameter configuracionParameter = new ReportParameter("Configuraciones", configuracionReporte);

        rvReporte.LocalReport.SetParameters(new ReportParameter[] { configuracionParameter });

        ReportDataSource datasourceResultado1 = new ReportDataSource("dsReporte", dsReporte);

        rvReporte.LocalReport.DataSources.Clear();
        rvReporte.LocalReport.DataSources.Add(datasourceResultado1);
    }