public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CoinAnalysisRPT rpt = new CoinAnalysisRPT(); rpt.Site = this.Site; return(rpt); }
private void button1_Click(object sender, EventArgs e) { if (allCheck.Checked) { try { //int chkresult = ChkNotes.CheckState == CheckState.Checked ? 1 : 0; DataTable dt = new DataTable(); //BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports(); //myReports.Note = Convert.ToInt32(ChkNotes.CheckState == CheckState.Checked ? 1 : 0).ToString(); dt = myReports.getCashAmountAll(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), ChkNotes.CheckState == CheckState.Checked ? 1 : 0); dt.TableName = "Coin"; dt.WriteXml("CoinAnalysis.xml"); CoinAnalysisRPT myaclist = new CoinAnalysisRPT(); myaclist.SetDataSource(dt); ReportViewer myReportViewer = new ReportViewer(); myaclist.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName()); myaclist.SetParameterValue("Period", "Period : " + cmbYear.Text + " / " + cmbMonth.Text); myaclist.SetParameterValue("Route", "ALL"); myReportViewer.crystalReportViewer1.ReportSource = myaclist; myReportViewer.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { try { DataTable dt = new DataTable(); BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports(); dt = myReports.getCashAmount(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), (cmbRoute.SelectedValue.ToString()), ChkNotes.CheckState == CheckState.Checked ? 1 : 0); //dt.Columns.Add(cmbRoute.Text.ToString()); dt.TableName = "Coin"; dt.WriteXml("CoinAnalysis.xml"); CoinAnalysisRPT myaclist = new CoinAnalysisRPT(); myaclist.SetDataSource(dt); ReportViewer myReportViewer = new ReportViewer(); myaclist.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName()); myaclist.SetParameterValue("Period", "Period : " + cmbYear.Text + " / " + cmbMonth.Text); myaclist.SetParameterValue("Route", cmbRoute.Text.ToString()); myReportViewer.crystalReportViewer1.ReportSource = myaclist; myReportViewer.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }