public async Task <IActionResult> GeneratePdfEmployeeExpense(string UserName, string MonthYear) { PDFViewModel pdfVM; try { //Get PDF HTML var getPdfHtml = await _unitOfWork.AdminDashboard.GetEmployeeExpenseForPDF(UserName, MonthYear); //Set FileName string fileName = $"{UserName}_{ MonthYear}_{DateTime.Now.ToString("ddmmyyyy")}{DateTime.Now.Millisecond}.pdf"; //Generate PDF GeneratePDF generatePDF = new GeneratePDF(_converter, _host); byte[] file = generatePDF.GetPdfFile(fileName, getPdfHtml, "PDF Report", "For PSR", "Signature of PSR"); string fullfilePath = Path.Combine(_host.WebRootPath, "Downloads", fileName); pdfVM = new PDFViewModel() { File = file.ToArray(), FileName = fileName }; } catch (Exception Ex) { throw Ex; } return(Ok(pdfVM)); }
public ActionResult Index(string encountertype) { userId = Session["UserId"].ToString(); var Pdfviewmodel = new PDFViewModel(); var encttype = encountertype.ToString(); if (encttype == "P") { if (userId != "a8a56c1d-203c-4c53-9d95-972dec7a2ef5" || userId == "f40ca8e9-dc6c-44de-9936-266249a7a201" || userId == "a24e6d62-414d-4434-bbe3-b3eec3a026e7") { encttype = "I,A"; } Pdfviewmodel.Reporttitle = "Inpatient and Ambulatory report for"; } else if (encttype == "I") { Pdfviewmodel.Reporttitle = "Inpatient Patient Summary Report for"; } else if (encttype == "A") { Pdfviewmodel.Reporttitle = "Ambulatory Patient Summary Report for"; } else if (encttype == "T") { encttype = "I"; Pdfviewmodel.Reporttitle = "Inpatient Transfer Report for"; } else if (encttype == "R") { encttype = "A"; Pdfviewmodel.Reporttitle = "Ambulatory Transfer Report for"; } Pdfviewmodel.PatientMDS = _patients.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.MyPhysicians = _physicians.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.EncounterInfos = _encountinfos.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.VitalSigns = _Vitals.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.MedicationAllergies = _Allergies.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.Problems = _problems.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.Medications = _medications.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.Vaccinations = _vaccinations.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.ProcedureDetails = _procedures.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.CarePlans = _careplans.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.LabResults = _labresults.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.SocialHistories = _socialhistories.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.EncounterDisgnos = _encountdiagnos.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.CognFunStatus = _cogfuncstatus.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); Pdfviewmodel.Reasonhospitals = _reasonhospital.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable(); EncounterReport erp = new EncounterReport(); erp.RefId = "Report"; erp.PatientId = userId; erp.UpdateBy = userId; erp.Action = "View Report"; var encreports = encrepo.AddEncReport(erp); return(PDFView(Pdfviewmodel)); }
public ActionResult EditExistingPatient(string Id) { var userId = Id; var Pdfviewmodel = new PDFViewModel(); Pdfviewmodel.PatientMDS = _patients.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.MyPhysicians = _physicians.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.EncounterInfos = _encountinfos.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.VitalSigns = _Vitals.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.MedicationAllergies = _Allergies.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.Problems = _problems.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.Medications = _medications.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.Vaccinations = _vaccinations.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.ProcedureDetails = _procedures.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.CarePlans = _careplans.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.LabResults = _labresults.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.SocialHistories = _socialhistories.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.EncounterDisgnos = _encountdiagnos.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.CognFunStatus = _cogfuncstatus.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.Reasonhospitals = _reasonhospital.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.Immunizations = _immunizations.GetbyUserId(userId).AsEnumerable(); Pdfviewmodel.InsuranceBillings = _insbilling.GetByUserId(userId).AsEnumerable(); Pdfviewmodel.Appointments = _appointments.GetByUserId(userId).AsEnumerable(); return(View(Pdfviewmodel)); }
private ActionResult PDFView(PDFViewModel Pdfviewmodel) { var pdf = new PdfResult(Pdfviewmodel, "PDFView"); //return pdf; string file = pdf.ToString(); return(pdf); }
public ActionResult PDFDownload(PDFViewModel pdfviewmodel, object filename) { Response.AddHeader("content-disposition", "attachment; filename=" + filename); //var pdf = new PdfResult(pdfviewmodel, "PDFView"); Response.ContentType = "application/pdf"; return(new PdfResult(pdfviewmodel, "PDFDownload")); }
public PDFView(PDFViewModel viewModel, ModernWindow window) { this.DataContext = viewModel; InitializeComponent(); viewModel.CloseAction = () => { window.DialogResult = true; window.Close(); }; }
public IActionResult CreatePDF(PDFViewModel model) { if (ModelState.IsValid) { //Topic Documents: if (model.Documents != null & model.Documents.Count() > 0) { foreach (IFormFile document in model.Documents) { //Set document name string DocumentName = $"{document.FileName}"; //Set document URL string DocumentURL = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\documents", DocumentName); //Copy file to server/disk document.CopyTo(new FileStream(DocumentURL, FileMode.Create)); //Record document details Document documentmodel = new Document() { Name = DocumentName, FileURL = "/documents/" + DocumentName, //Get document URL }; //Save new document to the database _repositoryWrapper.Document.Create(documentmodel); _repositoryWrapper.Document.Save(); } } //Done return(Redirect("/Masterclass/PDFs")); } ModelState.AddModelError("", "Error: Document(s) could not be added!"); return(View()); }
private async Task DownloadShowPDF(string filePath) { try { string url = null; System.IO.Stream stream; string localFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), filePath); if (File.Exists(localFilePath)) { stream = GetFileStream(localFilePath); downloadFile = localFilePath; } else { url = await this.GetDownloadUrl(filePath); stream = await DownloadPdfStream(url); using (var memoryStream = new MemoryStream()) { stream.CopyTo(memoryStream); File.WriteAllBytes(localFilePath, memoryStream.ToArray()); } downloadFile = url; } var ctl = new ctlPDFView(); ctl.DocumentSaveInitiated += Ctl_DocumentSaveInitiated; var model = new PDFViewModel(stream); ctl.BindingContext = model; ctl.VerticalOptions = LayoutOptions.FillAndExpand; stackShowData.VerticalOptions = LayoutOptions.FillAndExpand; stackShowData.Children.Add(ctl); } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Alert", ex.Message, "OK"); } }
private ActionResult XmlView(PDFViewModel Pdfviewmodel) { XDocument doc = new XDocument(new XDeclaration("1.0", "utf-16", "yes"), new XElement("ClinicalDocument", new XElement("realmCode", new XAttribute("Code", "US")), new XElement("title", Pdfviewmodel.Reporttitle))); foreach (var patientmd in Pdfviewmodel.PatientMDS) { doc.Element("ClinicalDocument").Add( new XElement("PatientDetails", new XElement("PatientName", patientmd.PatientName), new XElement("DateOfBirth", patientmd.DateOfBirth), new XElement("Sex", patientmd.Sex), new XElement("Race", patientmd.Race), new XElement("PreferredLanguage", patientmd.PreferredLanguage), new XElement("Height", patientmd.Height), new XElement("Weight", patientmd.Weight) ) ); if (Pdfviewmodel.MyPhysicians.Any()) { foreach (var myphysician in Pdfviewmodel.MyPhysicians) { doc.Element("ClinicalDocument").Add( new XElement("PhysicianDetails", new XElement("ProvidersName", myphysician.Name), new XElement("Providersofficecontactinformation", myphysician.PrimaryPhone, myphysician.HospitalName, myphysician.StreetAddress, myphysician.StreetAddress2, myphysician.Locality, myphysician.Region, myphysician.PostalCode) ) ); } } if (Pdfviewmodel.EncounterInfos.Any()) { foreach (var encinfo in Pdfviewmodel.EncounterInfos) { doc.Element("ClinicalDocument").Add( new XElement("EncounterInformation", new XElement("AdmissionDate", encinfo.AdmissionDate), new XElement("DischargeDate", encinfo.DischargeDate), new XElement("AdmissionandDischargeLocation", encinfo.Admissiondischargelocation) ) ); } } if (Pdfviewmodel.SocialHistories.Any()) { foreach (var sochist in Pdfviewmodel.SocialHistories) { doc.Element("ClinicalDocument").Add( new XElement("SocialHistory", new XElement("SocialHistoryItem", sochist.SocialHistoryItem), new XElement("Description", sochist.Description), new XElement("SNOMED-CT", sochist.SNOMEDCT) ) ); } } if (Pdfviewmodel.MedicationAllergies.Any()) { foreach (var medallrgs in Pdfviewmodel.MedicationAllergies) { doc.Element("ClinicalDocument").Add( new XElement("MedicationAllergies", new XElement("Allergen", medallrgs.Allergen), new XElement("RxNorm", medallrgs.RxNormCode), new XElement("Reaction", medallrgs.Reaction), new XElement("Status", medallrgs.Status) ) ); } } if (Pdfviewmodel.Medications.Any()) { foreach (var meds in Pdfviewmodel.Medications) { doc.Element("ClinicalDocument").Add( new XElement("Medication", new XElement("MedicationDrugName", meds.MedicationsName), new XElement("RxNorm", meds.StandardCode), new XElement("Reaction", meds.SIG), new XElement("DateOfPrescription", meds.DateOfPrescription), new XElement("Status", meds.Status) ) ); } } if (Pdfviewmodel.Problems.Any()) { foreach (var probs in Pdfviewmodel.Problems) { doc.Element("ClinicalDocument").Add( new XElement("Problems", new XElement("ProblemCause", probs.ProblemCause), new XElement("SNOMED-CT", probs.StandardCode), new XElement("ProblemReportedDate", probs.ProblemReportedDate), new XElement("Status", probs.Status) ) ); } } if (Pdfviewmodel.ProcedureDetails.Any()) { foreach (var procdet in Pdfviewmodel.ProcedureDetails) { doc.Element("ClinicalDocument").Add( new XElement("Procedures", new XElement("Procedure", procdet.ProcedureName), new XElement("SNOMED-CT", procdet.SNOMEDCT), new XElement("DateOfProcedure", procdet.ProcedureDate), new XElement("BodySite", ""), new XElement("BodySiteSNOMED-CT", "") ) ); } } if (Pdfviewmodel.VitalSigns.Any()) { foreach (var vital in Pdfviewmodel.VitalSigns) { doc.Element("ClinicalDocument").Add( new XElement("VitalSigns", new XElement("VitalType", new XElement("Height", vital.Height), new XElement("Weight", vital.Weight), new XElement("BloodPressure", vital.BloodPressure), new XElement("BodyMassIndex", vital.BMI) )) ); } } if (Pdfviewmodel.LabResults.Any()) { foreach (var labs in Pdfviewmodel.LabResults) { doc.Element("ClinicalDocument").Add( new XElement("LabResults", new XElement("OrderableTestName", labs.OrderableTestName), new XElement("LONICCode", labs.LONICCode), new XElement("TestResultValue", labs.TestResultValue), new XElement("DatePerformed", labs.DatePerformed) ) ); } } if (Pdfviewmodel.Vaccinations.Any()) { foreach (var vaccine in Pdfviewmodel.Vaccinations) { doc.Element("ClinicalDocument").Add( new XElement("Immunizations", new XElement("Vaccine", vaccine.VaccineName), new XElement("CVXCode", vaccine.CVXCode), new XElement("DateAdministered", vaccine.DateAdministered), new XElement("VaccineStatus", vaccine.VaccineStatus) ) ); } } if (Pdfviewmodel.CarePlans.Any()) { foreach (var careplan in Pdfviewmodel.CarePlans) { doc.Element("ClinicalDocument").Add( new XElement("CarePlans", new XElement("GoalInstructions", new XAttribute("Goal", careplan.Goal), new XAttribute("SNOMEDCT", careplan.SNOMEDCT)), new XElement("Instructions", careplan.Instructions) ) ); } } if (Pdfviewmodel.EncounterDisgnos.Any()) { foreach (var encdiag in Pdfviewmodel.EncounterDisgnos) { doc.Element("ClinicalDocument").Add( new XElement("EncounterDiagnosis", new XElement("Diagnosis", encdiag.Diagnosis), new XElement("SNOMEDCT", encdiag.SNOMEDCT), new XElement("StartDate", encdiag.StartDate), new XElement("Status", encdiag.Status) ) ); } } if (Pdfviewmodel.CognFunStatus.Any()) { foreach (var cogfunstatus in Pdfviewmodel.CognFunStatus) { doc.Element("ClinicalDocument").Add( new XElement("CognitiveandFunctionalStatus", new XElement("Description", cogfunstatus.Description), new XElement("SNOMEDCT", cogfunstatus.SNOMEDCT), new XElement("ReportedDate", cogfunstatus.ReportedDate), new XElement("Status", cogfunstatus.Status) ) ); } } if (Pdfviewmodel.Reasonhospitals.Any()) { foreach (var reason in Pdfviewmodel.Reasonhospitals) { doc.Element("ClinicalDocument").Add( new XElement("DischargeInstructions", new XElement("ReasonForHospitalization", reason.Reason) ) ); } } } return(new XmlResult(doc)); //MemoryStream ms = new MemoryStream(); //doc.Save(ms); //return File(new MemoryStream(ms.ToArray()),"text/xml","Hello.xml"); }
public MainWindow() { InitializeComponent(); pdfVM = new PDFViewModel(); lvDataBinding.ItemsSource = pdfVM.GetOtherPDFReportData(); }
public ActionResult Generate(PDFViewModel model) { CS.PDF.Exporter.Export(context, dropBoxBase, model.ActeIdentitateDirectory, model.ActeProprietateDirectory, model.FiseDirectory, model.OutputDirectory); return(View("Views/Home/PDF.cshtml", model)); }