public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CashPaymentAllListRPT rpt = new CashPaymentAllListRPT(); rpt.Site = this.Site; return(rpt); }
private void cmdDisplay_Click(object sender, EventArgs e) { try { DataSet dataSetReport = new DataSet(); if (allCheck.Checked) { BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports(); dataSetReport = myReports.getCashPaymentAllList(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())); dataSetReport.WriteXml("CashPaymentAllList.xml"); CashPaymentAllListRPT myaclist = new CashPaymentAllListRPT(); myaclist.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myaclist.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName()); myaclist.SetParameterValue("Period", "Period : " + cmbYear.Text + " / " + cmbMonth.Text); myReportViewer.crystalReportViewer1.ReportSource = myaclist; myReportViewer.Show(); } else { BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports(); dataSetReport = myReports.getCashPaymentList(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), (cmbRoute.SelectedValue.ToString())); dataSetReport.WriteXml("CashPaymentAllList.xml"); CashPaymentAllListRPT myaclist = new CashPaymentAllListRPT(); myaclist.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myaclist.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName()); myaclist.SetParameterValue("Period", "Period : " + cmbYear.Text + " / " + cmbMonth.Text); myReportViewer.crystalReportViewer1.ReportSource = myaclist; myReportViewer.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }