public ActionResult MarkAsCollected(int collectedQuantity, string itemNo)
 {
     RetrievalList rList = inventorySvc.GetRetrievalList();
     inventorySvc.UpdateCollectionInfo(rList, collectedQuantity, itemNo);
     
     return RedirectToAction("RetrievalList");
 }
Exemplo n.º 2
0
        public List <wcfRetrivalList> getRetrivalList()
        {
            List <wcfRetrivalList> retrialList = new List <wcfRetrivalList>();
            RetrievalList          reList      = new RetrievalList();

            reList = invService.GetRetrievalList();
            int?rid = reList.retrievalId;
            List <RetrievalListItems> itemsToR = reList.itemsToRetrieve;

            foreach (RetrievalListItems r in itemsToR)
            {
                wcfRetrivalList rl = new wcfRetrivalList();
                rl.ItemNo       = r.itemNo;
                rl.ItemName     = r.description;
                rl.BinNo        = r.binNo;
                rl.RequestedQty = r.requiredQuantity.ToString();
                rl.RetrievedQty = r.collectedQuantity.ToString();

                String st = "";
                if (r.collectionStatus.ToString().Equals("False"))
                {
                    st = "Not Collected";
                }
                else
                {
                    st = "Collected";
                }
                rl.Status = st;
                retrialList.Add(rl);
            }
            return(retrialList);
        }
Exemplo n.º 3
0
        public RetrievalList FindCurrentRetrievalList()
        {
            DateTime      today         = DateTime.Today;
            RetrievalList retrievalList = db.RetrievalLists.SingleOrDefault(r => r.StartDate <= today && r.EndDate >= today);

            return(retrievalList);
        }
Exemplo n.º 4
0
        //GET: Using Rerieval List table
        public ActionResult NewViewRetrievalList()
        {
            RetrievalList retrievalList = reqService.FindCurrentRetrievalList();   //GenerateRetrievalList() method in requisition service updated
            List <Item>   items         = reqService.GetDistictItemForRetrievalList(retrievalList);

            return(View("~/Views/Store/Clerk/NewViewRetrievalList.cshtml", Tuple.Create(retrievalList, items)));
        }
Exemplo n.º 5
0
 public ActionResult UpdateRequisitionDetails(Requisition requisition)
 {
     if (ModelState.IsValid)
     {
         Requisition editedRequisition = reqService.GetRequisitionById(requisition.RequisitionID);
         for (int i = 0; i < editedRequisition.RequisitionDetails.Count; i++)
         {
             editedRequisition.RequisitionDetails.ToList()[i].QuantityReceived = requisition.RequisitionDetails.ToList()[i].QuantityReceived;
         }
         if (reqService.IsCompleted(editedRequisition))
         {
             editedRequisition.CompletedDate = DateTime.Now;
             editedRequisition.Status        = Status.Completed;
         }
         else
         {
             editedRequisition.Status = Status.Incomplete;
             RetrievalList retrievalList = reqService.GetRetrievalListForNow();
             reqService.IncompletedRequisitionTransferToRetrieval(editedRequisition, retrievalList);
             reqService.UpdateRetrievalList(retrievalList);
         }
         reqService.UpdateRequisition(editedRequisition);
         return(RedirectToAction("ViewDetails", new { id = requisition.RequisitionID }));
     }
     return(View("~/Views/Store/Clerk/UpdateRequisitionDetails.cshtml", requisition));
 }
Exemplo n.º 6
0
        public IHttpActionResult GetRetrievalListByItem(int id)
        {
            RetrievalList retrievalList = FindCurrentRetrievalList();

            if (retrievalList == null)
            {
                return(NotFound());
            }
            int retrievalListId = retrievalList.RetrievalListID;
            List <CustomRetrievalListDetail> details = db.RetrievalListDetails.Where(r => r.RetrievalListID == retrievalListId &&
                                                                                     r.ItemID == id)
                                                       .Select(r => new CustomRetrievalListDetail {
                DepartmentID    = r.DepartmentID,
                DepartmentName  = r.Department.DepartmentName,
                Quantity        = r.Quantity,
                QuantityOffered = r.QuantityOffered
            }).ToList();

            if (details == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(details));
            }
        }
