public void GenerateReport() { int DriverId = ddlDriver.SelectedValue.ToInt(); int companyId = ddlCompany.SelectedValue.ToInt(); DateTime?fromDate = dtpFromDate.Value.ToDate(); DateTime?tillDate = dtpTillDate.Value.ToDate(); string error = string.Empty; if (fromDate == null) { if (string.IsNullOrEmpty(error)) { error += Environment.NewLine; } error += "Required : From Date"; } if (tillDate == null) { if (string.IsNullOrEmpty(error)) { error += Environment.NewLine; } error += "Required : To Date"; } if (!string.IsNullOrEmpty(error)) { ENUtils.ShowMessage(error); return; } //this.Period = "For the Period : " + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate); int paymenttype = 0; if (opBoth.IsChecked) { paymenttype = 0; } if (opCash.IsChecked) { paymenttype = Enums.PAYMENT_TYPES.CASH; } // ReInitializeReportViewer(); string reportPath = "Taxi_AppMain.ReportDesigns."; if (objSubCompany == null) { objSubCompany = AppVars.objSubCompany; } reportViewer1.LocalReport.EnableExternalImages = true; Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[4]; string address = objSubCompany.Address; string telNo = "Tel No. " + objSubCompany.TelephoneNo; UM_Form_Template objTemplate = General.GetObject <UM_Form_Template>(c => c.UM_Form.FormName == this.Name && c.IsDefault == true); string FromDate = string.Empty; string ToDate = string.Empty; FromDate = string.Format("{0:MMMM dd,yyyy}", dtpFromDate.Value); ToDate = string.Format("{0:MMMM dd,yyyy}", dtpTillDate.Value); //List<ClsLogo> objLogo = new List<ClsLogo>(); //objLogo.Add(new ClsLogo { ImageInBytes = objSubCompany.CompanyLogo != null ? objSubCompany.CompanyLogo.ToArray() : null }); //ClsLogoBindingSource.DataSource = objLogo; param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyName", objSubCompany.CompanyName.ToStr().Trim()); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_FromDate", FromDate); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_ToDate", ToDate); param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_ReportDate", DateTime.Now.ToString()); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.LocalReport.ReportEmbeddedResource = reportPath + "rptDriverCommissionDetailReport.rdlc"; using (TaxiDataContext db = new TaxiDataContext()) { this.stp_DriverCommisionDetailReportResultBindingSource.DataSource = db.stp_DriverCommisionDetailReport(fromDate, tillDate, DriverId, paymenttype, companyId).ToList(); } this.reportViewer1.ZoomPercent = 100; this.reportViewer1.SetDisplayMode(DisplayMode.Normal); this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.LocalReport.Refresh(); this.reportViewer1.Refresh(); }