private void LoadTestResultReport(TestResultsReportModel testResultModel) { ReportViewer.LocalReport.DataSources.Clear(); ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("TestResults", new BindingSource().DataSource = testResultModel.TestResultsViews)); ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("Patient", new BindingSource().DataSource = testResultModel.Patient)); ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("Options", new BindingSource().DataSource = testResultModel.OptionsModel)); if (testResultModel.LeftSignature != null) { ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("LeftSignature", new BindingSource().DataSource = testResultModel.LeftSignature)); } if (testResultModel.RightSignature != null) { ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("RightSignature", new BindingSource().DataSource = testResultModel.RightSignature)); } ReportViewer.RefreshReport(); }
public ActionResult Report(int PatientId) { try { string ReturnMessage = "Report Generated"; var TestReportDetailsList = PatientTestService.GetPatientTestsDetails(PatientId); var ReferDoctor = ReferDoctorsServices.GetPatientReferById(PatientId); var BranchName = Session["branch"].ToString(); var Patient = PatientServices.GetByPatientId(PatientId); var PatientDoctor = DoctorPatientServices.GetDoctorByPatientId(PatientId); var Refer = new ReferredModel() { ReferredDoctorName = ReferDoctor.ReferredDoctorName }; var Patientmodel = new PatientModel() { Id = Patient.Id, Name = Patient.PatientName, GenderDesc = Patient.Gender.GenderDescription, Age = Patient.Age, dateTime = Patient.DateTime.ToString() }; var patientDoctor = new UserModel() { Name = PatientDoctor.Name }; var ReportDetails = new TestResultsReportModel() { Branch = BranchName, PatientDoctor = patientDoctor, PatientInfo = Patientmodel, tests = TestReportDetailsList, ReferDoc = Refer }; // GeneratePatientReport(TestReportDetailsList, ReferDoctor, Patient, PatientDoctor, BranchName); return(Json(ReportDetails, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }