Exemplo n.º 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)));
            }
        }
Exemplo n.º 2
0
        public ActionResult Details(string id)
        {
            try
            {
                if (Request.IsAuthenticated)
                {
                    AuthenticateUser();


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

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

                    var result2 = GeneralController.GetOPDExpense(Convert.ToInt32(idDecrypted), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);
                    return(View(result2));
                }
                else
                {
                    return(RedirectToAction("Details()", UrlOpdExpense));
                }
            }
            catch (Exception ex)
            {
                logger.Error("OPD Expense : Details" + ex.Message.ToString());

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
Exemplo n.º 3
0
        private bool AuthenticateEmailAddress(int Id)
        {
            var opdInformation = GeneralController.GetOPDExpense(Convert.ToInt32(Id), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);
            OfficeManagerController managerController = new OfficeManagerController();

            string currentEmailAddress = managerController.GetEmailAddress();

            if (currentEmailAddress.Equals(opdInformation.EmployeeEmailAddress))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        // GET: OPDEXPENSEs/Edit/5
        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.GetOPDExpense(idDecrypted, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);
                    ViewData["OPDEXPENSE_ID"]  = idDecrypted;
                    ViewData["OPDTYPE"]        = opdInformation.OpdType;
                    ViewBag.EmployeeDepartment = opdInformation.EmployeeDepartment;

                    CalculateRemainingAmount(opdInformation);

                    //string  remainingAmount = GeneralController.CalculateRemainingAmount(opdInformation.EmployeeEmailAddress, opdInformation.OpdType,string.Empty , string.Empty, _opdExpenseService, _setupExpenseAmountService,true);

                    //ViewBag.RemainingAmount = remainingAmount;

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

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

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
Exemplo n.º 5
0
        // GET: OPDEXPENSEs/Edit/5
        public ActionResult HROPDExpense(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 opdExpense = GeneralController.GetOPDExpense(idDecrypted, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);

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

                    ViewData["OPDEXPENSE_ID"] = idDecrypted;
                    return(View(opdExpense));
                }

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

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
Exemplo n.º 6
0
        private bool GetOPDExpenseAmount(int Id, decimal?totalAmountClaimed)
        {
            bool result = false;

            var opdInformation = GeneralController.GetOPDExpense(Id, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);

            decimal?totalAmount = 0;

            foreach (var item in opdInformation.OpdExpenseImages)
            {
                totalAmount += item.ExpenseAmount;
            }

            if (totalAmount.Equals(totalAmountClaimed))
            {
                result = true;
            }

            return(result);
        }
Exemplo n.º 7
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)));
            }
        }
Exemplo n.º 8
0
        public ActionResult Edit(OpdExpenseVM OpdExpense)
        {
            try
            {
                string buttonStatus = Request.Form["buttonName"];

                AuthenticateUser();
                var opdInformation = GeneralController.GetOPDExpense(OpdExpense.ID, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);

                CalculateRemainingAmount(opdInformation);

                ViewData["OPDEXPENSE_ID"]  = OpdExpense.ID;
                ViewData["OPDTYPE"]        = OpdExpense.OpdType;
                ViewBag.EmployeeDepartment = OpdExpense.EmployeeDepartment;

                if (buttonStatus == "submit")
                {
                    OpdExpense.Status = ClaimStatus.SUBMITTED;
                }
                else
                {
                    OpdExpense.Status = ClaimStatus.INPROGRESS;
                }

                if (OpdExpense.Status == ClaimStatus.SUBMITTED)
                {
                    if (opdInformation.OpdExpensePatients.Count > 0)
                    {
                        if (opdInformation.OpdExpenseImages.Count > 0)
                        {
                            if (GetOPDExpenseAmount(OpdExpense.ID, 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));
                                    }
                                }
                                else
                                {
                                    ModelState.AddModelError("", Constants.MSG_GENERAL_CLAIM_AMOUNT_REMAINING_AMOUNT);
                                    return(View(opdInformation));
                                }
                            }
                            else
                            {
                                ModelState.AddModelError("", Constants.MSG_GENERAL_OPD_EXPENSE_AMOUNT);
                                return(View(opdInformation));
                            }
                        }
                        else
                        {
                            ModelState.AddModelError("", Constants.MSG_GENERAL_ADD_PATIENT_RECEIPTS);
                            return(View(opdInformation));
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", Constants.MSG_GENERAL_ADD_PATIENT_INFORMATION);
                        return(View(opdInformation));
                    }
                }
                else
                {
                    if (ModelState.IsValid)
                    {
                        OpdExpense.CreatedDate          = DateTime.Now;
                        OpdExpense.ModifiedDate         = DateTime.Now;
                        OpdExpense.EmployeeEmailAddress = GetEmailAddress();
                        _opdExpenseService.UpdateOpdExpense(OpdExpense);

                        return(RedirectToAction(UrlIndex));
                    }
                }

                return(View(opdInformation));
            }
            catch (Exception ex)
            {
                logger.Error("OPD Expense : Edit([Bind])" + ex.Message.ToString());

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }