Ejemplo n.º 1
0
        public List <DisbursementDetailPayload> getUncollectedDisbursementDetailsByDep(string depId)
        {
            List <DisbursementDetail> disbursementDetails = context.DisbursementDetails
                                                            .Where(d => d.Disbursement.Requisition.Requester.DepartmentID == depId && d.Disbursement.CollectedBy == null && d.Disbursement.DisbursementDuty.isRetrieved)
                                                            .ToList();

            return(DisbursementDetailPayload.ConvertEntityToPayload(disbursementDetails));
        }
Ejemplo n.º 2
0
        public void adjustStockFromRejectedDisbursement(DisbursementDetailPayload di, string empId)
        {
            // do a stock transaction to add qty - qtyCollected back to stock
            stockManagementService.addStockTransaction(di.ItemId, di.Reason, empId, di.DisbursedQuantity - (int)di.CollectedQuantity);

            // raise a stock voucher
            int actualStockCount = stockManagementService.getStockCountOfItem(di.ItemId) - di.DisbursedQuantity - (int)di.CollectedQuantity;

            stockManagementService.addStockVoucher(di.ItemId, actualStockCount, empId, di.Reason);

            context.SaveChanges();
        }
Ejemplo n.º 3
0
        public static List <DisbursementDetailPayload> ConvertEntityToPayload(List <DisbursementDetail> disbursementDetails)
        {
            List <DisbursementDetailPayload> disbursementDetailPayloads = new List <DisbursementDetailPayload>();
            List <Item> items = disbursementDetails.Select(d => d.RequisitionDetail.Item).Distinct().OrderBy(i => i.ItemID).ToList();
            List <DisbursementDetail> details;
            DisbursementDetailPayload payload;

            foreach (Item item in items)
            {
                details = disbursementDetails.Where(d => d.RequisitionDetail.ItemID == item.ItemID).ToList();
                payload = new DisbursementDetailPayload(item);
                details.ForEach(d => payload.DisbursedQuantity += d.Quantity);
                payload.DisbursementDutyIds = details.Select(d => d.Disbursement.DisbursementDutyID).Distinct().ToList();
                disbursementDetailPayloads.Add(payload);
            }

            return(disbursementDetailPayloads);
        }