// GET: AdjustmentRecords/Details/5 public async Task <IActionResult> Details(string id) { ADTeam5User user = await _userManager.GetUserAsync(HttpContext.User); List <string> identity = userCheck.checkUserIdentityAsync(user); int userID = user.WorkID; string userRole = identity[1]; if (id == null) { return(NotFound()); } //ViewData for voucherNo ViewData["VoucherNo"] = id; //ViewBag for voucher price decimal?amount = b.GetTotalAmountForVoucher(id); decimal?GST = Math.Round((decimal)(amount * (decimal?)0.07), 2); ViewBag.Amount = amount; ViewBag.GST = GST; ViewBag.TotalAmount = amount + GST; List <AdjustmentRecordDetails> result = b.GetAdjustmentRecordDetails(id); //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; //ViewBag for record status ViewBag.AdjustmentRecordStatus = _context.AdjustmentRecord.FirstOrDefault(x => x.VoucherNo == id).Status; return(View(result)); }
//[ActionName("VoucherItemDelete"), Route("~/IssueVoucher")] public async Task <IActionResult> VoucherItemDelete(int id) { ADTeam5User user = await _userManager.GetUserAsync(HttpContext.User); List <string> identity = userCheck.checkUserIdentityAsync(user); int userID = user.WorkID; //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; List <TempVoucherDetails> tempVoucherDetailsList1 = b.GetTempVoucherDetailsList(userID); b.DeleteVoucherItem(id, tempVoucherDetailsList1); List <TempVoucherDetails> tempVoucherDetailsList = b.GetTempVoucherDetailsList(userID); if (tempVoucherDetailsList.Count == 0) { tempVoucherDetailsList = new List <TempVoucherDetails>(); } //ViewBag for voucher price string tempVoucherNo = "VTemp" + userID; decimal?amount = b.GetTotalAmountForVoucher(tempVoucherNo); decimal?GST = Math.Round((decimal)(amount * (decimal?)0.07), 2); ViewBag.Amount = amount; ViewBag.GST = GST; ViewBag.TotalAmount = amount + GST; return(PartialView("_TempVoucherDetailsList", tempVoucherDetailsList)); }