// need to reset ActualQty To Zero before += rsub.ActualQty;, because same item code from different department has same ActualQty now public void SaveActualQtyBreakdownByDepartment(int requisitionId, List <RetrievalShortfallItemSub> retrievalShortfallItemSubListOfList) { List <Disbursement> disbursementList = EFBroker_Disbursement.GetDisbursmentListbyRetrievalID(requisitionId); resetActualQtyToZero(retrievalShortfallItemSubListOfList, disbursementList); foreach (RetrievalShortfallItemSub rsub in retrievalShortfallItemSubListOfList) { foreach (Disbursement d in disbursementList) { if (rsub.DeptCode == d.DeptCode) { foreach (Disbursement_Item di in d.Disbursement_Item) { if (rsub.ItemCode == di.ItemCode) { //find the correct Disbursement_Item to save di.ActualQty += rsub.ActualQty; // di.ActualQty = rsub.ActualQty; EFBroker_Disbursement.UpdateDisbursementItem(di); } } } } } return; }
//in android //update actual qty for non-shortfall disbursement items when generate disbursement button clicked in RetrievalListDetail page at werehouse public List <RetrievalShortfallItem> UpdateRetrieval(int requisitionId, Dictionary <string, int> retrievedData) { //update retrieval status EFBroker_Disbursement.UpdateRetrievalStatus(requisitionId, "InProgress"); List <Disbursement> disbursementList = EFBroker_Disbursement.GetDisbursmentListbyRetrievalID(requisitionId); foreach (KeyValuePair <string, int> kvp in retrievedData) { string itemCode = kvp.Key; foreach (Disbursement d in disbursementList) { foreach (Disbursement_Item dI in d.Disbursement_Item) { if (dI.ItemCode.Equals(itemCode)) { dI.ActualQty = kvp.Value; EFBroker_Disbursement.UpdateDisbursementItem(dI); } } } } //call CheckShortfall method after button generate disbursement clicked in RetrievalListDetail page at werehouse return(CheckShortfall(requisitionId, retrievedData)); }
//udpate acuatal quantity if no shortfall public void UpdateAllActaulQty(int requisitionId) { List <Disbursement> disbursementList = EFBroker_Disbursement.GetDisbursmentListbyRetrievalID(requisitionId); foreach (Disbursement d in disbursementList) { foreach (Disbursement_Item dI in d.Disbursement_Item) { dI.ActualQty = dI.TotalRequestedQty; EFBroker_Disbursement.UpdateDisbursementItem(dI); } } }
public static void UpdateDisbursementActualQty(int disbID, List <int> actualQty, List <string> disbRemark) { int i = 0; using (StationeryEntities context = new StationeryEntities()) { Disbursement disbursement = GetDisbursmentbyDisbID(disbID); foreach (Disbursement_Item di in disbursement.Disbursement_Item) { di.ActualQty = actualQty[i]; di.Remarks = disbRemark[i]; EFBroker_Disbursement.UpdateDisbursementItem(di); i++; } } }
//Reset Actual Quantity to zero public void resetActualQtyToZero(List <RetrievalShortfallItemSub> retrievalShortfallItemSubListOfList, List <Disbursement> disbursementList) { foreach (RetrievalShortfallItemSub shortfallList in retrievalShortfallItemSubListOfList) { foreach (Disbursement d in disbursementList) { foreach (Disbursement_Item di in d.Disbursement_Item) { if (shortfallList.ItemCode == di.ItemCode) { di.ActualQty = 0; EFBroker_Disbursement.UpdateDisbursementItem(di); } } } } }
public void AddDisbursemen_Item(int disbursementID) { List <int> requisitionIDList = new List <int>(); requisitionIDList = EFBroker_Requisition.GetRequisitionIDListbyDisbID(disbursementID); foreach (int rL in requisitionIDList) { List <Requisition_Item> Requisition_ItemList = EFBroker_Requisition.GetRequisitionItemListbyReqID(rL); foreach (Requisition_Item r in Requisition_ItemList) { if (Disbursement_ItemList.Count != 0) { bool add = true; foreach (Disbursement_Item i in Disbursement_ItemList) { if (i.ItemCode == r.ItemCode && i.DisbursementID == r.Requisition.DisbursementID) { add = false; i.TotalRequestedQty += r.RequestedQty; EFBroker_Disbursement.UpdateDisbursementItem(i); } } if (add) { Disbursement_Item dItem1 = CreateDisbursementItemList(disbursementID, r); EFBroker_Disbursement.AddNewDisbursementItem(dItem1); Disbursement_ItemList.Add(dItem1); } } else { Disbursement_Item dItem2 = CreateDisbursementItemList(disbursementID, r); EFBroker_Disbursement.AddNewDisbursementItem(dItem2); Disbursement_ItemList.Add(dItem2); } } } }