public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { DeductionSearchIncludingSkippedRPT rpt = new DeductionSearchIncludingSkippedRPT(); rpt.Site = this.Site; return(rpt); }
private void button1_Click(object sender, EventArgs e) { String strAllDiv = "%"; String strAllEmp = "%"; String strAllDeductCode = "%"; String ReportName = ""; ReportViewer myReportViewer = new ReportViewer(); if (!chkAll.Checked) { strAllDiv = cmbDivision.SelectedValue.ToString(); ReportName = cmbDivision.SelectedValue.ToString() + " Division -"; } else { ReportName = "All Division - "; } if (!chkAllEmp.Checked) { strAllEmp = cmbEmpNo.SelectedValue.ToString(); ReportName += cmbEmpNo.SelectedValue.ToString() + " Employee - "; } else { ReportName += " All Employees - "; } if (!chkAllDeduction.Checked) { strAllDeductCode = cmbDeductCode.SelectedValue.ToString(); ReportName += cmbDeductCode.SelectedValue.ToString() + " Deduction "; } else { ReportName += " All Deductions "; } DataSet DsDeductSearch = new DataSet(); DsDeductSearch = myDeducSearch.GetDeductionSearchDataIncludingSkippedDeductions(strAllDiv, strAllDeductCode, strAllEmp, cmbYear.SelectedValue.ToString(), cmbMonth.SelectedValue.ToString()); if (DsDeductSearch.Tables[0].Rows.Count > 0) { DsDeductSearch.WriteXml("DeductionSearchDataIncludeSkipped.xml"); DeductionSearchIncludingSkippedRPT myAllDeducAllEmp = new DeductionSearchIncludingSkippedRPT(); myAllDeducAllEmp.SetDataSource(DsDeductSearch); myAllDeducAllEmp.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); myAllDeducAllEmp.SetParameterValue("Estate", "Estate :" + myEstateDiv.ListEstates().Rows[0][0].ToString()); myAllDeducAllEmp.SetParameterValue("Division", "Division :" + cmbDivision.Text); myAllDeducAllEmp.SetParameterValue("Period", "For the Month of :" + cmbMonth.Text + " / " + cmbYear.Text); myAllDeducAllEmp.SetParameterValue("RepName", ReportName); myReportViewer.crystalReportViewer1.ReportSource = myAllDeducAllEmp; myReportViewer.Show(); } else { MessageBox.Show("No Data to Preview..!"); } }