public ActionResult Edit(string id)
        {
            try
            {
                if (Request.IsAuthenticated)
                {
                    AuthenticateUser();
                    if (id == null)
                    {
                        return(RedirectToAction(UrlIndex, UrlOpdExpense));
                    }

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

                    var opdInformation = GeneralController.GetTravelExpense(Convert.ToInt32(idDecrypted), _opdExpenseService, _travelExpenseService);
                    ViewData["OPDEXPENSE_ID"]  = idDecrypted;
                    ViewData["OPDTYPE"]        = opdInformation.OpdType;
                    ViewBag.EmployeeDepartment = opdInformation.EmployeeDepartment;

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


                    return(View(opdInformation));
                }
                else
                {
                    return(RedirectToAction(UrlIndex, UrlOpdExpense));
                }
            }
            catch (Exception ex)
            {
                logger.Error("Travel Expense : Edit()" + ex.Message.ToString());

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
Exemple #2
0
        // GET: OPDEXPENSEs/Details/5
        public ActionResult DetailsForOPDExpense(string id)
        {
            try
            {
                if (Request.IsAuthenticated)
                {
                    AuthenticateUser();

                    int idDecrypted = Security.DecryptId(id);


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

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

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

                    return(View(result2));
                }

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

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
Exemple #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;
        }
Exemple #4
0
        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)));
            }
        }
Exemple #5
0
        public ActionResult HRHospitalExpense(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 (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;
                }
                if (ModelState.IsValid)
                {
                    oPDEXPENSE.ModifiedDate   = DateTime.Now;
                    oPDEXPENSE.HrApprovalDate = DateTime.Now;
                    oPDEXPENSE.HrEmailAddress = GetEmailAddress();

                    _opdExpenseService.UpdateOpdExpense(oPDEXPENSE);

                    EmailSend(oPDEXPENSE);

                    return(RedirectToAction(UrlIndex, UrlHrApproval));
                }

                var opdExpense = GeneralController.GetHospitalExpense(Convert.ToInt32(oPDEXPENSE.ID), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);
                ViewData["OPDEXPENSE_ID"] = oPDEXPENSE.ID;
                return(View(opdExpense));
            }
            catch (Exception ex)
            {
                logger.Error("HRAPPROVAL : HRHospitalExpense([Bind])" + ex.Message.ToString());

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
Exemple #6
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));
        }
        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)));
            }
        }
Exemple #8
0
        public void CalculateRemainingAmount(OpdExpenseVM opdInformation)
        {
            string remainingAmount = GeneralController.CalculateRemainingAmount(opdInformation.EmployeeEmailAddress, opdInformation.OpdType, string.Empty, string.Empty, _opdExpenseService, _setupExpenseAmountService, true);

            ViewBag.RemainingAmount = remainingAmount;
        }