public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            GreenLeafSummarySUPRPT rpt = new GreenLeafSummarySUPRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet dataSetReport = new DataSet();
                BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports();
                String strAllRoute = "%";
                if (!chkRoute.Checked)
                {
                    strAllRoute = cmbRoute.SelectedValue.ToString();
                }

                String strAllLeafType = "%";
                if (!chkAllType.Checked)
                {
                    strAllLeafType = cmbLeafType.Text;
                }

                dataSetReport = myReports.getGreenLeafSummary(Convert.ToInt32(cmbYear.SelectedValue.ToString()), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), strAllRoute, strAllLeafType);


                dataSetReport.WriteXml("GreenLeafSummary.xml");
                GreenLeafSummarySUPRPT myaclist = new GreenLeafSummarySUPRPT();
                myaclist.SetDataSource(dataSetReport);
                ReportViewer myReportViewer = new ReportViewer();
                if (chkRoute.Checked == true)
                {
                    myaclist.SetParameterValue("Route", "All Routes");
                }
                else
                {
                    myaclist.SetParameterValue("Route", cmbRoute.Text);
                }

                myaclist.SetParameterValue("Year", cmbYear.Text);
                myaclist.SetParameterValue("Month", cmbMonth.Text);
                myaclist.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
                myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                myReportViewer.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }