Exemplo n.º 1
0
        /////////////////////////////////////////////////////////////////////////ReOrder features
        public ActionResult TobeReOrderList()
        {
            ItemData.SetSupplier();
            List <Item> listItem = ItemData.FindAll();



            //Get all items which is in process of reOrder
            List <Item> listinprocess = PurchaseOrderData.GetItemsInProcess();

            //Get all items whose stockbalance is below reorderLevel
            List <Item> listreorder = listItem.Where(x => x.ReorderLevel > StockCardData.GetStockBalanceByItem(x)).ToList();

            //Screen out items in process
            listinprocess.ForEach(x => listreorder.Remove(x));


            Dictionary <int, int> selectedsupplier = new Dictionary <int, int>();

            foreach (Item item in listreorder)
            {
                int itId = item.Id;
                int suId = item.Supplier1.supplier.Id;
                selectedsupplier.Add(item.Id, item.Supplier1.supplier.Id);
            }



            Session["selectedsupplier"] = selectedsupplier;
            ViewBag.Rlist = listreorder;


            return(View());
        }
Exemplo n.º 2
0
        public ActionResult GenerateDelOrder()
        {
            Dictionary <int, int> collist = new Dictionary <int, int>();

            if (Session["collist"] != null)
            {
                collist = (Dictionary <int, int>)Session["collist"];
            }
            else
            {
                Session["collist"] = new Dictionary <int, int>();
            }


            List <ReqItem> lri       = ReqItemData.GetAllReqItemApproved();
            var            itemIdset = new HashSet <int>(collist.Keys);
            var            depIdset  = new HashSet <int>(lri.Select(x => x.emp.department.Id).ToList());
            List <ReqItem> slist     = new List <ReqItem>();
            List <ReqItem> xlist     = new List <ReqItem>();
            Dictionary <int, Dictionary <int, int> > list = new Dictionary <int, Dictionary <int, int> >();



            foreach (int depId in depIdset)
            {
                slist = lri.Where(x => x.emp.department.Id == depId).ToList();

                Dictionary <int, int> itemmap = new Dictionary <int, int>();
                foreach (int itemId in itemIdset)
                {
                    xlist = slist.Where(x => x.item.Id == itemId).ToList();
                    int    quant = xlist.Select(x => x.Quant).Sum();
                    double price = StockCardData.GetLatestPriceByItem(ItemData.GetItemById(itemId));
                    if (quant != 0)
                    {
                        itemmap.Add(itemId, quant);
                    }
                    DepOrderData.CreateDepOrder(depId, itemId, quant, price);

                    //Withdraw from stock
                    Item item    = ItemData.GetItemById(itemId);
                    int  balance = StockCardData.GetStockBalanceByItem(item);
                    StockCardData.WithdrawFromStockRecord(item, DateTime.Today, DepartmentData.GetDepById(depId), quant, balance);
                    int stockbalance = StockCardData.GetStockBalanceByItem(item);

                    //if (stockbalance < item.ReorderLevel) Send Notification
                }
                list.Add(depId, itemmap);
            }
            ViewBag.Rlist          = list;
            Session["plannedlist"] = list;



            return(View());
        }
Exemplo n.º 3
0
        public JsonResult CheckInPO(int pId)
        {
            PurchaseOrder po = PurchaseOrderData.GetPOById(pId);

            //Add record to stock card
            foreach (Item item in po.items.Select(x => x.item).ToList())
            {
                int balance = StockCardData.GetStockBalanceByItem(item);
                StockCardData.AddToStock(item, DateTime.Today, po.items.FirstOrDefault().supplier.Id, po.items.Select(x => x.UnitPrice).FirstOrDefault(), po.items.Select(x => x.item.ReorderQty).FirstOrDefault(), balance);
            }

            PurchaseOrderData.setStatus(pId, "delivered");
            object new_amount = new { };

            return(Json(new_amount, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public JsonResult approveInvAdj(int InvAdjId, string remark)
        {
            InventoryAdjData.ApproveInvAdj(InvAdjId, remark);

            ///Add record to stock card
            ///
            InventoryAdj invadj  = InventoryAdjData.FindById(InvAdjId);
            Item         item    = ItemData.GetItemById(invadj.item.Id);
            int          balance = StockCardData.GetStockBalanceByItem(item);

            StockCardData.AdjustStockRecord(DateTime.Today, invadj, balance);



            ///
            object n = new { amt = 0 };

            return(Json(n, JsonRequestBehavior.AllowGet));
        }