示例#1
0
        // GET: PurchaseOrderRecords/Details/5
        //[HttpPost]
        public async Task <IActionResult> Details(string id)
        {
            ADTeam5User user = await _userManager.GetUserAsync(HttpContext.User);

            List <string> identity = userCheck.checkUserIdentityAsync(user);
            int           userID   = user.WorkID;

            tempPurchaseOrderRecordDetails = new List <PurchaseOrderRecordDetails>();

            //Viewbag for category dropdown list, need to post back
            List <Catalogue> categoryList = new List <Catalogue>();
            var q = _context.Catalogue.GroupBy(x => new { x.Category }).Select(x => x.FirstOrDefault());

            foreach (var item in q)
            {
                categoryList.Add(item);
            }
            categoryList.Insert(0, new Catalogue {
                ItemNumber = "0", Category = "---Select Category---"
            });
            ViewBag.ListofCategory = categoryList;

            if (id == null)
            {
                return(NotFound());
            }

            //ViewBag for voucher price
            decimal?amount = b.GetTotalAmountForPO(id);
            decimal?GST    = Math.Round((decimal)(amount * (decimal?)0.07), 2);

            ViewBag.Amount      = amount;
            ViewBag.GST         = GST;
            ViewBag.TotalAmount = amount + GST;
            ViewBag.POStatus    = _context.PurchaseOrderRecord.Find(id).Status;


            tempPurchaseOrderRecordDetails = b.GetPurchaseOrderRecordDetails(id);
            return(View(tempPurchaseOrderRecordDetails));
        }