public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PRIOkgErrorsRPT rpt = new PRIOkgErrorsRPT(); rpt.Site = this.Site; return(rpt); }
private void btnPRIErrors_Click(object sender, EventArgs e) { DataTable dsDivisionReport = new DataTable(); //dsDivisionReport = myEmployeeDeduction.GetMonthPRINorms(cmbDivision.SelectedValue.ToString(), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1)).Tables[0]; dsDivisionReport = ProMWages.GetOkgPRI1(new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1), new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1), cmbDivision.SelectedValue.ToString(), cmbCropType.Text).Tables[0]; if (dsDivisionReport.Rows.Count > 0) { dsDivisionReport.WriteXml("MonthPRIOkgErrors.xml"); PRIOkgErrorsRPT objReport = new PRIOkgErrorsRPT(); objReport.SetDataSource(dsDivisionReport); ReportViewerForm objReportViewer = new ReportViewerForm(); objReport.SetParameterValue("Estate", EstDiv.ListEstates().Rows[0][0].ToString()); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Division", cmbDivision.SelectedValue.ToString()); objReport.SetParameterValue("Period", new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).ToShortDateString() + " To " + new DateTime(dateTimePicker1.Value.Date.Year, dateTimePicker1.Value.Date.Month, 1).AddMonths(1).AddDays(-1).ToShortDateString()); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No Data To Preview."); } }