// // GET: /OperationTheatreMaster/Edit/5 public ActionResult Edit(int id, int PatientId) { EHMSEntities ent = new EHMSEntities(); OperationTheatreMasterModel model = pro.GetObject(id); model.refOfOpdModel = new OpdModel(); OpdModel opdmodel = new OpdModel(); OpdProvider proopd = new OpdProvider(); opdmodel.OpdModelList = proopd.Getlist().Where(x => x.OpdID == PatientId).ToList(); foreach (var item in opdmodel.OpdModelList) { model.refOfOpdModel.FirstName = item.FirstName; model.refOfOpdModel.MiddleName = item.MiddleName; model.refOfOpdModel.LastName = item.LastName; } //model.SourceID = id; model.SourceID = PatientId; model.PersonAllocatedList = new List <PersonAllocated>(); foreach (var item in pro.GetTheatreDetailsList(id)) { PersonAllocated pa = new PersonAllocated(); pa.PersonAllocateId = item.PersonAllocatedID; pa.PersonAllocatedTypeId = item.PersonAllocatedTypeID; model.PersonAllocatedList.Add(pa); } //model.ChargeName = ent.SurgeryCharge.Where(x=>x.ChargeAmount==model.Charge).FirstOrDefault().ChargeName; return(View(model)); }
public ActionResult GetCommListFromCB() { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); model.GetCBCommissionViewModelOTList = pro.GetCommissionDetailsFromCB(); return(View(model)); }
public ActionResult Index() { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); model.OperationTheatreMasterList = pro.GetList(); return(View(model)); }
// GET: /OperationTheatreMaster/Create public ActionResult Create(int id, int Billno) { OpdModel opdmodel = new OpdModel(); OpdProvider pro = new OpdProvider(); BillingCounterProvider Brpro = new BillingCounterProvider(); opdmodel.OpdModelList = pro.Getlist().Where(x => x.OpdID == id).ToList(); //model.BillingCounterPatientInformationModel = pro.GetPatientBasicInformationFromOpd(Convert.ToInt32(ipValue), 0).FirstOrDefault(); //model.BalanceDeposit = pro.getBalanceDeposit(Convert.ToInt32(model.BillingCounterPatientInformationModel.AccountHeadId)); OperationTheatreMasterModel obj = new OperationTheatreMasterModel(); obj.refOfOpdModel = new OpdModel(); foreach (var item in opdmodel.OpdModelList) { obj.refOfOpdModel.FirstName = item.FirstName; obj.refOfOpdModel.MiddleName = item.MiddleName; obj.refOfOpdModel.LastName = item.LastName; obj.refOfOpdModel.COA = item.COA; } obj.PatientACHeadId = (int)obj.refOfOpdModel.COA; obj.PatientDepoAmount = Brpro.getBalanceDeposit(obj.PatientACHeadId); obj.SourceID = id; ViewBag.value = 0; return(View(obj)); }
public ActionResult GetListFromCB(string StartDate, string EndDate, string PatientName) { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); model.FromCBViewDetailsList = pro.GetSurgeryListFromCBM(); return(View(model)); }
public ActionResult ViewOtCommissionDetails(int id) { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); model.GetOTCommDetailsViewModelList = pro.GetCommissionDetailsByBillNo(id); model.ObjGetOTCommDetailsViewModel.BillNo = id; return(View(model)); }
public OperationTheatreMasterModel GetObject(int id) { using (EHMSEntities ent = new EHMSEntities()) { var obj = ent.OperationTheatreMasters.Where(x => x.OperationTheatreMasterID == id).FirstOrDefault(); OperationTheatreMasterModel model = AutoMapper.Mapper.Map <OperationTheatreMaster, OperationTheatreMasterModel>(obj); return(model); } }
public ActionResult BillRecords(int id, int opdid) { EHMSEntities ent = new EHMSEntities(); var data = ent.OperationTheatreMasters.Where(x => x.OperationTheatreMasterID == id && x.SourceID == opdid).FirstOrDefault(); OperationTheatreMasterModel model = new OperationTheatreMasterModel(); AutoMapper.Mapper.Map(data, model); return(View(model)); }
public int Update(OperationTheatreMasterModel model) { int i = 0; using (EHMSEntities ent = new EHMSEntities()) { var objtoedit = ent.OperationTheatreMasters.Where(x => x.OperationTheatreMasterID == model.OperationTheatreMasterID).FirstOrDefault(); //model.SourceID = objtoedit.SourceID; model.CreatedBy = objtoedit.CreatedBy; model.CreatedDate = objtoedit.CreatedDate; model.TotalCharge = objtoedit.TotalCharge; var objtocom = AutoMapper.Mapper.Map(model, objtoedit); objtocom.Status = true; //objtoedit.ValidUpto = Convert.ToDateTime(model.date); ent.Entry(objtocom).State = System.Data.EntityState.Modified; try { i = ent.SaveChanges(); } catch (Exception e) { string s = e.InnerException.ToString(); } var objlist = ent.OperationTheatreDetails.Where(x => x.OperationTheatreMasterID == model.OperationTheatreMasterID).ToList(); foreach (var item in objlist) { ent.OperationTheatreDetails.Remove(item); ent.SaveChanges(); } foreach (var item in model.PersonAllocatedList) { var objTheatreDetails = new OperationTheatreDetail(); objTheatreDetails.OperationTheatreMasterID = model.OperationTheatreMasterID; objTheatreDetails.PersonAllocatedID = item.PersonAllocateId; objTheatreDetails.PersonAllocatedTypeID = item.PersonAllocatedTypeId; ent.OperationTheatreDetails.Add(objTheatreDetails); i = ent.SaveChanges(); } } return(i); }
public bool InsertOTCommissionDetails(OperationTheatreMasterModel model) { using (EHMSEntities ent = new EHMSEntities()) { foreach (var item in model.AddMoreOTCommissionViewModelList) { var Obj = new CommissionDetaislByType() { AccountHeadId = 1234, Amount = item.CommissionAmout, BillNo = model.ObjGetOTCommDetailsViewModel.BillNo, CommissionDate = DateTime.Now, commissionDetailsId = 1, CommissionTypeId = 1005, CommissionTypeName = "Doctor Commission", CreatedBy = Utility.GetCurrentLoginUserId(), Status = true, DoctorId = item.DoctorId, CreatedDate = DateTime.Now, Remarks = "fine", JvStatus = false }; ent.CommissionDetaislByTypes.Add(Obj); } ent.SaveChanges(); //Update commissionDetails Table var ObjResult = ent.CommissionDetails.Where(x => x.DepartmentId == 1005 && x.BillNumber == model.ObjGetOTCommDetailsViewModel.BillNo && x.Status == false); if (ObjResult.Count() > 0) { foreach (var item in ObjResult) { item.Status = true; } ent.SaveChanges(); } } return(true); }
public ActionResult Create(OperationTheatreMasterModel model) { EHMSEntities ent = new EHMSEntities(); try { // TODO: Add insert logic here if (model.PersonAllocatedList.Count == 0) { TempData["message"] = "Select Persons."; return(View(model)); } //Get Surgery Charge name EHMSEntities entity = new EHMSEntities(); var result = entity.SurgeryCharges.Where(x => x.ChargeName.Contains(model.ChargeName)).ToList(); if (result.Count() <= 0) { TempData["message"] = "Please select surgery name."; return(View(model)); } int i = pro.Insert(model); if (i != 0) { //return RedirectToAction("BillRecords", new { id = i, opdid = model.SourceID }); TempData["success"] = HospitalManagementSystem.UtilityMessage.save; return(RedirectToAction("Index")); } else { TempData["success"] = HospitalManagementSystem.UtilityMessage.savefailed; return(RedirectToAction("Index")); } } catch (Exception e) { TempData["message"] = "Select Persons."; return(View()); } }
public ActionResult _SearchOperationTheatreDetails(DateTime Sdate, DateTime Edate, int SourceID, string name) { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); if (SourceID == 0 && name != "") { int id = HospitalManagementSystem.Utility.GetOpdIdByName(name); model.OperationTheatreMasterList = pro.GetListdateandidwise(Sdate, Edate, id); } else if (SourceID != 0 && name == "") { model.OperationTheatreMasterList = pro.GetListdateandidwise(Sdate, Edate, SourceID); } else { model.OperationTheatreMasterList = pro.GetListdatewise(Sdate, Edate); } return(PartialView("_SOTDetails", model)); }
public ActionResult Edit(int id, OperationTheatreMasterModel model) { try { // TODO: Add update logic here //if (model.PersonAllocatedList.Count == 0) model.PersonAllocatedList=null; int i = pro.Update(model); if (i != 0) { TempData["success"] = HospitalManagementSystem.UtilityMessage.edit; return(RedirectToAction("Index")); } else { TempData["success"] = HospitalManagementSystem.UtilityMessage.editfailed; return(RedirectToAction("Index")); } } catch (Exception e) { return(RedirectToAction("Index")); } }
public ActionResult _SearchPostOTDetails(DateTime Sdate, DateTime Edate) { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); return(PartialView("_PREPOSTOT", model)); }
public int Insert(OperationTheatreMasterModel model) { int i = 0; using (EHMSEntities ent = new EHMSEntities()) { if (ent.OperationTheatreMasters.Where(x => x.Status == true && x.OperationDate == model.OperationDate && ( (x.OperationStartTime <= model.OperationStartTime && x.OperationEndTime >= model.OperationStartTime) || (x.OperationStartTime <= model.OperationEndTime && x.OperationEndTime >= model.OperationEndTime) ) && x.OperationRoomID == model.OperationRoomID).Any()) { return(i); } var objToSave = AutoMapper.Mapper.Map <OperationTheatreMasterModel, OperationTheatreMaster>(model); objToSave.Status = true; //objToSave.SourceID = "1"; objToSave.CreatedBy = 1; objToSave.CreatedDate = DateTime.Now; //objToSave.ValidUpto = Convert.ToDateTime(model.date); if (model.Discount != null) { objToSave.TotalCharge = model.Charge - model.Discount; } else { objToSave.TotalCharge = model.Charge; } ent.OperationTheatreMasters.Add(objToSave); ent.SaveChanges(); int k = objToSave.OperationTheatreMasterID; foreach (var item in model.PersonAllocatedList) { var objTheatreDetails = new OperationTheatreDetail(); objTheatreDetails.OperationTheatreMasterID = objToSave.OperationTheatreMasterID; objTheatreDetails.PersonAllocatedID = item.PersonAllocateId; objTheatreDetails.PersonAllocatedTypeID = item.PersonAllocatedTypeId; ent.OperationTheatreDetails.Add(objTheatreDetails); i = ent.SaveChanges(); } int BillNumberInt = Utility.GetMaxBillNumberFromDepartment("Hospital", 1); string BillNumberStr = "BL-" + BillNumberInt.ToString(); //calcuate charge amount and tax decimal ChargeFeeAndTaxTotal = (decimal)model.Charge; decimal ChargeOnly = (ChargeFeeAndTaxTotal * 100) / 105; decimal ChargeFeeTaxOnly = ChargeFeeAndTaxTotal - ChargeOnly; decimal ChargeAmountAfterDiscount = Convert.ToDecimal(0); //Calculate Discount //Check If discount or not decimal TotalDiscountAmount = Convert.ToDecimal(0); int TotalDiscountHeadId = 0; //Discount Calculation if (model.Discount > 0) { TotalDiscountAmount = (decimal)model.Discount; TotalDiscountHeadId = 369; ChargeAmountAfterDiscount = ChargeFeeAndTaxTotal - TotalDiscountAmount; } //fee amount var ObjFeeDetails = new CentralizedBillingDetail() { }; //tax amount var ObjTaxDetails = new CentralizedBillingDetail() { }; //discount amount var ObjDiscountDtls = new CentralizedBillingDetail() { }; //Payment Type only Deposit var ObjPayment = new CentralizedBillingPaymentType() { }; //master table var ObjMaster = new CentralizedBillingMaster() { }; //Insert into centralizedbillingdetails //var ObjCentralizedBillingDetails = new CentralizedBillingDetail() //{ // BillNo = BillNumberInt, // AccountHeadID = 111,//Ot Charge id from coa // Amount = ChargeOnly, // Status = true, // Times = 1 //}; //ent.CentralizedBillingDetail.Add(ObjCentralizedBillingDetails); //ObjCentralizedBillingDetails = new CentralizedBillingDetail() //{ // BillNo = BillNumberInt, // AccountHeadID = 112,//Ot Charge tax from coa // Amount = ChargeFeeTaxOnly, // Status = true, // DepartmentId = 1005, // Times = 1 //}; //ent.CentralizedBillingDetail.Add(ObjCentralizedBillingDetails); //var ObjCentralizedBillingPaymentType = new CentralizedBillingPaymentType() //{ // BillNo = BillNumberInt, // PaymentTypeID = 1,//Cash or bank from coa // PaymentSubTypeID = 1, // Amount = ChargeAmountAfterDiscount, // Status = true //}; //ent.CentralizedBillingPaymentType.Add(ObjCentralizedBillingPaymentType); //Add Details in centralized billing master //var ObjCentralizedBillingMaster = new CentralizedBillingMaster() //{ // BillNo = BillNumberInt, // TotalBillAmount = ChargeFeeAndTaxTotal, // Narration1 = "Narration", // Narration2 = "", // DepartmentName = "Ot", // SubDepartmentId = 1, // PatientLogId = (int)objToSave.SourceID, // PatientId = (int)objToSave.SourceID, // TotalDiscountID = TotalDiscountHeadId, // TotalDiscountAmount = TotalDiscountAmount, // //JVNumber=1 // JVStatus = false, // CreatedDepartmentId = Hospital.Utility.GetCurrentUserDepartmentId(), // CreatedBy = Hospital.Utility.GetCurrentLoginUserId(), // CreatedDate = DateTime.Now, // Remarks = "OT", // Status = true, // BranchId = 1, // IsHandover = false, // ReceiptId = 0, // ReturnedAmount = Convert.ToDecimal(0), // TenderAmount = Convert.ToDecimal(0) //}; //ent.CentralizedBillingMaster.Add(ObjCentralizedBillingMaster); //objtoSaveCentralizedBilling = new CentralizedBilling() //{ // AccountHeadId = 22, // Amount = (decimal)model.Discount, // AmountDate = DateTime.Now, // PaymentType = "Cash", // Narration1 = "OT Fee Discount", // Narration2 = "Discount", // DepartmentName = "OT", // SubDepartmentId = Utility.GetCurrentUserDepartmentId(), // BillNumber = BillNumberStr, // LedgerMasterId = ent.GL_LedgerMaster.Where(x => x.SourceID == objToSave.SourceID).SingleOrDefault().LedgerMasterID, // PatientLogId = (int)objToSave.SourceID, // PatientId = (int)objToSave.SourceID, // JVStatus = false, // CreatedBy = Utility.GetCurrentLoginUserId(), // CreatedDate = DateTime.Now, // Remarks = "OT", // Status = true, // ItemDiscountPercentage = 0 //}; //ent.CentralizedBilling.Add(objtoSaveCentralizedBilling); //update Bill Number //SetupHospitalBillNumber billNumber = (from x in ent.SetupHospitalBillNumber // where x.DepartmentName == "Hospital" && x.FiscalYearId == 1 // select x).First(); //billNumber.BillNumber = billNumber.BillNumber + 1; ent.SaveChanges(); return(k); } }
public ActionResult ViewOtCommissionDetails(OperationTheatreMasterModel model) { pro.InsertOTCommissionDetails(model); //return View(model); return(RedirectToAction("GetCommListFromCB")); }
public ActionResult PostOT() { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); return(View()); }
public ActionResult SearchForOTDetail() { OperationTheatreMasterModel model = new OperationTheatreMasterModel(); return(View(model)); }