/// <summary> /// /// </summary> /// <param name="patientTest"></param> /// <param name="user"></param> /// <returns></returns> /// public PatientTestDto ApproveTest(PatientTest patientTest, User user) { MapperConfig.ConfigAutoMapper(); patientTest.TemplateID = TestRepo.GetTest(patientTest.VisitID).TemplateID; patientTest.PatientTestID = TestRepo.GetTest(patientTest.VisitID).PatientTestID; patientTest.CreatedBy = TestRepo.GetTest(patientTest.VisitID).CreatedBy; patientTest.ModifiedBy = user.Username; patientTest.ApprovedBy = user.UserId; patientTest.CreatedDate = new DateTime(2016, 5, 5); patientTest.ModifiedDate = DateTime.Now; patientTest.ApprovedDate = DateTime.Now; System.Diagnostics.Debug.WriteLine("Test Approved by : " + user.Username + " "); TestRepo.Update(Mapper.Map <PatientTest>(patientTest)); return(null); }
/// <summary> /// /// </summary> /// <param name="res"></param> /// <param name="payment"></param> /// <param name="discount"></param> /// <param name="dis"></param> /// <returns></returns> /// public object CreateSlip(TestResultDto res, decimal payment, bool discount, double dis) { var Test = test.GetTest(res.VisitID); Decimal price = Test.Price; decimal Discount = (Decimal)dis; if (payment > price) { if (discount.Equals(true)) { decimal FinalAmount = price - (price * Discount); decimal balance = payment - FinalAmount; this.PirntSlip(res, price, payment, Discount, balance, FinalAmount); } else { decimal FinalAmount = price; decimal balance = payment - FinalAmount; this.PirntSlip(res, price, payment, 0, balance, FinalAmount); } } if (payment == price) { if (discount.Equals(true)) { decimal FinalAmount = price - (price * Discount); decimal balance = payment - FinalAmount; this.PirntSlip(res, price, payment, Discount, balance, FinalAmount); } else { decimal FinalAmount = price; decimal balance = payment - FinalAmount; this.PirntSlip(res, price, payment, 0, balance, FinalAmount); } } else if (payment < price) { throw new InvalidOperationException("Invalid Payment amount insert ! "); } return(null); }
/// <summary> /// /// </summary> /// <param name="printreport"></param> /// <returns></returns> public TestResultDto PrintReport(TestResultDto printreport) { MapperConfig.ConfigAutoMapper(); if (printreport != null) { int patientid = visit.GetVisit(printreport.VisitID).PatientID; var patient = base.context.Patients.AsNoTracking().FirstOrDefault(p => p.PatientId.Equals(patientid)); String name = patient.Name; int age = patient.Age; string sex = patient.Gender; string address = patient.Address; string number = patient.ContactNo; DateTime arrivedate = visit.GetVisit(printreport.VisitID).ArriveDate; DateTime ExpDelDate = visit.GetVisit(printreport.VisitID).ExpectedDeliveryDate; int TesTID = test.GetTest(printreport.VisitID).TemplateID; var testTemplate = base.context.TestTemplates.FirstOrDefault(p => p.TestTemplateId.Equals(TesTID)); string templatename = testTemplate.TemplateName; int temID = testTemplate.TestTemplateId; decimal price = testTemplate.Price; IList <TestResultDto> results = resultSet.GetTestResults(printreport.VisitID); IList <TestTemplateAttributeDto> Attribs = VisitHelper.GetTestTemplateAttributes(temID); string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); string fileName = "" + path + "\\Report.docx"; var doc = DocX.Create(fileName); doc.InsertParagraph(" __________________________________________________________________________________________________ "); doc.InsertParagraph(""); doc.InsertParagraph(" MEDICAL LAB REPORT MANAGEMENT SYSTEM | FINAL TEST REPORT "); doc.InsertParagraph(""); doc.InsertParagraph(" __________________________________________________________________________________________________ "); doc.InsertParagraph(" "); doc.InsertParagraph(" "); doc.InsertParagraph(" Patient Name : " + name + " Gender : " + sex + " "); doc.InsertParagraph(" "); doc.InsertParagraph(" "); doc.InsertParagraph(" Patient Age : " + age + " Address:" + address + " Payment : RS: " + price + ""); doc.InsertParagraph(" "); doc.InsertParagraph(" "); doc.InsertParagraph(" Contact Number : " + number + " Test : " + templatename + " "); doc.InsertParagraph(" "); doc.InsertParagraph(""); doc.InsertParagraph(" Arrived Date: " + arrivedate + " Deliver Date:" + ExpDelDate + " "); doc.InsertParagraph(" "); doc.InsertParagraph(" __________________________________________________________________________________________________ "); doc.InsertParagraph(""); doc.InsertParagraph(" Patients Results "); doc.InsertParagraph(""); doc.InsertParagraph(""); int seq = 1; foreach (var x in results) { doc.InsertParagraph(" " + seq + " Value: " + x.Value + " Status : " + x.Status + ""); doc.InsertParagraph(""); seq++; if (seq > Attribs.Count) { break; } } doc.InsertParagraph(""); doc.InsertParagraph(""); doc.InsertParagraph(" Reffer below Information. "); doc.InsertParagraph(""); doc.InsertParagraph(""); int NextSeq = 1; foreach (var x in Attribs) { doc.InsertParagraph(" " + NextSeq + " . " + x.Attribute + " --> " + x.PrefferedLimit + ""); doc.InsertParagraph(""); doc.InsertParagraph(""); NextSeq++; } doc.Save(); /*Open as html format*/ SautinSoft.RtfToHtml z = new SautinSoft.RtfToHtml(); string docxFile = Path.GetFullPath(fileName); string htmlFile = Path.ChangeExtension(docxFile, ".html"); z.OpenDocx(docxFile); z.ToHtml(htmlFile); System.Diagnostics.Process.Start(htmlFile); return(null); } else { throw new ArgumentNullException("Provided information is not valid."); } }