コード例 #1
0
        // GET: OPDEXPENSEs/Details/5
        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 hospitalInformation = GeneralController.GetHospitalExpense(Convert.ToInt32(idDecrypted), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);

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

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
コード例 #2
0
        private bool AuthenticateEmailAddress(int id)
        {
            var opdInformation = GeneralController.GetHospitalExpense(Convert.ToInt32(id), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);
            OfficeManagerController managerController = new OfficeManagerController();

            string currentEmailAddress = managerController.GetEmailAddress();

            if (currentEmailAddress.Equals(opdInformation.EmployeeEmailAddress))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
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 hospitalInformation = GeneralController.GetHospitalExpense(Convert.ToInt32(idDecrypted), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);

                    ViewData["OPDEXPENSE_ID"]  = idDecrypted;
                    ViewData["OPDTYPE"]        = hospitalInformation.OpdType;
                    ViewBag.EmployeeDepartment = hospitalInformation.EmployeeDepartment;
                    ViewBag.EmailAddress       = hospitalInformation.EmployeeEmailAddress;
                    //string remainingAmount = GeneralController.CalculateRemainingAmount(hospitalInformation.EmployeeEmailAddress, hospitalInformation.OpdType, hospitalInformation.HospitalizationType, hospitalInformation.MaternityType, _opdExpenseService,_setupExpenseAmountService , true);
                    //ViewBag.RemainingAmount = remainingAmount;

                    CalculateRemainingAmount(hospitalInformation);

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

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

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
コード例 #4
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)));
            }
        }
コード例 #5
0
        private bool GetHOSExpenseAmount(OpdExpenseVM opdExpense, decimal?totalAmountClaimed)
        {
            bool result = false;

            var hospitalInformation = GeneralController.GetHospitalExpense(opdExpense.ID, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);

            decimal?totalAmount = 0;

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

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

            return(result);
        }
コード例 #6
0
        public ActionResult DetailsForHospitalExpense(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.GetHospitalExpense(idDecrypted, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);



                    return(View(result2));
                }

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

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
コード例 #7
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)));
            }
        }
コード例 #8
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)));
            }
        }