public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { GratuitypayDataPreview rpt = new GratuitypayDataPreview(); rpt.Site = this.Site; return(rpt); }
private void btnPrint_Click(object sender, EventArgs e) { DataSet dataSetReport = new DataSet(); try { dataSetReport.Tables.Add(HoliPay.GetGratuityPayData(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.SelectedValue.ToString()))); if (dataSetReport.Tables[0].Rows.Count > 0) { dataSetReport.WriteXml("GratuityPayDataPreview.xml"); GratuitypayDataPreview myGPData = new GratuitypayDataPreview(); myGPData.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myGPData.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myGPData.SetParameterValue("Date", cmbYear.SelectedValue.ToString()); myGPData.SetParameterValue("Division", EstDivBlock.ListEstates().Rows[0][0].ToString() + " / " + cmbDivision.SelectedValue.ToString()); myReportViewer.crystalReportViewer1.ReportSource = myGPData; myReportViewer.Show(); } else { MessageBox.Show("No Data To Preview Gratuitypay, \r\n May be Confirmed"); } } catch (Exception ex) { MessageBox.Show("Error, " + ex.Message); } }