public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { DailyFieldSummaryRPT rpt = new DailyFieldSummaryRPT(); rpt.Site = this.Site; return(rpt); }
private void btnPrint_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); //dt = myRep.GetAmalgamation(cmbYear.Text, month); dt = DFieldSummary.ListDailyFieldSummary(cmbDivision.SelectedValue.ToString(), Convert.ToDateTime(dateTimePicker1.Value.Date.ToShortDateString())); if (dt.Rows.Count > 0) { DataSet ds = new DataSet(); ds.Tables.Add(dt); ds.WriteXml("DailyFieldSummaryRep.xml"); DailyFieldSummaryRPT myReport = new DailyFieldSummaryRPT(); myReport.SetDataSource(ds); ReportViewer myViewer = new ReportViewer(); //myReport.SetParameterValue("Estate", "Estate :" + myDivi.ListEstates().Rows[0][0].ToString()+" Division:"+cmbDivision.SelectedValue.ToString()); //myReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); //myReport.SetParameterValue("Date:", dateTimePicker1.Value.Date.ToShortDateString()); myReport.SetParameterValue("Estate", "Estate :" + myDivi.ListEstates().Rows[0][0].ToString() + "/ Division:" + cmbDivision.SelectedValue.ToString()); myReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); myReport.SetParameterValue("EntryDate", "Date :" + dateTimePicker1.Value.Date.ToShortDateString()); myViewer.crystalReportViewer1.ReportSource = myReport; myViewer.Show(); } else { MessageBox.Show("No Data Preview..!"); } } catch (Exception ex) { MessageBox.Show("Error Occurred..!" + ex.Message); } }