Exemple #1
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            DateTime         ini      = Convert.ToDateTime(txtFechaInicio.Text);
            DateTime         fin      = Convert.ToDateTime(txtFechaFin.Text);
            List <Ventas>    detalles = VentasBLL.GetVentasBetweenDates(ini, fin);
            ReportDataSource dt       = new ReportDataSource("VentasPeriodos", detalles);
            ReportParameter  pYear    = new ReportParameter("dtInicio", txtFechaInicio.Text);
            ReportParameter  pMonth   = new ReportParameter("dtFin", txtFechaFin.Text);

            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { pYear });
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { pMonth });
            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(dt);
            this.reportViewer1.RefreshReport();
        }