示例#1
0
        public IHttpActionResult CreateDisbursementDetails(DisbursementDetailsModel dism)
        {
            string error = "";
            DisbursementDetailsModel disbm = DisbursementDetailsRepo.CreateDisbursementDetails(dism, out error);

            // get the inventory using the item id from Requisition details
            InventoryModel invm = InventoryRepo.GetInventoryByItemid(dism.Itemid, out error);

            // subtract  the stock accoring to  qty
            invm.Stock -= dism.Qty;

            // update the inventory
            invm = InventoryRepo.UpdateInventory(invm, out error);


            InventoryTransactionModel invtm = new InventoryTransactionModel
            {
                InvID     = invm.Invid,
                ItemID    = invm.Itemid,
                Qty       = dism.Qty * -1,
                TransType = ConInventoryTransaction.TransType.DISBURSEMENT,
                TransDate = DateTime.Now,
                Remark    = dism.Disid.ToString()
            };

            invtm = InventoryTransactionRepo.CreateInventoryTransaction(invtm, out error);



            if (error != "" || disbm == null)
            {
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(disbm));
        }
示例#2
0
        public IHttpActionResult UpadateDisbursementDetails(DisbursementDetailsModel dism)
        {
            string error = "";
            List <DisbursementDetailsModel> disbm = DisbursementDetailsRepo.UpdateDisbursementDetails(dism, out error);

            if (error != "" || disbm == null)
            {
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(disbm));
        }
示例#3
0
        public IHttpActionResult GetDisbursementDetailsByreqid(int itemid)
        {
            string error = "";
            List <DisbursementDetailsModel> disdm = DisbursementDetailsRepo.GetDisbursementDetailsByItemId(itemid, out error);

            if (error != "" || disdm == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Requisition Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(disdm));
        }
示例#4
0
        public IHttpActionResult GetBreakdownByDepartment()
        {
            // declare and initialize error variable to accept the error from Repo
            string error = "";

            // get the list from Repo and convert it into outstanding item list
            List <BreakdownByDepartmentModel> breakdown = DisbursementDetailsRepo.GetBreakdownByDepartment(out error);

            // if the erorr is not blank or the outstanding list is null
            if (error != "" || breakdown == null)
            {
                // if the error is 404
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Breakdown list Not Found"));
                }
                // if the error is other one
                return(Content(HttpStatusCode.BadRequest, error));
            }
            // if there is no error
            return(Ok(breakdown));
        }
示例#5
0
        public IHttpActionResult GetRetriveItemListforClerk()
        {
            // declare and initialize error variable to accept the error from Repo
            string error = "";

            // get the list from Repo and convert it into outstanding item list
            List <OutstandingItemModel> items = DisbursementDetailsRepo.GetAllPreparingItems(out error);

            // if the erorr is not blank or the outstanding list is null
            if (error != "" || items == null)
            {
                // if the error is 404
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Outstanding list Not Found"));
                }
                // if the error is other one
                return(Content(HttpStatusCode.BadRequest, error));
            }
            // if there is no error
            return(Ok(items));
        }