public ActionResult VaccinationEntryForm() { var viewModel = new FMRVaccinationReport() { DepartmentList = departmentDB.getAllDepartment() }; return(View(viewModel)); }
public ActionResult VaccinationEntryForm(FMRVaccinationReport viewModel) { string postype = Request.Form["PostType"]; if (Request.IsAjaxRequest()) { ReportViewerVm reportVM = new ReportViewerVm(); ReportViewer reportViewer = new ReportViewer(); string reportDocPath = ""; DataTable reportData = new DataTable(); if (postype == "PrintAllPending") { reportData = familymedDb.getPrintByPending(); reportDocPath = @"\Areas\ManagementReports\Reports\FamilyMedicineReports\Familymed_GetPending.rdl"; } if (postype == "PrintAllDone") { reportData = familymedDb.getPrintByAllDone(); reportDocPath = @"\Areas\ManagementReports\Reports\FamilyMedicineReports\Familymed_GetALL.rdl"; } if (postype == "PrintDepartment") { reportData = familymedDb.getPrintByDepartment(viewModel.DepartmentId); reportDocPath = @"\Areas\ManagementReports\Reports\FamilyMedicineReports\Familymed_GetByDepartment.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("from", viewModel.StartDate.ToString("dd-MMM-yyyy"))); //reportViewer.LocalReport.SetParameters(new ReportParameter("to", viewModel.EndDate.ToString("dd-MMM-yyyy"))); //reportViewer.LocalReport.SetParameters(new ReportParameter("patientTypeText", viewModel.PatientTypeText)); //reportViewer.LocalReport.SetParameters(new ReportParameter("billTypeText", viewModel.BillTypeText)); if (postype == "PrintDepartment") { string DeptName = Request.Form["DeptName"]; reportViewer.LocalReport.SetParameters(new ReportParameter("department", DeptName)); } reportViewer.LocalReport.SetParameters(new ReportParameter("branch", 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()); }