Exemplo n.º 7
0
        public IHttpActionResult UpdateRetrievalListByItem(CustomRetrievalList customRetrievalList)
        {
            RetrievalList retrievalList = FindCurrentRetrievalList();

            if (retrievalList == null)
            {
                return(NotFound());
            }
            int retrievalListId = retrievalList.RetrievalListID;

            CustomRetrievalListDetail[] retrievalListDetails = customRetrievalList.RetrievalListDetails;
            int itemId = customRetrievalList.ItemID;

            for (int i = 0; i < retrievalListDetails.Length; i++)
            {
                CustomRetrievalListDetail customDetail = retrievalListDetails[i];
                RetrievalListDetail       detail       = db.RetrievalListDetails.SingleOrDefault(
                    r => r.RetrievalListID == retrievalListId &&
                    r.ItemID == itemId &&
                    r.DepartmentID == customDetail.DepartmentID);
                detail.QuantityOffered = customDetail.QuantityOffered;
            }
            db.SaveChanges();
            return(Ok());
        }
        public ActionResult ViewRetrievalList()
        {
            List <RetrievalList> list          = new List <RetrievalList>();
            RetrievalList        retrievalList = new RetrievalList();
            RetrievalDAO         retrieval     = new RetrievalDAO();

            retrievalList.retrievals = retrieval.GetItemsAndQty();
            foreach (var item in retrievalList.retrievals)
            {
                if (retrieval.checkOutstandingList(item.ItemId))
                {
                    int outstandingQty = retrieval.GetOutstandingQtyByItemId(item.ItemId);
                    item.Qty += outstandingQty;
                }
            }

            foreach (var item in retrievalList.retrievals)
            {
                string        itemId = item.ItemId;
                RetrievalList r_list = new RetrievalList();

                r_list.ItemId       = itemId;
                r_list.ItemDesc     = retrieval.GetItemDescByItemId(itemId);
                r_list.Total        = item.Qty;
                r_list.RetrievedQty = 0;
                r_list.ItemReqList  = retrieval.GetItemRequestAndDepts(itemId);
                foreach (var row in r_list.ItemReqList)
                {
                    r_list.RetrievedQty += row.ActualQty;
                }
                list.Add(r_list);
            }
            return(View(list));
        }
        public ActionResult UpdateEmployeeRequisition(Requisition requisition)
        {
            if (ModelState.IsValid)
            {
                Requisition editedRequisition = reqService.GetRequisitionById(requisition.RequisitionID);
                for (int i = 0; i < editedRequisition.RequisitionDetails.Count; i++)
                {
                    editedRequisition.RequisitionDetails[i].QuantityReceived = requisition.RequisitionDetails[i].QuantityReceived;
                }

                if (reqService.IsCompleted(editedRequisition))
                {
                    editedRequisition.CompletedDate = DateTime.Now;
                    editedRequisition.Status        = Status.Completed;
                }
                else
                {
                    editedRequisition.Status = Status.Incomplete;
                    RetrievalList retrievalList = reqService.FindCurrentRetrievalList();
                    if (retrievalList == null)
                    {
                        retrievalList = reqService.CreateRetrievalList();
                    }
                    reqService.IncompletedRequisitionTransferToRetrieval(editedRequisition, retrievalList);
                    reqService.UpdateRetrievalList(retrievalList);
                }
                reqService.UpdateRequisition(editedRequisition);
                return(RedirectToAction("EmployeeRequisitionDetails", new { id = requisition.RequisitionID }));
            }
            return(View("~/Views/Department/Representative/UpdateEmployeeRequisition.cshtml", requisition));
        }
Exemplo n.º 10
0
        public IHttpActionResult GetRetrievalList()
        {
            RetrievalList retrievalList = FindCurrentRetrievalList();

            if (retrievalList == null)
            {
                return(NotFound());
            }
            else
            {
                int id = retrievalList.RetrievalListID;
                List <CustomItem> retrieval = db.RetrievalListDetails.Where(r => r.RetrievalListID == id).GroupBy(r => new { r.ItemID, r.Item.Description })
                                              .Select(r => new CustomItem
                {
                    ItemID           = r.Key.ItemID,
                    Description      = r.Key.Description,
                    Quantity         = r.Sum(i => i.Quantity),
                    QuantityReceived = r.Sum(i => i.QuantityReceived),
                    QuantityOffered  = r.Sum(i => i.QuantityOffered)
                }).ToList();

                if (retrieval == null)
                {
                    return(NotFound());
                }
                else
                {
                    return(Ok(retrieval));
                }
            }
        }
Exemplo n.º 11
0
        //Get the distinct items for retireval list
        public List <Item> GetDistictItemForRetrievalList(RetrievalList retrievalList)
        {
            List <Item> items = retrievalList.RetrievalListDetails.GroupBy(x => x.Item)
                                .Select(x => x.Key)
                                .ToList();

            return(items);
        }
Exemplo n.º 12
0
        public void InsertRetrievalList(List <RetrievalItemViewModel> rivmList)
        {
            var deptRetrievalItemViewModel = new List <DeptRetrievalItemViewModel>();

            // consolidate all dept retrival item to a single list
            foreach (RetrievalItemViewModel rivm in rivmList)
            {
                // find item from database
                //Debug.WriteLine("rivm items are: " + rivm.item.Description);
                foreach (DeptRetrievalItemViewModel drvm in rivm.deptRetrievalItems)
                {
                    //construct full transactionitem with referencee to db

                    //Debug.WriteLine("drvm items are: " + drvm.transactionItem.Item.ID);
                    deptRetrievalItemViewModel.Add(drvm);
                }
            }
            var temp = from x in deptRetrievalItemViewModel select new { x.deptID };

            var deptIdList = temp.GroupBy(i => i.deptID).Select(y => y.First());
            //Unique Departments with in deptRetrievalItemViewModel
            List <string> deptids = new List <string>();

            foreach (var x in deptIdList)
            {
                deptids.Add(x.deptID);
            }

            foreach (string deptid in deptids)
            {
                RetrievalList          rl = new RetrievalList(loginService.StaffFromSession, unitOfWork.DepartmentRepository.GetByID(deptid));
                List <TransactionItem> transactionItems = new List <TransactionItem>();
                foreach (DeptRetrievalItemViewModel drvm in deptRetrievalItemViewModel)
                {
                    if (drvm.deptID == deptid)
                    {
                        TransactionItem transItem = new TransactionItem(drvm, unitOfWork);
                        transactionItems.Add(transItem);
                    }
                }
                rl.ItemTransactions = transactionItems;

                if (unitOfWork.StockCardEntryRepository.ProcessRetrivalListCompletion(rl))
                {
                    rl.InProgress();
                    unitOfWork.RetrievalListRepository.Insert(rl);
                    unitOfWork.Save();
                    Debug.WriteLine("Retrieval List is inserted into database successfully.");
                    InventoryService inventoryService = new InventoryService();
                    foreach (TransactionItem ti in rl.ItemTransactions)
                    {
                        inventoryService.UpdateInStoreQty(ti.Item.ID);
                    }
                }
            }
        }
Exemplo n.º 13
0
        ////After update the requisitiondetail, the incompleted requisitions need to transfer to next retrieval list
        public RetrievalList GetRetrievalListForNow()
        {
            DateTime      today         = DateTime.Today;
            RetrievalList retrievalList = db.RetrievalLists.Include(x => x.RequisitionRetrievals)
                                          .Include(x => x.RetrievalListDetails)
                                          .Where(x => x.StartDate <= today && x.EndDate >= today)
                                          .SingleOrDefault();

            return(retrievalList);
        }
Exemplo n.º 14
0
        public ActionResult UpdateRetrievalList(int id_retrieval)
        {
            RetrievalList retrievalList = db.RetrievalLists.SingleOrDefault(r => r.RetrievalListID == id_retrieval);
            List <Item>   items         = reqService.GetDistictItemForRetrievalList(retrievalList);

            ViewData["items"] = items;
            reqService.SequencedRetrievalList(items, retrievalList);
            reqService.UpdateRetrievalList(retrievalList);
            return(View("~/Views/Store/Clerk/UpdateRetrievalList.cshtml", retrievalList));
        }
Exemplo n.º 15
0
        public ActionResult Print(int?id)
        {
            UnitOfWork uow = new UnitOfWork();

            RetrievalList retrievalList = uow.RetrievalListRepository.Get(filter: x => x.ID == id, includeProperties: "CreatedByStaff, ItemTransactions.Item").FirstOrDefault();
            //DisbursementList disbursementList = unitOfWork.DisbursementListRepository.GetByID(id);
            var pdfResult = new ActionAsPdf("Details", new { id = id });

            return(pdfResult);
        }
Exemplo n.º 16
0
        public RetrievalList ViewDeptRetrievalList(string deptID)
        {
            Staff clerk = unitOfWork.StaffRepository.GetByID(10003);
            var   dept  = unitOfWork.DepartmentRepository.GetByID(deptID);
            List <TransactionItem> deptRetrievalList = GenerateDeptRetrievalList(deptID, false);
            RetrievalList          retrievalList     = new RetrievalList(clerk, dept);

            retrievalList.ItemTransactions = deptRetrievalList;
            return(retrievalList);
        }
Exemplo n.º 17
0
 public void UpdateCollectionInfo(RetrievalList rList, int collectedQuantity, string itemNo)
 {
     foreach (var item in rList.itemsToRetrieve)
     {
         if (item.itemNo.Equals(itemNo))
         {
             item.collectedQuantity = collectedQuantity;
             item.collectionStatus  = true;
         }
     }
 }
        public ActionResult DisbursementList()
        {
            RetrievalList retrievalList   = reqService.FindCurrentRetrievalList();
            int           retrievalListId = retrievalList.RetrievalListID - 1;
            List <RetrievalListDetail> disbursementList = repService.GetDisbursementList(retrievalListId);
            RetrievalList lastRetrievalList             = db.RetrievalLists.SingleOrDefault(r => r.RetrievalListID == retrievalListId);

            ViewBag.startDate = lastRetrievalList.StartDate.ToString("dd/MM/yyyy");
            ViewBag.endDate   = lastRetrievalList.EndDate.ToString("dd/MM/yyyy");
            return(View("~/Views/Department/Representative/DisbursementList.cshtml", disbursementList));
        }
Exemplo n.º 19
0
        public ActionResult Index()
        {
            Staff user = loginService.StaffFromSession;

            Debug.WriteLine("name of staff loggin in = " + user.Name);
            Debug.WriteLine("role of staff loggin in = " + user.StaffRole);
            Debug.WriteLine("dept of staff loggin in = " + user.DepartmentID);
            Debug.WriteLine("actual authorization role = " + Session["role"].ToString());
            RetrievalList RL = new RetrievalList(loginService.StaffFromSession, null);

            return(RedirectToAction("Dashboard"));
        }
 public ActionResult RetrievalList()
 {
     RetrievalList rList = inventorySvc.GetRetrievalList();
     if (TempData["doc"] != null)
     {
         ViewBag.Error = TempData["doc"];
     }
     DateTime suggestedDeliveryDate = DateTime.Today.AddDays(utilSvc.DaysToAdd(DateTime.Today.DayOfWeek, DayOfWeek.Friday));
     ViewBag.SuggestedDeliveryDate = suggestedDeliveryDate;
     ViewBag.RList = rList;
     return View("ViewRetrievalList");
 }
Exemplo n.º 21
0
        public void PopulateRetrievalList()
        {
            System.Web.HttpContext.Current.Application.Lock();
            RetrievalList rList = (RetrievalList)System.Web.HttpContext.Current.Application["RetrievalList"];

            if (rList.requisitionList == null)
            {
                rList.requisitionList = GetOutStandingRequisitions();
            }

            System.Web.HttpContext.Current.Application["RetrievalList"] = rList;
            System.Web.HttpContext.Current.Application.UnLock();
        }
Exemplo n.º 22
0
 public void markascollected(String collected, String itemNo)
 {
     try
     {
         int           collectedid = Convert.ToInt32(collected);
         RetrievalList rList       = invService.GetRetrievalList();
         invService.UpdateCollectionInfo(rList, collectedid, itemNo);
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e.ToString());
     }
 }
Exemplo n.º 23
0
        public RetrievalList CreateRetrievalList()
        {
            DateTime      today           = DateTime.Today;
            int           daysUntilFriday = ((int)DayOfWeek.Friday - (int)today.DayOfWeek + 7) % 7;
            DateTime      nextFriday      = today.AddDays(daysUntilFriday);
            DateTime      lastSaturday    = nextFriday.AddDays(-6);
            RetrievalList retrievalList   = new RetrievalList {
                StartDate = lastSaturday, EndDate = nextFriday
            };

            db.RetrievalLists.Add(retrievalList);
            db.SaveChanges();
            return(retrievalList);
        }
Exemplo n.º 24
0
        public void SequencedRetrievalList(List <Item> items, RetrievalList retrievalList)
        {
            List <RetrievalListDetail> newRetrievalListDetails = new List <RetrievalListDetail>();

            foreach (var item in items)
            {
                List <RetrievalListDetail> retrievalListDetails = retrievalList.RetrievalListDetails.Where(x => x.ItemID == item.ItemID).ToList();
                newRetrievalListDetails.AddRange(retrievalListDetails);
            }
            for (int i = 0; i < retrievalList.RetrievalListDetails.Count; i++)
            {
                retrievalList.RetrievalListDetails[i] = newRetrievalListDetails[i];
            }
        }
Exemplo n.º 25
0
        public String wcfBtnReqList()
        {
            RetrievalList rList  = invService.GetRetrievalList();
            String        result = "";

            if (rList.requisitionList == null)
            {
                result = "generate";
            }
            else
            {
                result = "view";
            }
            return(result);
        }
