public void updateOutstandingStatus(string itemNumber, string depId) //Update outstanding status
        {
            OutstandingInfo o = context.OutstandingInfoes.Where(x => x.ItemNumber == itemNumber && x.DepartmentID == depId).FirstOrDefault();

            o.Status = "Received";
            context.SaveChanges();
        }
Exemple #2
0
        public OutstandingInfoBO getOutstanding(string itemNumber, string depId) //To get outstanding by depId
        {
            OutstandingInfo   oi = d.getOutstandingByItemNumberAndDepId(itemNumber, depId);
            OutstandingInfoBO o  = convertOutstandingToOutstandingBO(oi);

            return(o);
        }
Exemple #3
0
        public void updateOutstnading(string itemNumber, string depId, int quantity)  //To udate outstanding
        {
            OutstandingInfo o = context.OutstandingInfoes.Where(x => x.ItemNumber == itemNumber && x.DepartmentID == depId).FirstOrDefault();

            o.Quantity = quantity;
            o.Status   = "Pending";
            context.SaveChanges();
        }
        public void updatePartialOutStanding(string itemNumber, string depId, int partialOutstanding) //Update status for outstanding fulfiled partially
        {
            OutstandingInfo o = context.OutstandingInfoes.Where(x => x.ItemNumber == itemNumber && x.DepartmentID == depId).FirstOrDefault();

            o.Status            = "Partial Received";
            o.PartialPendingQty = partialOutstanding;
            context.SaveChanges();
        }
Exemple #5
0
        public OutstandingInfoBO convertOutstandingToOutstandingBO(OutstandingInfo o)
        {
            OutstandingInfoBO obo = new OutstandingInfoBO();

            obo.ItemNumber             = o.ItemNumber;
            obo.Quantity               = o.Quantity;
            obo.OutstandingId          = o.OutstandingID;
            obo.DepartmentId           = o.DepartmentID;
            obo.PartialPendingQuantity = o.PartialPendingQty;
            obo.Status = o.Status;

            return(obo);
        }
Exemple #6
0
        public List <DisbursedInventoryBO> getDisListByDepId(string depId) //To get disbursement list
        {
            List <DisbursedInventoryBO> b      = new List <DisbursedInventoryBO>();
            List <string> itemNumberwithorders = new List <string>();
            var           query = (from x in context.Disbursements
                                   join y in context.InventoryStocks on x.ItemNumber equals y.ItemNumber
                                   where x.DepartmentID.Equals(depId) && x.Status.Equals("Ready for collection")
                                   select new { y.ItemName, y.ItemNumber, x.RequisitionID, y.ItemUOM, x.OrderQuantity, x.DisbursementQuantity }).ToList();



            foreach (var q in query)
            {
                itemNumberwithorders.Add(q.ItemNumber);  //3rd feb
                OutstandingInfo q2 = (from x in context.OutstandingInfoes
                                      where x.DepartmentID.Equals(depId) && x.ItemNumber.Equals(q.ItemNumber)
                                      select x).FirstOrDefault();

                DisbursedInventoryBO di = new DisbursedInventoryBO();
                di.ItemName             = q.ItemName;
                di.ItemNumber           = q.ItemNumber;
                di.ItemUOM              = q.ItemUOM;
                di.OrderQuantity        = Convert.ToInt32(q.OrderQuantity);
                di.DisbursementQuantity = Convert.ToInt32(q.DisbursementQuantity);
                if (q2 == null)
                {
                    di.OutstandingQuantity = 0;
                }
                else
                {
                    di.OutstandingQuantity = Convert.ToInt32(q2.Quantity);
                }
                di.RequisitionId = q.RequisitionID;
                b.Add(di);
            }
            List <DisbursedInventoryBO> b1 = getOutstandingWithoutOrders(depId, itemNumberwithorders); //3rd feb

            foreach (DisbursedInventoryBO dbo in b1)
            {
                b.Add(dbo);
            }
            return(b);
        }
        public int getOutstandingByDepAndItem(string depId, string itemNumber) //get outstanding qty
        {
            OutstandingInfo o = context.OutstandingInfoes.Where(x => x.DepartmentID.Equals(depId) && x.ItemNumber.Equals(itemNumber) && x.Status != "Received").FirstOrDefault();

            if (o != null)
            {
                if (o.Status == "Pending")
                {
                    return((int)o.Quantity);
                }
                else
                {
                    return((int)o.PartialPendingQty);
                }
            }
            else
            {
                return(0);
            }
        }
Exemple #8
0
        public void updateDisList(List <ReadyForCollectionBO> rcboLst) //Update disbursement list with its outstanding
        {
            foreach (ReadyForCollectionBO rbo in rcboLst)
            {
                Disbursement d = (from x in context.Disbursements
                                  where x.DepartmentID == rbo.DepId && x.RequisitionID.Equals(rbo.ReqisitionId) && x.ItemNumber == rbo.ItemNumber
                                  select x).FirstOrDefault();
                if (d != null)
                {
                    d.Status = "Close";
                    d.DisbursementQuantity = rbo.DisbursedQuantity;
                    context.SaveChanges();
                    OutstandingInfo q2 = (from x in context.OutstandingInfoes
                                          where x.DepartmentID.Equals(rbo.DepId) && x.ItemNumber.Equals(rbo.ItemNumber)
                                          select x).FirstOrDefault();

                    if (q2 != null)
                    {
                        int requestedQty = Convert.ToInt32(d.OrderQuantity);
                        int dispQty      = (int)rbo.DisbursedQuantity; //To read from text box
                        //Check for outstanding status
                        if (q2.Status != "Partial Received")
                        {
                            if ((requestedQty - dispQty) > 0)
                            {
                                q2.Quantity += (requestedQty - dispQty);
                            }
                            else if ((requestedQty - dispQty) < 0)
                            {
                                q2.Quantity -= (dispQty - requestedQty);
                            }
                            else
                            {
                                q2.Quantity = 0;
                            }
                        }

                        else
                        {
                            if ((requestedQty - dispQty) > 0)
                            {
                                q2.Quantity = q2.PartialPendingQty + (requestedQty - dispQty);
                            }
                            else if ((requestedQty - dispQty) < 0)
                            {
                                q2.Quantity = q2.PartialPendingQty + (dispQty - requestedQty);
                            }
                            else
                            {
                                q2.Quantity = 0;
                            }
                        }

                        if (q2.Quantity > 0)
                        {
                            q2.Status = "Pending";
                        }
                        else
                        {
                            q2.Status = "Received";
                        }
                        context.SaveChanges();
                    }
                }
            }
        }
Exemple #9
0
        public OutstandingInfo getOutstandingByItemNumberAndDepId(string itemNumber, string depId) //To get outstanding qty
        {
            OutstandingInfo o = context.OutstandingInfoes.Where(x => x.ItemNumber == itemNumber && x.DepartmentID == depId).FirstOrDefault();

            return(o);
        }