public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PaySlipRPT rpt = new PaySlipRPT(); rpt.Site = this.Site; return(rpt); }
private void cmdShow_Click(object sender, EventArgs e) { try { DataTable dataSetReport = new DataTable(); BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports(); dataSetReport = myReports.getPaymentSlipS(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString()); dataSetReport.WriteXml("PaymentSlip.xml"); DataTable NewDt = myReports.getDayWiseGreenLeaf(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString()); NewDt.TableName = "DayLeaf"; NewDt.WriteXml("DayGreenLeaf.xml"); DataTable Newdt1 = myReports.getSalarySlipDetailItems(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString()); Newdt1.TableName = "SalaryItems"; Newdt1.WriteXml("SalaryItems.xml"); //GetCashBalance PaySlipRPT myaclist = new PaySlipRPT(); //BoughtleafPayslipRPT myaclist.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter; myaclist.SetDataSource(dataSetReport); myaclist.Subreports["Leaf"].SetDataSource(NewDt); myaclist.Subreports["Item"].SetDataSource(Newdt1); ReportViewer myReportViewer = new ReportViewer(); myaclist.SetParameterValue("year", cmbYear.Text); myaclist.SetParameterValue("month", cmbMonth.Text); myReportViewer.crystalReportViewer1.ReportSource = myaclist; myReportViewer.crystalReportViewer1.DisplayGroupTree = true; myReportViewer.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }