示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            ReportedeFacturas rpt = new ReportedeFacturas();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
文件: Form1.cs 项目: bilyfer/reportes
        private void button1_Click(object sender, EventArgs e)
        {
            CargarDatosDePrueba();

            switch (comboBox1.Text)
            {
            case "Ventas":
            {
                var bindingSource = new BindingSource();
                bindingSource.DataSource = _listaFacturas;

                var reporte = new ReportedeFacturas();
                reporte.SetDataSource(bindingSource);

                var facturaDetalle = new List <FacturaDetalle>();
                foreach (var factura in _listaFacturas)
                {
                    foreach (var detalle in factura.ListaFacturaDetalle)
                    {
                        facturaDetalle.Add(detalle);
                    }
                }

                reporte.Subreports[0].SetDataSource(facturaDetalle);

                crystalReportViewer1.ReportSource = reporte;
                break;
            }

            case "Reporte de Ventas Por Clientes":
            {
                var bindingSource = new BindingSource();
                bindingSource.DataSource = _listaClientes;

                var reporte = new ReporteClientes();
                reporte.SetDataSource(bindingSource);

                crystalReportViewer1.ReportSource = reporte;
                break;
            }

            default:
                break;
            }

            crystalReportViewer1.RefreshReport();
        }