public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { HolidaypayRPT2 rpt = new HolidaypayRPT2(); rpt.Site = this.Site; return(rpt); }
private void btnRPT2_Click(object sender, EventArgs e) { DataSet dataSetReport = new DataSet(); try { String strDivision = "%"; if (chkAll.Checked) { strDivision = "%"; } else { strDivision = cmbDivision.SelectedValue.ToString(); } cmbYear_SelectedIndexChanged(null, null); //dataSetReport.Tables.Add(HoliPay.GetHolidayPayData(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.SelectedValue.ToString()))); dataSetReport = HoliPay.ListHolidaypayMandaysEarningsNotOffered(dtpFrom.Value.Date, dtpTo.Value.Date, strDivision); if (dataSetReport.Tables[0].Rows.Count > 0) { dataSetReport.WriteXml("HolidaypayRPT2.xml"); HolidaypayRPT2 myHPData = new HolidaypayRPT2(); myHPData.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myHPData.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myHPData.SetParameterValue("Division", EstDivBlock.ListEstates().Rows[0][0].ToString() + " / " + cmbDivision.SelectedValue.ToString()); myHPData.SetParameterValue("Year", cmbYear.SelectedValue.ToString()); myReportViewer.crystalReportViewer1.ReportSource = myHPData; myReportViewer.Show(); } else { MessageBox.Show("No Data To Preview\r\nMay Be Holidaypay Data Already Confirmed"); } } catch (Exception ex) { MessageBox.Show("Error, " + ex.Message); } }