public ActionResult AvgLengthStayCriticalAreas() { var viewModel = new AvgLengthStayCriticalAreas() { StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), DepartmentList = departmentDB.getAllDepartment(), //BillTypes = new List<KeyValuePair<int, string>>{ // new KeyValuePair<int, string>(0,"ALL"), // new KeyValuePair<int, string>(1,"DISCHARGED"), // new KeyValuePair<int, string>(2,"UNDISCHARGED") // } }; return(View(viewModel)); }
public ActionResult AvgLengthStayCriticalAreas(AvgLengthStayCriticalAreas averagelenthareas) { var vm = averagelenthareas; if (Request.IsAjaxRequest()) { ReportViewerVm reportVM = new ReportViewerVm(); ReportViewer reportViewer = new ReportViewer(); string reportDocPath = ""; DataTable reportData = new DataTable(); reportData = qpsreportDb.getAvgLengthCriticalArea(vm.StartDate, vm.EndDate.AddDays(1), vm.DepartmentId, vm.Area); reportDocPath = @"\Areas\ManagementReports\Reports\QpsReports\Report_QpsAvgLengthCriticalArea.rdl"; if (reportData.Rows.Count == 0) { return(Content(Errors.ReportContent("NO RECORDS FOUND"))); } reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + reportDocPath; ReportDataSource datasourceItem = new ReportDataSource("DataSet1", reportData); reportViewer.LocalReport.DataSources.Add(datasourceItem); reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", vm.StartDate.ToString("dd-MMM-yyy"))); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", vm.EndDate.ToString("dd-MMM-yyy"))); reportViewer.LocalReport.SetParameters(new ReportParameter("Dept", vm.DeptName.ToString())); reportViewer.LocalReport.SetParameters(new ReportParameter("Area", vm.Area.ToString())); reportViewer.LocalReport.SetParameters(new ReportParameter("branch", Global.OrganizationDetails.Name + " - " + Global.OrganizationDetails.City.ToUpper())); reportViewer.SizeToReportContent = true; reportViewer.Height = Unit.Percentage(100); reportViewer.Width = Unit.Percentage(100); reportViewer.ShowPrintButton = true; reportVM.ReportViewer = reportViewer; System.Web.HttpContext.Current.Session[Global.ReportViewerSessionName] = reportViewer; System.Web.HttpContext.Current.Session[Global.PdfUriSessionName] = Common.Helper.getApplicationUri("Preview", "Print", null); return(PartialView("~/Views/Shared/_reportViewer.cshtml", reportVM)); } return(View()); }