public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { GreenLeafSummaryDivisionWise rpt = new GreenLeafSummaryDivisionWise(); rpt.Site = this.Site; return(rpt); }
private void btnDivWiseSummery_Click(object sender, EventArgs e) { String strAllDiv = ""; String strAllCategory = "1"; if (chkAllCategory.Checked) { strAllCategory = "%"; } else { strAllCategory = cmbEmployeeCategory.SelectedValue.ToString(); } //if(chkAllDivisions.Checked) //{ // strAllDiv = "%"; //} //else //{ // strAllDiv = cmbDivision.SelectedValue.ToString(); //} strAllDiv = "%"; try { dataSetReport = myReports.getFieldWiseGreenLeafSummery(strAllDiv, strAllCategory, dtpStartDate.Value, dtpEndDate.Value); dataSetReport.WriteXml("GreenLeafFieldWiseSummery.xml"); if (dataSetReport.Tables[0].Rows.Count > 0) { GreenLeafSummaryDivisionWise myGLSummFieldWise = new GreenLeafSummaryDivisionWise(); myGLSummFieldWise.SetDataSource(dataSetReport); ReportViewer myReportViewer = new ReportViewer(); myGLSummFieldWise.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myGLSummFieldWise.SetParameterValue("Estate", myDivision.ListEstate().Rows[0][1].ToString()); myGLSummFieldWise.SetParameterValue("Division", "ALL"); myGLSummFieldWise.SetParameterValue("DateRange", "From: " + dtpStartDate.Value.ToShortDateString() + " To :" + dtpEndDate.Value.ToShortDateString()); myReportViewer.crystalReportViewer1.ReportSource = myGLSummFieldWise; myReportViewer.Show(); } else { MessageBox.Show("No data to preview..!"); } } catch (Exception ex) { MessageBox.Show("Error On Get Data, " + ex.Message); } }