public ActionResult OPPatientCount(PolyClinicOPPatientCount viewModel)
        {
            if (Request.IsAjaxRequest())
            {
                var opdpatientcountModel = _clPolyClinicDB.OPPatientCount(viewModel.StartDate.ToString("dd-MMM-yyyy"), viewModel.EndDate.AddDays(1).ToString("dd-MMM-yyyy"), (int)viewModel.OPDSelection);

                if (opdpatientcountModel.Rows.Count > 0)
                {
                    ReportViewerVm reportVM     = new ReportViewerVm();
                    ReportViewer   reportViewer = new ReportViewer();
                    reportViewer.ProcessingMode = ProcessingMode.Local;
                    var description = "";
                    if (viewModel.OPDSelection == OPDSelectionCount.PATIENTVISITCOUNT)
                    {
                        description = "Number of Patient Visited the Hospital Report";
                    }
                    else if (viewModel.OPDSelection == OPDSelectionCount.PATIENTREVISITCOUNT)
                    {
                        description = "Patient Revisit Against Total Number/Department Report";
                    }
                    else
                    {
                        description = "Number of New Patients Visited the Hospital Report";
                    }

                    reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PolyClinic\OpPatientVisitCount.rdl";
                    reportViewer.LocalReport.SetParameters(new ReportParameter("FromDate", viewModel.StartDate.ToString("dd-MMM-yyyy")));
                    reportViewer.LocalReport.SetParameters(new ReportParameter("ToDate", viewModel.EndDate.ToString("dd-MMM-yyyy")));
                    reportViewer.LocalReport.SetParameters(new ReportParameter("Label", description));

                    reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dsOPDPatientCount", opdpatientcountModel));
                    reportViewer = this.DynamicReportHeader(reportViewer, "DataSet2");
                    reportViewer.SizeToReportContent = true;
                    reportViewer.Width    = Unit.Percentage(100);
                    reportViewer.Height   = Unit.Percentage(100);
                    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));
                }
                else
                {
                    return(Content(Errors.ReportContent("NO RECORD FOUND")));
                }
            }


            return(Content(""));
        }
        public ActionResult OPPatientCount()
        {
            var viewModel = new PolyClinicOPPatientCount()
            {
                StartDate        = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
                EndDate          = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
                OPDSelectionList = new List <KeyValuePair <OPDSelectionCount, string> >()
                {
                    new KeyValuePair <OPDSelectionCount, string>(OPDSelectionCount.PATIENTVISITCOUNT, "Patient Visits Count"),
                    new KeyValuePair <OPDSelectionCount, string>(OPDSelectionCount.PATIENTREVISITCOUNT, "Patient Revisits Count"),
                    new KeyValuePair <OPDSelectionCount, string>(OPDSelectionCount.NEWPATIENTCOUNT, "New Patient Count")
                },
                OPDSelection = OPDSelectionCount.PATIENTVISITCOUNT
            };


            return(View(viewModel));
        }