Beispiel #1
0
        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)));
            }
        }
Beispiel #2
0
        // GET: OPDEXPENSEs/Edit/5
        public ActionResult HRHospitalExpense(string id)
        {
            try
            {
                if (Request.IsAuthenticated)
                {
                    AuthenticateUser();

                    int idDecrypted = Security.DecryptId(Convert.ToString(id));


                    if (!(AuthenticateEmailAddress(idDecrypted)))
                    {
                        return(RedirectToAction(UrlIndex, UrlHome));
                    }

                    if (id == null)
                    {
                        RedirectToAction(UrlIndex, UrlHrApproval);
                    }

                    var result2 = GeneralController.GetHospitalExpense(idDecrypted, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);

                    string remainingAmount = GeneralController.CalculateRemainingAmount(result2.EmployeeEmailAddress, result2.OpdType, result2.HospitalizationType, result2.MaternityType, _opdExpenseService, _setupExpenseAmountService, false);
                    ViewBag.RemainingAmount = remainingAmount;


                    ViewData["OPDEXPENSE_ID"] = idDecrypted;

                    return(View(result2));
                }
                else
                {
                    return(RedirectToAction(UrlIndex, UrlHrApproval));
                }
            }
            catch (Exception ex)
            {
                logger.Error("HRAPPROVAL : HRHospitalExpense()" + ex.Message.ToString());

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
Beispiel #3
0
        public void CalculateRemainingAmount(HospitalExpenseVM hospitalInformation)
        {
            string remainingAmount = GeneralController.CalculateRemainingAmount(hospitalInformation.EmployeeEmailAddress, hospitalInformation.OpdType, hospitalInformation.HospitalizationType, hospitalInformation.MaternityType, _opdExpenseService, _setupExpenseAmountService, true);

            ViewBag.RemainingAmount = remainingAmount;
        }
Beispiel #4
0
        public ActionResult GetRemainingAmountForHospital(string userName, string hospitalizationType, string maternityType)
        {
            string result = GeneralController.CalculateRemainingAmount(userName, FormType.HospitalExpense, hospitalizationType, maternityType, _opdExpenseService, _setupExpenseAmountService, true);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        public void CalculateRemainingAmount(OpdExpenseVM opdInformation)
        {
            string remainingAmount = GeneralController.CalculateRemainingAmount(opdInformation.EmployeeEmailAddress, opdInformation.OpdType, string.Empty, string.Empty, _opdExpenseService, _setupExpenseAmountService, true);

            ViewBag.RemainingAmount = remainingAmount;
        }