public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PaymentDetailsSummaryRPT rpt = new PaymentDetailsSummaryRPT(); rpt.Site = this.Site; return(rpt); }
private void btnSummary_Click(object sender, EventArgs e) { try { String strParamDiv = "All Division"; String strDivision = "%"; if (!chkAllDivisions.Checked) { strDivision = cmbDivision.SelectedValue.ToString(); strParamDiv = cmbDivision.SelectedValue.ToString(); } DataSet ds = new DataSet(); //dt = myRep.GetAmalgamation(cmbYear.Text, month); ds = myReports.PaymentDetailsSummary(strDivision, dtpFrom.Value.Date, dtpTo.Value.Date); if (ds.Tables[0].Rows.Count > 0) { ds.WriteXml("PaymentDetailsSummary.xml"); PaymentDetailsSummaryRPT myReport = new PaymentDetailsSummaryRPT(); myReport.SetDataSource(ds); ReportViewer myViewer = new ReportViewer(); myReport.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName()); myReport.SetParameterValue("Estate", "Estate :" + myDiv.ListEstates().Rows[0][0].ToString() + " - Division:" + strParamDiv); myReport.SetParameterValue("Period", "From:" + dtpFrom.Value.Date.ToShortDateString() + " To:" + dtpTo.Value.Date.ToShortDateString()); myViewer.crystalReportViewer1.ReportSource = myReport; myViewer.Show(); } else { MessageBox.Show("No Data Preview..!"); } } catch (Exception ex) { MessageBox.Show("Error Occurred..!" + ex.Message); } }