public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { EasyWeighDailyHarvestRegisterRPT rpt = new EasyWeighDailyHarvestRegisterRPT(); rpt.Site = this.Site; return(rpt); }
private void btnDisplay_Click(object sender, EventArgs e) { try { DataSet ds = new DataSet(); ds = objDownloadData.getEasyWeighHarvestRegister(cmbDivision.SelectedValue.ToString(), dtDate.Value.Date); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { ds.WriteXml("EasyWeighDailyHarvestRegister.xml"); EasyWeighDailyHarvestRegisterRPT objReport = new EasyWeighDailyHarvestRegisterRPT(); objReport.SetDataSource(ds); objReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); objReport.SetParameterValue("Date", "Date : " + dtDate.Value.Date); objReport.SetParameterValue("Division", "Division : " + cmbDivision.SelectedValue.ToString()); ReportViewer objReportViewer = new ReportViewer(); objReportViewer.crystalReportViewer1.ReportSource = objReport; objReportViewer.Show(); } else { MessageBox.Show("No data to preview.!"); } } else { MessageBox.Show("No data to preview.!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }