public JsonResult UpdateInvoice(PatientInvoice pinvoice) { PatientInvoice onlyInvoice = new PatientInvoice(); PatientInvoice patientInvoice = new PatientInvoice(); using (Repository <PatientInvoice> repository = new Repository <PatientInvoice>()) { patientInvoice = repository.Update(pinvoice); patientInvoice.UserId = GetLoggedinUserInfo().UserId; repository.Commit(); } List <PatientService> patientServiceItems = pinvoice.PatientServices.ToList(); foreach (PatientService item in patientServiceItems) { using (PatientServiceRepository patientservicerepository = new PatientServiceRepository()) { item.UserId = GetLoggedinUserInfo().UserId; patientservicerepository.Update(item); patientservicerepository.Commit(); } } return(Json("Invoice update successfull", JsonRequestBehavior.AllowGet)); }
public JsonResult CreateReceipt(ReceiptPayment receipt) { ReceiptPayment onlyReceiptPayment = new ReceiptPayment(); List <PatientService> listPatientService = receipt.PatientServices.ToList(); receipt.PatientServices = null; receipt.UserId = GetLoggedinUserInfo().UserId; using (Repository <ReceiptPayment> repository = new Repository <ReceiptPayment>()) { onlyReceiptPayment = repository.Insert(receipt); repository.Commit(); } foreach (PatientService sitem in listPatientService) { sitem.UserId = GetLoggedinUserInfo().UserId;; sitem.ReceiptId = onlyReceiptPayment.Id; sitem.Item = null; using (PatientServiceRepository patientservicerepository = new PatientServiceRepository()) { patientservicerepository.Update(sitem); patientservicerepository.Commit(); } } return(Json(onlyReceiptPayment, JsonRequestBehavior.AllowGet)); }
// Code added by zaber public JsonResult deleteBillItem(long billId) { using (PatientServiceRepository bill = new PatientServiceRepository()) { bill.DeleteByID(billId, GetLoggedinUserInfo().UserId); bill.Commit(); return(Json("BillItem delete successfull")); } }
public JsonResult HosipitalAdmissionbillingItem(long patientId, long admissionId) { using (PatientServiceRepository repository = new PatientServiceRepository()) { Expression <Func <PatientService, bool> > lambda; lambda = (x => x.PatientID == patientId && x.PatientAdmissionId == admissionId && x.Active == true && (x.Billed == false || x.Billed == null)); List <PatientService> patientServices = repository.GetByQuery(lambda).ToList(); return(Json(patientServices.Count, JsonRequestBehavior.AllowGet)); } }
public void CreatePatientService(long invoiceID, IList <PatientService> patientServices) { using (PatientServiceRepository repository = new PatientServiceRepository()) { foreach (PatientService patientervice in patientServices) { patientervice.InvoiceID = invoiceID; repository.Insert(patientervice); } repository.Commit(); } }
//[ValidateAntiForgeryToken] public JsonResult CreatePatientService(IList <PatientService> patientServices) { List <PatientService> PatientServiceList = new List <PatientService>(); //if (ModelState.IsValid) { using (PatientServiceRepository repository = new PatientServiceRepository()) { foreach (PatientService patientervice in patientServices) { PatientService PatientService = new PatientService(); patientervice.UserId = GetLoggedinUserInfo().UserId; PatientService = repository.Insert(patientervice); PatientServiceList.Add(PatientService); } repository.Commit(); // repository.Insert(patientService); // repository.Commit(); // patient = repository.GetByPhoneNumber(patient.PhoneNumber); } foreach (PatientService patientervice in PatientServiceList) { using (ItemRepository itemRepository = new ItemRepository()) { Item item = new Item(); patientervice.Item = item; Item cItem = itemRepository.GetById(patientervice.ItemId); patientervice.Item.Id = cItem.Id; patientervice.Item.Name = cItem.Name; patientervice.Item.MedicalTypeId = cItem.MedicalTypeId; if (cItem.ItemCategory != null) { patientervice.Item.GenericName = cItem.ItemCategory.Name; patientervice.Item.ItemCategory = new ItemCategory(); patientervice.Item.ItemCategory.Name = cItem.ItemCategory.Name; } patientervice.Item.ReferralAllowed = cItem.ReferralAllowed; } } } return(Json(PatientServiceList, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateRefundNote(PatientService pService) { PatientService patientService = null; pService.Item = null; using (PatientServiceRepository repository = new PatientServiceRepository()) { patientService = repository.UpdateByField(pService, "RefundNote"); // CreatePatientService(invoice.Id, patientServices); } if (patientService == null) { return(Json(HttpNotFound(), JsonRequestBehavior.AllowGet)); } return(Json("Refund successfull", JsonRequestBehavior.AllowGet)); }
public JsonResult CreateInvoice(PatientInvoice pinvoice) { var identity = (ClaimsIdentity)User.Identity; IEnumerable <Claim> claims = identity.Claims; PatientInvoice patientInvoice = new PatientInvoice(); PatientInvoice onlyPatientInvoice = new PatientInvoice(); // var userId = claims.Where(r => r.Type == ClaimTypes.SerialNumber).FirstOrDefault().Value; using (Repository <PatientInvoice> repository = new Repository <PatientInvoice>()) { // patientInvoice.UserId = Convert.ToInt32(userId); // patientInvoice.InvoiceStatusId = 1; if (pinvoice.Id == 0) { List <PatientService> patientServiceItems = pinvoice.PatientServices.ToList(); pinvoice.PatientServices = null; pinvoice.UserId = patientInvoice.UserId; patientInvoice = repository.Insert(pinvoice); repository.Commit(); foreach (PatientService item in patientServiceItems) { item.InvoiceID = pinvoice.Id; item.UserId = GetLoggedinUserInfo().UserId; using (PatientServiceRepository patientservicerepository = new PatientServiceRepository()) { patientservicerepository.Update(item); patientservicerepository.Commit(); } } } else { List <PatientService> patientServiceItems = pinvoice.PatientServices.ToList(); pinvoice.PatientServices = null; patientInvoice = repository.Update(pinvoice); repository.Commit(); if (pinvoice.InvoiceStatusId == 2) { foreach (PatientService item in patientServiceItems) { item.InvoiceID = pinvoice.Id; item.UserId = GetLoggedinUserInfo().UserId; item.Billed = true; using (PatientServiceRepository patientservicerepository = new PatientServiceRepository()) { patientservicerepository.Update(item); patientservicerepository.Commit(); } } } } // repository.Commit(); } //using (PatientServiceRepository repository = new PatientServiceRepository()) //{ // foreach (PatientService patientervice in patientServices) // { // patientervice.InvoiceID = pinvoice.Id; // repository.Update(patientervice); // } // repository.Commit(); //} onlyPatientInvoice.Id = patientInvoice.Id; onlyPatientInvoice.InvoiceDate = patientInvoice.InvoiceDate; onlyPatientInvoice.DueDate = patientInvoice.DueDate; onlyPatientInvoice.PatientID = patientInvoice.PatientID; onlyPatientInvoice.TotalAmount = patientInvoice.TotalAmount; onlyPatientInvoice.TotalDiscount = patientInvoice.TotalDiscount; onlyPatientInvoice.InvoiceStatusId = patientInvoice.InvoiceStatusId; onlyPatientInvoice.InvoiceStatusId = patientInvoice.InvoiceStatusId; onlyPatientInvoice.LabStatusId = patientInvoice.LabStatusId; onlyPatientInvoice.ItemDiscount = patientInvoice.ItemDiscount; onlyPatientInvoice.UserId = patientInvoice.UserId; return(Json(onlyPatientInvoice, JsonRequestBehavior.AllowGet)); }
public JsonResult GetBillingIemByPatientId(long id) { List <PatientService> patientServiceItems; List <PatientService> onlypatientServiceItems = new List <PatientService>(); using (PatientServiceRepository repository = new PatientServiceRepository()) { patientServiceItems = repository.GetServiceItemsByPatientId(id).ToList(); foreach (PatientService c in patientServiceItems) { PatientService patientstitem = new PatientService(); Item item = new Item(); patientstitem.Item = item; patientstitem.Id = c.Id; patientstitem.PatientID = c.PatientID; patientstitem.ItemId = c.ItemId; patientstitem.InvoiceID = c.InvoiceID; patientstitem.ReceiptId = c.ReceiptId; patientstitem.PatientAdmissionId = c.PatientAdmissionId; patientstitem.ServiceListPrice = c.ServiceListPrice; patientstitem.ServiceActualPrice = c.ServiceActualPrice; patientstitem.ServiceQuantity = c.ServiceQuantity; patientstitem.ServiceDate = c.ServiceDate; patientstitem.UserId = c.UserId; patientstitem.Discount = c.Discount; patientstitem.DiscountAfterInvoice = c.DiscountAfterInvoice; patientstitem.Refund = c.Refund; patientstitem.Billed = c.Billed; patientstitem.ReferralFee = c.ReferralFee; patientstitem.DeliveryDate = c.DeliveryDate; patientstitem.DeliveryTime = c.DeliveryTime; patientstitem.ReferralFeePaid = c.ReferralFeePaid; patientstitem.ServiceProviderId = c.ServiceProviderId; patientstitem.LabStatusId = c.LabStatusId; patientstitem.Item.Name = c.Item.Name; patientstitem.Item.MedicalTypeId = c.Item.MedicalTypeId; if (c.Item.ItemCategory != null) { patientstitem.Item.GenericName = c.Item.ItemCategory.Name; ItemCategory itemCategory = new ItemCategory(); patientstitem.Item.ItemCategory = itemCategory; patientstitem.Item.ItemCategory.Name = c.Item.ItemCategory.Name; } patientstitem.Item.ReferralAllowed = c.Item.ReferralAllowed; onlypatientServiceItems.Add(patientstitem); } } if (patientServiceItems == null) { return(Json(HttpNotFound(), JsonRequestBehavior.AllowGet)); } // patients.ForEach(corePatient => onlyPatients.Add(MapToClientObject(corePatient))); //patientServiceItems.ForEach(c => onlypatientServiceItems.Add(new PatientService //{ // Id = c.Id, // PatientID = c.PatientID, // ItemID = c.ItemID, // InvoiceID=c.InvoiceID, // ServiceListPrice = c.ServiceListPrice, // ServiceActualPrice = c.ServiceActualPrice, // ServiceQuantity = c.ServiceQuantity, // ServiceDate = c.ServiceDate, // UserId = c.UserId, // Discount = c.Discount, // Refund =c.Refund, // Billed =c.Billed, // ReferralFee =c.ReferralFee, // DeliveryDate =c.DeliveryDate, // DeliveryTime =c.DeliveryTime //})); return(Json(onlypatientServiceItems, JsonRequestBehavior.AllowGet)); }