public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { EPF6MonthReportAll rpt = new EPF6MonthReportAll(); rpt.Site = this.Site; return(rpt); }
private void button1_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(cmbMonth.Text)) { MessageBox.Show("Select A Time Period."); } else { Int32 intChkAll = 0; Int32 intPeriod = 1; String StrAllDiv = "%"; if (cmbMonth.Text.Equals("Jan-Jun")) { intPeriod = 1; } else { intPeriod = 2; } if (chkAll.Checked) { intChkAll = 1; } if (this.chkAllDiv.Checked) { StrAllDiv = "%"; } else { StrAllDiv = cmbDivision.SelectedValue.ToString(); } DataSet dataSetReport = new DataSet(); dataSetReport = myReports.getEPF6Month(Convert.ToInt32(cmbYear.Text), intPeriod, intChkAll, StrAllDiv); dataSetReport.WriteXml("ePf6MonthReport.xml"); if (intChkAll == 1) { EPF6MonthReportAll myEPFRep = new EPF6MonthReportAll(); myEPFRep.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myEPFRep.SetParameterValue("Estate", FTSPayRollBL.Company.getCompanyName()); myEPFRep.SetParameterValue("Period", "January/2012" + " To " + "June/2012"); myReportViewer.crystalReportViewer1.ReportSource = myEPFRep; myReportViewer.Show(); } else { EPF6MonthReport myEPFRep = new EPF6MonthReport(); myEPFRep.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myEPFRep.SetParameterValue("Estate", FTSPayRollBL.Company.getCompanyName()); myEPFRep.SetParameterValue("Period", "January/2012" + " To " + "June/2012"); myReportViewer.crystalReportViewer1.ReportSource = myEPFRep; myReportViewer.Show(); } } } catch (Exception ex) { } }