public ActionResult RaisePo() { //load supplier var suppliers = _context.Supplier.ToList(); var stationeries = _context.Stationery.ToList(); RaisePOViewModel viewModel = new RaisePOViewModel(); viewModel.Suppliers = suppliers; viewModel.Stationeries = stationeries; viewModel.PONo = "PO" + DateTime.Now.Date.ToString("yy") + "/" + DateTime.Now.Date.ToString("MM") + "/" + GetSerialNumber(); ViewBag.PoNo = viewModel.PONo; viewModel.Categories = _context.Stationery.Select(m => m.Category).Distinct().ToList(); return(View(viewModel)); }
public ActionResult Details(string poNo) { PurchaseOrder purchaseOrder = _context.PurchaseOrder.SingleOrDefault(x => x.PONo == poNo); List <TransactionDetail> transactionDetail = _context.TransactionDetail.Where(c => c.TransactionRef == poNo).ToList(); if (poNo == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (purchaseOrder == null) { return(HttpNotFound()); } var poDetailsViewModel = new RaisePOViewModel { PurchaseOrder = purchaseOrder, PODetails = transactionDetail }; return(View(poDetailsViewModel)); }