Beispiel #1
0
        public ActionResult ViewR4P()
        {
            List <ViewR4Payment>  model = new List <ViewR4Payment>();
            List <PaymentRequest> PR    = R4PSevice.GetPaymentRequests(countryProg.Id);

            foreach (PaymentRequest item in PR)
            {
                var p4pobject = new ViewR4Payment()
                {
                    EntityPaymentRqst = item
                };
                model.Add(p4pobject);
            }
            return(View("ViewR4P", model));
        }
Beispiel #2
0
        public ActionResult RFPList()
        {
            List <ViewR4Payment>  model   = new List <ViewR4Payment>();
            List <PaymentRequest> rfpList = rfpService.GetPaymentRequestsForPosting(countryProg.Id, currentUser);

            foreach (PaymentRequest item in rfpList)
            {
                var p4pobject = new ViewR4Payment()
                {
                    EntityPaymentRqst = item
                };
                model.Add(p4pobject);
            }
            return(View(model));
        }
Beispiel #3
0
        public ActionResult ViewR4PDetails(Guid id, bool checkPost = false)
        {
            using (var context = new SCMSEntities())
            {
                PaymentRequest PR = context.PaymentRequests.SingleOrDefault(p => p.Id == id);

                List <R4PpaymentDetails>        pdlist      = new List <R4PpaymentDetails>();
                List <PaymentRequestBudgetLine> ARBlineList = context.PaymentRequestBudgetLines.Where(p => p.PaymentRequestId == PR.Id).ToList();
                foreach (PaymentRequestBudgetLine item in ARBlineList)
                {
                    var pb      = context.ProjectBudgets.SingleOrDefault(p => p.Id == item.BudgetLineId);
                    var pdatils = new R4PpaymentDetails()
                    {
                        BudgetLine            = pb.LineNumber,
                        BudgetLineDescription = pb.Description,
                        projectNo             = context.ProjectDonors.SingleOrDefault(p => p.Id == item.ProjectBudget.BudgetCategory.ProjectDonorId).ProjectNumber,
                        Amount = (decimal)item.Amount
                    };
                    pdlist.Add(pdatils);
                }
                Currency      c     = PR.Currency;
                PaymentType   pt    = PR.PaymentType;
                Supplier      sup   = PR.Supplier;
                Staff         st    = PR.Staff1;
                Person        psn   = st.Person;
                Designation   d     = st.Designation;
                PaymentTerm   pterm = PR.PaymentTerm;
                PurchaseOrder po    = PR.PurchaseOrder;
                var           model = new ViewR4Payment()
                {
                    EntityPaymentRqst = PR,
                    paymentDetais     = pdlist
                };
                var mbcurr = model.EntityPaymentRqst.Currency1;
                if (model.EntityPaymentRqst.MBValue != null)
                {
                    ViewBag.MBValue = ((decimal)model.EntityPaymentRqst.MBValue).ToString("#,##0.00");
                }
                //Reviewer and Authorizer Details
                if (model.EntityPaymentRqst.ReviewedBy != null)
                {
                    Staff reviewer = staffService.GetStaffById((Guid)model.EntityPaymentRqst.ReviewedBy);
                    ViewBag.Reviewer      = reviewer.Person.FirstName + " " + reviewer.Person.OtherNames;
                    ViewBag.ReviewerTitle = reviewer.Designation.Name;
                    ViewBag.ReviewedOn    = model.EntityPaymentRqst.ReviewedOn;
                    if (reviewer.Person.SignatureImage != null)
                    {
                        ViewBag.ReviewerSignature = "<img src=\"/Person/Photo/" + reviewer.Person.Id + "\" style=\"max-width: 150px;\" />";
                    }
                }

                if (model.EntityPaymentRqst.AuthorizedBy != null)
                {
                    Staff authorizer = staffService.GetStaffById((Guid)model.EntityPaymentRqst.AuthorizedBy);
                    ViewBag.Authorizer      = authorizer.Person.FirstName + " " + authorizer.Person.OtherNames;
                    ViewBag.AuthorizerTitle = authorizer.Designation.Name;
                    ViewBag.AuthorizedOn    = model.EntityPaymentRqst.AuthorizedOn;
                    if (authorizer.Person.SignatureImage != null)
                    {
                        ViewBag.AuthorizerSignature = "<img src=\"/Person/Photo/" + authorizer.Person.Id + "\" style=\"max-width: 150px;\" />";
                    }
                }

                //Manage approval link
                string actionType = null;
                if (model.EntityPaymentRqst.IsReviewed == true && model.EntityPaymentRqst.IsAuthorized != true)
                {
                    actionType = NotificationHelper.authorizationCode;
                }
                else if (model.EntityPaymentRqst.IsSubmitted && model.EntityPaymentRqst.IsReviewed != true)
                {
                    actionType = NotificationHelper.reviewCode;
                }
                if (actionType != null)
                {
                    model.CanApprove = notificationService.CanApprove(currentUser, NotificationHelper.rfpCode, actionType, model.EntityPaymentRqst.Id);
                }
                else
                {
                    model.CanApprove = false;
                }

                //Manage Post Funds Button
                if (userContext.HasPermission(StandardPermissionProvider.RequestForPaymentPostFunds) && checkPost)
                {
                    foreach (var rfp in R4PSevice.GetPaymentRequestsForPosting(countryProg.Id, currentUser))
                    {
                        if (rfp.Id.Equals(model.EntityPaymentRqst.Id))
                        {
                            model.CanPostFunds = true;
                            break;
                        }
                    }
                }

                return(View(model));
            }
        }