public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { DeductionAccNoList rpt = new DeductionAccNoList(); rpt.Site = this.Site; return(rpt); }
private void button2_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); ReportViewer myReportViewer = new ReportViewer(); if (chkAll.Checked) { ds = myReport.LoanDeductionList(cmbYear.Text, cmbMonth.SelectedValue.ToString(), cmbDeductionGroup.SelectedValue.ToString(), cmbDeduction.SelectedValue.ToString()); if (ds.Tables[0].Rows.Count > 0) { ds.WriteXml("DeductionList.xml"); DeductionAccNoList myDeducReport = new DeductionAccNoList(); myDeducReport.SetDataSource(ds); myDeducReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); myDeducReport.SetParameterValue("Estate", "Estate :" + myDiv.ListEstate().Rows[0][1].ToString()); myDeducReport.SetParameterValue("Division", "Division : For all Divisions"); myDeducReport.SetParameterValue("Period", "For the Month of :" + cmbMonth.Text + " / " + cmbYear.Text); myDeducReport.SetParameterValue("Deduction", "Bank Loan Recovery - " + myDeduction.GetLoanName(cmbDeduction.SelectedValue.ToString())); myReportViewer.crystalReportViewer1.ReportSource = myDeducReport; myReportViewer.Show(); } else { MessageBox.Show("No Data to Preview..!"); } } else { ds = myReport.LoanDeductionList(cmbDivision.Text, cmbYear.Text, cmbMonth.SelectedValue.ToString(), cmbDeduction.SelectedValue.ToString(), cmbDeductionGroup.SelectedValue.ToString()); if (ds.Tables[0].Rows.Count > 0) { ds.WriteXml("DeductionList.xml"); DeductionAccNoList myDeducReport = new DeductionAccNoList(); myDeducReport.SetDataSource(ds); myDeducReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); myDeducReport.SetParameterValue("Estate", "Estate :" + myDiv.ListEstate().Rows[0][1].ToString()); myDeducReport.SetParameterValue("Division", "Division : " + cmbDivision.Text); myDeducReport.SetParameterValue("Period", "For the Month of :" + cmbMonth.Text + " / " + cmbYear.Text); myDeducReport.SetParameterValue("Deduction", "Bank Loan Recovery - " + myDeduction.GetLoanName(cmbDeduction.SelectedValue.ToString())); myReportViewer.crystalReportViewer1.ReportSource = myDeducReport; myReportViewer.Show(); } else { MessageBox.Show("No Data to Preview..!"); } } }