public ActionResult PatientCriticalDiagnosis()
        {
            var viewModel = new QpsPatientCriticalDiagnosis()
            {
                //StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
                EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
            };

            return(View(viewModel));
        }
        public ActionResult PatientCriticalDiagnosis(QpsPatientCriticalDiagnosis qpspatientcritical)
        {
            var vm = qpspatientcritical;

            if (Request.IsAjaxRequest())
            {
                ReportViewerVm reportVM      = new ReportViewerVm();
                ReportViewer   reportViewer  = new ReportViewer();
                string         reportDocPath = "";
                string         headermsg     = "";
                DataTable      reportData    = new DataTable();

                if (vm.stroption == "1")
                {
                    headermsg = vm.strName + " " + vm.EndDate.ToString("dd-MMM-yyyy");
                }
                else if (vm.stroption == "2")
                {
                    headermsg = vm.strName + " " + vm.EndDate.ToString("dd-MMM-yyyy");
                }
                else
                {
                    headermsg  = "Current In-Patient";
                    vm.EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                }

                reportData    = qpsreportDb.getPatientCriticalDiagnosis(vm.EndDate, vm.stroption.ToString());
                reportDocPath = @"\Areas\ManagementReports\Reports\QpsReports\Report_QpsPatientCriticalDiagnosis.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("stdate", vm.E.ToString("dd-MMM-yyyy")));

                reportViewer.LocalReport.SetParameters(new ReportParameter("strName", headermsg));
                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());
        }