Exemple #1
0
        public List <ReqIdAndQtyBO> distributeQtyToReq(string depId, string itemNumber, int distributed, List <string> reqIdLst1) //To Update-to distribute the qty if there are multiple requisions with same item and sam dept
        {
            List <string> reqIdLst     = rda.getRequisitionIdByDepAndItem(depId, itemNumber);
            double        totalOrdered = 0;

            foreach (string s in reqIdLst)
            {
                bool alreadyExist = reqIdLst1.Contains(s); //3rd feb
                if (alreadyExist)
                {
                    int orderedQty = rda.getOrderQuantityByReqIdAndItemNumber(s, itemNumber);
                    totalOrdered = totalOrdered + Convert.ToDouble(orderedQty);
                }
            }
            List <ReqIdAndQtyBO> rqLst = new List <ReqIdAndQtyBO>();

            foreach (string s in reqIdLst)
            {
                bool alreadyExist = reqIdLst1.Contains(s);
                if (alreadyExist)
                {
                    ReqIdAndQtyBO r = new ReqIdAndQtyBO();
                    r.ReqId = s;
                    int    orderedQty = rda.getOrderQuantityByReqIdAndItemNumber(s, itemNumber);
                    double d          = Convert.ToDouble(orderedQty);
                    double disQty     = d / totalOrdered * Convert.ToDouble(distributed);
                    double finaldis   = Math.Round(disQty);
                    r.DisbursedQty = Convert.ToInt32(finaldis);
                    rqLst.Add(r);
                }
            }
            return(rqLst);
        }
Exemple #2
0
    public List <ReqIdAndQtyBO> distributeQtyToReq(string depId, string itemNumber, int distributed)
    {
        List <string> reqIdLst     = rda.getRequisitionIdByDepAndItem(depId, itemNumber);
        double        totalOrdered = 0;

        foreach (string s in reqIdLst)
        {
            int orderedQty = rda.getOrderQuantityByReqIdAndItemNumber(s, itemNumber);
            totalOrdered = totalOrdered + Convert.ToDouble(orderedQty);
        }
        List <ReqIdAndQtyBO> rqLst = new List <ReqIdAndQtyBO>();

        foreach (string s in reqIdLst)
        {
            ReqIdAndQtyBO r = new ReqIdAndQtyBO();
            r.ReqId = s;
            int    orderedQty = rda.getOrderQuantityByReqIdAndItemNumber(s, itemNumber);
            double d          = Convert.ToDouble(orderedQty);
            double disQty     = d / totalOrdered * Convert.ToDouble(distributed);
            double finaldis   = Math.Round(disQty);
            r.DisbursedQty = Convert.ToInt32(finaldis);
            rqLst.Add(r);
        }
        return(rqLst);
    }