public ActionResult MANOPDExpense(OpdExpenseVM oPDEXPENSE) { try { string buttonStatus = Request.Form["buttonName"]; AuthenticateUser("MANOPDExpense"); string message = Validation(oPDEXPENSE, buttonStatus); if (message != string.Empty) { ModelState.AddModelError("", message); } if (buttonStatus == "approved") { oPDEXPENSE.Status = ClaimStatus.MANAPPROVED; } else if (buttonStatus == "rejected") { oPDEXPENSE.Status = ClaimStatus.MANREJECTED; } else { oPDEXPENSE.Status = ClaimStatus.MANINPROCESS; } if (ModelState.IsValid) { oPDEXPENSE.ModifiedDate = DateTime.Now; oPDEXPENSE.ManagementApprovalDate = DateTime.Now; oPDEXPENSE.ManagementEmailAddress = GetEmailAddress(); if (oPDEXPENSE.Status == ClaimStatus.MANAPPROVED) { oPDEXPENSE.HrApproval = true; oPDEXPENSE.FinanceApproval = true; oPDEXPENSE.ManagementApproval = true; } _opdExpenseService.UpdateOpdExpense(oPDEXPENSE); EmailSend(oPDEXPENSE); return(RedirectToAction(UrlIndex, UrlManApproval)); } var result2 = GeneralController.GetOPDExpense(Convert.ToInt32(oPDEXPENSE.ID), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService); ViewData["OPDEXPENSE_ID"] = oPDEXPENSE.ID; return(View(result2)); } catch (Exception ex) { logger.Error("MANAPPROVAL : MANOPDExpense([Bind])" + ex.Message.ToString()); return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest))); } }
public ActionResult HROPDExpense(OpdExpenseVM oPDEXPENSE) { try { string buttonStatus = Request.Form["buttonName"]; AuthenticateUser(); string remainingAmount = GeneralController.CalculateRemainingAmount(oPDEXPENSE.EmployeeEmailAddress, oPDEXPENSE.OpdType, oPDEXPENSE.HospitalizationType, oPDEXPENSE.MaternityType, _opdExpenseService, _setupExpenseAmountService, false); ViewBag.RemainingAmount = remainingAmount; string message = Validation(oPDEXPENSE, buttonStatus); if (message != string.Empty) { ModelState.AddModelError("", message); } if (ModelState.IsValid) { if (buttonStatus == "approved") { oPDEXPENSE.Status = ClaimStatus.HRAPPROVED; oPDEXPENSE.HrApproval = true; } else if (buttonStatus == "rejected") { oPDEXPENSE.Status = ClaimStatus.HRREJECTED; } else if (buttonStatus == "managerapproval") { oPDEXPENSE.Status = ClaimStatus.MANINPROCESS; } else { oPDEXPENSE.Status = ClaimStatus.HRINPROCESS; } oPDEXPENSE.ModifiedDate = DateTime.Now; oPDEXPENSE.HrApprovalDate = DateTime.Now; oPDEXPENSE.HrEmailAddress = GetEmailAddress(); _opdExpenseService.UpdateOpdExpense(oPDEXPENSE); EmailSend(oPDEXPENSE); return(RedirectToAction(UrlIndex, UrlHrApproval)); } var opdExpense = GeneralController.GetOPDExpense(Convert.ToInt32(oPDEXPENSE.ID), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService); ViewData["OPDEXPENSE_ID"] = oPDEXPENSE.ID; return(View(opdExpense)); } catch (Exception ex) { logger.Error("HRAPPROVAL : HROPDExpense([Bind])" + ex.Message.ToString()); return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest))); } }
public ActionResult Edit(OpdExpenseVM opdExpense) { try { AuthenticateUser(); var hospitalInformation = GeneralController.GetHospitalExpense(opdExpense.ID, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService); ViewData["OPDEXPENSE_ID"] = opdExpense.ID; ViewData["OPDTYPE"] = opdExpense.OpdType; ViewBag.EmployeeDepartment = hospitalInformation.EmployeeDepartment; string buttonStatus = Request.Form["buttonName"]; CalculateRemainingAmount(hospitalInformation); if (buttonStatus == "submit") { opdExpense.Status = ClaimStatus.SUBMITTED; } else { opdExpense.Status = ClaimStatus.INPROGRESS; } if (opdExpense.Status == ClaimStatus.SUBMITTED) { if (hospitalInformation.OpdExpensePatients.Count > 0) { if (hospitalInformation.OpdExpenseImages.Count > 0) { if (GetHOSExpenseAmount(opdExpense, opdExpense.TotalAmountClaimed)) { decimal?remainingAmount = Convert.ToDecimal(ViewBag.RemainingAmount); if (opdExpense.TotalAmountClaimed <= remainingAmount) { if (ModelState.IsValid) { opdExpense.ModifiedDate = DateTime.Now; opdExpense.EmployeeEmailAddress = GetEmailAddress(); _opdExpenseService.UpdateOpdExpense(opdExpense); EmailSend(opdExpense); return(RedirectToAction(UrlIndex, UrlOpdExpense)); } } else { ModelState.AddModelError("", Constants.MSG_GENERAL_CLAIM_AMOUNT_REMAINING_AMOUNT); return(View(hospitalInformation)); } } else { ModelState.AddModelError("", Constants.MSG_GENERAL_OPD_EXPENSE_AMOUNT); return(View(hospitalInformation)); } } else { ModelState.AddModelError("", Constants.MSG_GENERAL_ADD_PATIENT_RECEIPTS); return(View(hospitalInformation)); } } else { ModelState.AddModelError("", Constants.MSG_GENERAL_ADD_PATIENT_INFORMATION); return(View(hospitalInformation)); } } else { if (ModelState.IsValid) { opdExpense.ModifiedDate = DateTime.Now; opdExpense.EmployeeEmailAddress = GetEmailAddress(); _opdExpenseService.UpdateOpdExpense(opdExpense); //EmailSend(opdExpense); return(RedirectToAction(UrlIndex, UrlOpdExpense)); } } return(View(hospitalInformation)); } catch (Exception ex) { logger.Error("Hospital Expense : Create()" + ex.Message.ToString()); return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest))); } }
public ActionResult Edit(OpdExpenseVM OpdExpense) { try { string buttonStatus = Request.Form["buttonName"]; AuthenticateUser(); var opdInformation = GeneralController.GetTravelExpense(OpdExpense.ID, _opdExpenseService, _travelExpenseService); ViewData["OPDEXPENSE_ID"] = OpdExpense.ID; ViewData["OPDTYPE"] = OpdExpense.OpdType; ViewBag.EmployeeDepartment = opdInformation.EmployeeDepartment; if (buttonStatus == "submit") { OpdExpense.Status = ClaimStatus.FININPROCESS; } else { OpdExpense.Status = ClaimStatus.INPROGRESS; } if (OpdExpense.Status == ClaimStatus.FININPROCESS) { if (opdInformation.ListTravelExpense.Count > 0) { if (GetTravelExpenseAmount(OpdExpense.ID, OpdExpense.TotalAmountClaimed)) { if (ModelState.IsValid) { OpdExpense.ModifiedDate = DateTime.Now; OpdExpense.EmployeeEmailAddress = GetEmailAddress(); _opdExpenseService.UpdateOpdExpense(OpdExpense); return(RedirectToAction(UrlIndex, UrlOpdExpense)); } } else { ModelState.AddModelError("", Constants.MSG_GENERAL_TRAVEL_EXPENSE_AMOUNT); return(View(opdInformation)); } } else { ModelState.AddModelError("", Constants.MSG_GENERAL_ADD_TRAVEL_EXPENSE_RECEIPTS); return(View(opdInformation)); } } else { if (ModelState.IsValid) { OpdExpense.CreatedDate = DateTime.Now; OpdExpense.ModifiedDate = DateTime.Now; OpdExpense.EmployeeEmailAddress = GetEmailAddress(); _opdExpenseService.UpdateOpdExpense(OpdExpense); return(RedirectToAction(UrlIndex, UrlOpdExpense)); } } return(View(opdInformation)); } catch (Exception ex) { logger.Error("Travel Expense : Edit([Bind])" + ex.Message.ToString()); return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest))); } }