Exemplo n.º 26
0
 public ActionResult UpdateRetrievalList(RetrievalList retrievalList)
 {
     if (ModelState.IsValid)
     {
         RetrievalList editedRetrieval = reqService.GetRetrievalListById(retrievalList.RetrievalListID);
         List <Item>   items           = reqService.GetDistictItemForRetrievalList(editedRetrieval);
         reqService.SequencedRetrievalList(items, editedRetrieval);
         for (int i = 0; i < editedRetrieval.RetrievalListDetails.Count; i++)
         {
             editedRetrieval.RetrievalListDetails[i].QuantityOffered = retrievalList.RetrievalListDetails[i].QuantityOffered;
         }
         reqService.UpdateRetrievalList(editedRetrieval);
         return(RedirectToAction("NewViewRetrievalList"));
     }
     return(View("~/Views/Store/Clerk/UpdateRetrievalList.cshtml", retrievalList));
 }
Exemplo n.º 27
0
        public IHttpActionResult GetDisbursementListForDept(int id)
        {
            int               retrievalListId = FindCurrentRetrievalList().RetrievalListID - 1;
            RetrievalList     retrievalList   = db.RetrievalLists.SingleOrDefault(r => r.RetrievalListID == retrievalListId);
            List <CustomItem> disbursement    = db.RetrievalListDetails.Where(r => r.RetrievalListID == retrievalListId &&
                                                                              r.DepartmentID == id)
                                                .Select(r => new CustomItem
            {
                ItemID           = r.ItemID,
                Description      = r.Item.Description,
                Quantity         = r.Quantity,
                QuantityReceived = r.QuantityReceived
            }).ToList();

            return(Ok(disbursement));
        }
Exemplo n.º 28
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);


            //Clears loaded view engines, loads customized one
            ViewEngines.Engines.Clear();

            ExtendedRazorViewEngine engine = new ExtendedRazorViewEngine();

            engine.AddViewLocationFormat("~/Views/Department/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/Department/{1}/{0}.cshtml");

            engine.AddViewLocationFormat("~/Views/Store/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/Store/{1}/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/Store/Adjustment/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/Store/Disbursement/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/Store/Inventory/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/Store/Maintain/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/Store/Resupply/{0}.cshtml");

            engine.AddViewLocationFormat("~/Views/TestViews/{0}.cshtml");
            engine.AddViewLocationFormat("~/Views/TestViews/{1}/{0}.cshtml");

            // Add a shared location too, as the lines above are controller specific
            engine.AddPartialViewLocationFormat("~/Views/Department/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/Department/{1}/{0}.cshtml");

            engine.AddPartialViewLocationFormat("~/Views/Store/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/Store/{1}/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/Store/Adjustment/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/Store/Disbursement/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/Store/Inventory/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/Store/Maintain/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/Store/Resupply/{0}.cshtml");

            engine.AddPartialViewLocationFormat("~/Views/TestViews/{0}.cshtml");
            engine.AddPartialViewLocationFormat("~/Views/TestViews/{1}/{0}.cshtml");

            ViewEngines.Engines.Add(engine);

            AreaRegistration.RegisterAllAreas();
            //RegisterRoutes(RouteTable.Routes);
            Application["RetrievalList"] = new RetrievalList();
        }
        public ActionResult CreateRetrievalList()
        {
            RetrievalDAO retrieval = new RetrievalDAO();

            RetrievalList retrievalList = new RetrievalList();

            retrievalList.retrievals = retrieval.GetRetrievalList();
            //foreach (var item in retrievalList.retrievals)
            //{
            //    if (retrieval.checkOutstandingList(item.ItemId))
            //    {
            //        int outstandingQty = retrieval.GetOutstandingQtyByItemId(item.ItemId);
            //        item.Qty += outstandingQty;
            //    }
            //}
            return(View(retrievalList));
        }
Exemplo n.º 30
0
        public bool ProcessRetrivalListCompletion(RetrievalList RL)
        {
            if (RL == null)
            {
                return(false);
            }
            List <TransactionItem> items = RL.ItemTransactions?.ToList();

            if (items == null || items.Count == 0)
            {
                return(false);
            }

            bool isTransactionOk = true;
            List <StockCardEntry> transactions = new List <StockCardEntry>();

            foreach (TransactionItem item in items)
            {
                if (item.Item == null)
                {
                    isTransactionOk = false;
                    break;
                }
                else
                {
                    transactions.Add(new StockCardEntry(item.Item, -item.TakeOverQty, RL));
                }
            }
            if (isTransactionOk)
            {
                foreach (StockCardEntry transaction in transactions)
                {
                    Insert(transaction);
                }
                return(true);
            }
            else
            {
                Debug.WriteLine("ERROR: RETRIVAL LIST CONFIRMATION TRANSACTION FAILED");
                Debug.WriteLine("RL-ID: " + RL.ID);
                return(false);
            }
        }