public InvoiceItem(PXGraph graph, ServiceOrderInfo serviceOrderInfo, int index) { this.FSServiceOrderRow = serviceOrderInfo.FSServiceOrderRow; this.FSSrvOrdTypeRow = serviceOrderInfo.FSSrvOrdTypeRow; this.Index = index; this.CustomerID = serviceOrderInfo.FSServiceOrderRow.BillCustomerID; this.SOID = serviceOrderInfo.FSServiceOrderRow.SOID; this.CustomerLocationID = serviceOrderInfo.FSServiceOrderRow.BillLocationID; this.CustPORefNbr = serviceOrderInfo.FSServiceOrderRow.CustPORefNbr; this.CustWorkOrderRefNbr = serviceOrderInfo.FSServiceOrderRow.CustWorkOrderRefNbr; this.PostToAPNegBalances = serviceOrderInfo.FSSrvOrdTypeRow.PostNegBalanceToAP; this.FSPostingLineDetailsToPostInAR_AP = new List <PostingLine>(); this.FSPostingLineDetailsToPostInSO = new List <PostingLine>(); foreach (FSSODet fsSODetRow in serviceOrderInfo.FSSODetToPostInAR_AP) { this.AddSOLineToList(graph, fsSODetRow, serviceOrderInfo, true, false); } foreach (FSSODet fsSODetRow in serviceOrderInfo.FSSODetToPostInSO) { this.AddSOLineToList(graph, fsSODetRow, serviceOrderInfo, false, true); } }
/// <summary> /// Adds the line <c>fsSODetRow</c> to the List <c>FSPostingLineDetailsToPostInAR_AP</c> or <c>FSPostingLineDetailsToPostInSO</c> depending on <c>addToArApList</c> and <c>addToSoList</c> flags. /// </summary> private void AddSOLineToList(PXGraph graph, FSSODet fsSODetRow, ServiceOrderInfo serviceOrderInfo, bool addToArApList, bool addToSoList) { PostingLine soLineRow = new PostingLine(); if (fsSODetRow != null) { int?itemID = fsSODetRow.InventoryID; soLineRow.TableSource = ID.TablePostSource.FSSO_DET; soLineRow.LineType = fsSODetRow.LineType; soLineRow.LineID = fsSODetRow.SODetID; soLineRow.BranchID = serviceOrderInfo.FSServiceOrderRow.BranchID; soLineRow.InventoryID = itemID; soLineRow.UOM = fsSODetRow.UOM; soLineRow.AcctID = this.GetAcct(graph, fsSODetRow, null, serviceOrderInfo.FSServiceOrderRow, serviceOrderInfo.FSSrvOrdTypeRow); soLineRow.SubID = fsSODetRow.SubID; soLineRow.SiteID = fsSODetRow.SiteID; soLineRow.LocationID = fsSODetRow.SiteLocationID; soLineRow.SubItemID = fsSODetRow.SubItemID; soLineRow.TranDesc = fsSODetRow.TranDesc; soLineRow.ProjectID = fsSODetRow.ProjectID; soLineRow.ProjectTaskID = fsSODetRow.ProjectTaskID; soLineRow.CuryUnitPrice = fsSODetRow.CuryUnitPrice; soLineRow.Qty = fsSODetRow.EstimatedQty; soLineRow.CuryTranAmt = fsSODetRow.CuryEstimatedTranAmt; soLineRow.PostID = fsSODetRow.PostID; soLineRow.IsBillable = fsSODetRow.IsBillable; } if (addToArApList) { this.FSPostingLineDetailsToPostInAR_AP.Add(soLineRow); } else if (addToSoList) { this.FSPostingLineDetailsToPostInSO.Add(soLineRow); } }