public ActionResult SummaryOfCancelledAppointments(PolyClinicSummaryOfCancelledAppointments viewModel) { if (ModelState.IsValid) { if (Request.IsAjaxRequest()) { var cancelledReservations = new DataTable(); var reportFilePath = ""; if (viewModel.ReportOption == 0) { cancelledReservations = _clPolyClinicDB.getCancelledPatientReservationSummary(viewModel.StartDate, viewModel.EndDate.AddDays(1), viewModel.EmployeeId.HasValue ? viewModel.EmployeeId.Value : 0, (int)viewModel.PatientType); reportFilePath = @"\Areas\ManagementReports\Reports\PolyClinic\CancelledPatientReservationSummary.rdlc"; } else if (viewModel.ReportOption == 1) { cancelledReservations = _clPolyClinicDB.getCancelledPatientReservationSummaryByDoctor(viewModel.StartDate, viewModel.EndDate.AddDays(1), viewModel.DoctorId.HasValue ? viewModel.DoctorId.Value : 0, (int)viewModel.PatientType); reportFilePath = @"\Areas\ManagementReports\Reports\PolyClinic\CancelledPatientReservationSummaryByDoctor.rdlc"; } else { cancelledReservations = _clPolyClinicDB.getCancelledPatientReservationSummaryByDepartment(viewModel.StartDate, viewModel.EndDate.AddDays(1), viewModel.DepartmentId, (int)viewModel.PatientType); reportFilePath = @"\Areas\ManagementReports\Reports\PolyClinic\CancelledPatientReservationSummaryByDepartment.rdlc"; } if (cancelledReservations.Rows.Count > 0) { ReportViewer reportViewer = new ReportViewer(); ReportViewerVm reportVM = new ReportViewerVm(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + reportFilePath; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dsSummaryPatientReservation", cancelledReservations)); reportViewer = this.DynamicReportHeader(reportViewer, "DataSet2"); reportViewer.LocalReport.SetParameters(new ReportParameter("stDate", viewModel.StartDate.ToString("dd-MMM-yyyy"))); reportViewer.LocalReport.SetParameters(new ReportParameter("enDate", viewModel.EndDate.ToString("dd-MMM-yyyy"))); 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 RECORDS FOUND"))); } } } return(Content("")); }
public ActionResult BookedAppointment() { var viewModel = new PolyClinicSummaryOfCancelledAppointments() { StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), PatientTypeList = new List <KeyValuePair <DoctorSchedulePatientType, string> >() { new KeyValuePair <DoctorSchedulePatientType, string>(DoctorSchedulePatientType.ALL, DoctorSchedulePatientType.ALL.ToString()), new KeyValuePair <DoctorSchedulePatientType, string>(DoctorSchedulePatientType.IP, DoctorSchedulePatientType.IP.ToString()), new KeyValuePair <DoctorSchedulePatientType, string>(DoctorSchedulePatientType.OP, DoctorSchedulePatientType.OP.ToString()) }, DepartmentList = departmentDB.getAllDepartment(), ReportOption = 0 }; return(View(viewModel)); }