private void GenerateReport() { try { int driverid = ddl_Driver.SelectedValue.ToInt(); int SubCompanyId = ddlSubCompany.SelectedValue.ToInt(); string Error = string.Empty; if (SubCompanyId == 0 && !chkAllSubCompany.Checked) { Error = "Required : SubCompany"; } if (driverid == 0 && !chkAllDriver.Checked) { if (string.IsNullOrEmpty(Error)) { Error = "Required : Driver"; } else { Error += Environment.NewLine + "Required : Driver"; } } if (!string.IsNullOrEmpty(Error)) { ENUtils.ShowMessage(Error); return; } using (TaxiDataContext db = new TaxiDataContext()) { if (optCommission.Checked) { SubCompanyId = -1; } var list = db.stp_GetDriverRentReconciliation(SubCompanyId, driverid).ToList(); list = (list.AsEnumerable().OrderBy(item => item.DriverNo, new NaturalSortComparer <string>())).ToList(); this.stp_GetDriverRentReconciliationResultBindingSource.DataSource = list; } Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[3]; string address = AppVars.objSubCompany.Address; string telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo; param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeader", AppVars.objSubCompany.CompanyName.ToStr()); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address); //Report_Parameter_AverageJobsPerDay //string heading = string.Empty; //if (fromDate != null && tillDate != null) //{ // heading = string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate); //} //param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Criteria", heading); //param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AverageJobsPerDay", s.ToStr()); //param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AverageWorkingPerDay", sWorking); List <ClsLogo> objLogo = new List <ClsLogo>(); objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); IsReportLoaded = true; } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }