public ActionResult SurgeryRecordSummary()
        {
            var viewModel = new OperationTheatreSurgeryRecordSummary()
            {
                From        = DateTime.Now,
                To          = DateTime.Now,
                Departments = departmentDB.getAllDepartment()
            };

            return(View(viewModel));
        }
        public ActionResult SurgeryRecordSummary(OperationTheatreSurgeryRecordSummary viewModel)
        {
            if (Request.IsAjaxRequest())
            {
                ReportViewerVm reportVM      = new ReportViewerVm();
                ReportViewer   reportViewer  = new ReportViewer();
                string         reportDocPath = "";

                DataTable reportData = otOrderDB.getSurgeryRecordSummary(viewModel.From, viewModel.To.AddDays(1), viewModel.DoctorId, viewModel.DepartmentId, viewModel.SortMode, viewModel.IsWithQty);

                if (reportData.Rows.Count == 0)
                {
                    return(Content(Errors.ReportContent("NO RECORDS FOUND")));
                }


                if (viewModel.IsWithQty)
                {
                    reportDocPath = @"\Areas\ManagementReports\Reports\OperationTheatre\RptSurgeryRecordSummaryWithQty.rdl";
                }
                else
                {
                    reportDocPath = @"\Areas\ManagementReports\Reports\OperationTheatre\RptSurgeryRecordSummary.rdl";
                }


                //reportDocPath = @"\Areas\ManagementReports\Reports\OperationTheatre\RptSurgeryRecordSummary_final.rdl";


                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("from", viewModel.From.ToString("dd-MMM-yyyy")));
                reportViewer.LocalReport.SetParameters(new ReportParameter("to", viewModel.To.ToString("dd-MMM-yyyy")));
                reportViewer.LocalReport.SetParameters(new ReportParameter("aaaCompanyName", Global.OrganizationDetails.Name + " - " + Global.OrganizationDetails.City.ToUpper()));
                reportViewer.SizeToReportContent = true;
                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());
        }