public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PaymentCheckRollRPT rpt = new PaymentCheckRollRPT(); rpt.Site = this.Site; return(rpt); }
private void cmdDisplay_Click(object sender, EventArgs e) { String AllCat = "%"; if (chkAllCat.Checked) { AllCat = "%"; } else { AllCat = cmbEmpCat.SelectedValue.ToString(); } try { if (chkAllDivisions.Checked == true) { dataSetReport = myReports.getPaymentCheckRoll(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), AllCat); dataSetReport.WriteXml("PaymentCheckRoll.xml"); if (dataSetReport.Tables[0].Rows.Count > 0) { PaymentCheckRollRPT myaclist = new PaymentCheckRollRPT(); myaclist.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myaclist.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myaclist.SetParameterValue("Estate", myDivision.ListEstate().Rows[0][1].ToString()); myaclist.SetParameterValue("paramDivision", "ALL"); myaclist.SetParameterValue("paramYearMonth", cmbMonth.Text + " / " + cmbYear.Text); myReportViewer.crystalReportViewer1.ReportSource = myaclist; myReportViewer.Show(); } else { MessageBox.Show("No Data to Preview..!"); } } else { dataSetReport = myReports.getPaymentCheckRoll(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), AllCat); dataSetReport.WriteXml("PaymentCheckRoll.xml"); if (dataSetReport.Tables[0].Rows.Count > 0) { PaymentCheckRollRPT myaclist = new PaymentCheckRollRPT(); myaclist.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myaclist.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myaclist.SetParameterValue("Estate", myDivision.ListEstate().Rows[0][1].ToString()); myaclist.SetParameterValue("paramDivision", cmbDivision.Text); myaclist.SetParameterValue("paramYearMonth", cmbMonth.Text + " / " + cmbYear.Text); myReportViewer.crystalReportViewer1.ReportSource = myaclist; myReportViewer.Show(); } else { MessageBox.Show("No Data to Preview..!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }