protected override PMCommitment FromRecord(PXCache sender, object row) { POLine poline = (POLine)row; POOrder order = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder)); PMCommitment commitment = new PMCommitment(); commitment.Type = PMCommitmentType.Internal; commitment.CommitmentID = poline.CommitmentID ?? Guid.NewGuid(); commitment.AccountGroupID = GetAccountGroup(sender, row); commitment.ProjectID = poline.ProjectID; commitment.ProjectTaskID = poline.TaskID; commitment.UOM = poline.UOM; commitment.Qty = poline.OrderQty; commitment.Amount = poline.ExtCost; commitment.OpenQty = poline.OpenQty; commitment.OpenAmount = poline.OpenAmt; commitment.ReceivedQty = poline.ReceivedQty; commitment.InvoicedQty = 0; commitment.InvoicedAmount = 0; commitment.InvoicedIsReadonly = true; commitment.RefNoteID = order.NoteID; commitment.InventoryID = poline.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID; commitment.CostCodeID = poline.CostCodeID ?? CostCodeAttribute.GetDefaultCostCode(); if (poline.Cancelled == true) { commitment.Qty = poline.ReceivedQty; commitment.Amount = poline.ReceivedCost; } return(commitment); }
protected override int?GetAccountGroup(PXCache sender, object row) { POLine poline = (POLine)row; InventoryItem item = (InventoryItem)PXSelectorAttribute.Select <POLine.inventoryID>(sender.Graph.Caches[detailEntity], row); if (item != null && item.StkItem == true && item.COGSAcctID != null) { Account account = (Account)PXSelectorAttribute.Select <InventoryItem.cOGSAcctID>(sender.Graph.Caches[typeof(InventoryItem)], item); if (account != null && account.AccountGroupID != null) { return(account.AccountGroupID); } } else { Account account = (Account)PXSelectorAttribute.Select <POLine.expenseAcctID>(sender.Graph.Caches[detailEntity], row); if (account != null && account.AccountGroupID != null) { return(account.AccountGroupID); } } return(null); }
public virtual void FillPOLineFromDemand(POLine dest, POFixedDemand demand, string OrderType, SOLineSplit3 solinesplit, FillPOLineFromDemandDelegate del) { if (demand.PlanType == INPlanConstants.PlanF6) { PXResult <FSSODetSplit, FSSODet> fsSODetSplitDetRow = (PXResult <FSSODetSplit, FSSODet>) PXSelectJoin <FSSODetSplit, InnerJoin <FSSODet, On < FSSODet.lineNbr, Equal <FSSODetSplit.lineNbr>, And <FSSODet.srvOrdType, Equal <FSSODetSplit.srvOrdType>, And <FSSODet.refNbr, Equal <FSSODetSplit.refNbr> > > > >, Where < FSSODetSplit.planID, Equal <Required <FSSODetSplit.planID> > > > .Select(Base, demand.PlanID); if (fsSODetSplitDetRow != null) { FSSODetSplit fsSODetSplitRow = (FSSODetSplit)fsSODetSplitDetRow; FSSODet fsSODetRow = (FSSODet)fsSODetSplitDetRow; dest.LineType = (fsSODetSplitRow.LineType == SO.SOLineType.Inventory ? POLineType.GoodsForServiceOrder : POLineType.NonStockForServiceOrder); if (fsSODetRow.ManualCost == true) { dest.CuryUnitCost = fsSODetRow.CuryUnitCost; } } } del(dest, demand, OrderType, solinesplit); }
public virtual void CheckQtyFromPO(PXCache sender, APTran tran, Action <PXCache, APTran> baseMethod) { baseMethod(sender, tran); if (tran.TranType == APDocType.Prepayment && !string.IsNullOrEmpty(tran.PONbr) && tran.POLineNbr != null) { POLine poLine = PXSelectReadonly <POLine, Where <POLine.orderType, Equal <Required <POLine.orderType> >, And <POLine.orderNbr, Equal <Required <POLine.orderNbr> >, And <POLine.lineNbr, Equal <Required <POLine.lineNbr> > > > > > .SelectWindowed(Base, 0, 1, tran.POOrderType, tran.PONbr, tran.POLineNbr); if (tran.Qty > poLine.OrderQty) { sender.RaiseExceptionHandling <APTran.qty>(tran, tran.Qty, new PXSetPropertyException(Messages.PrepaidQtyCantExceedPOLine)); } if ((poLine.CuryReqPrepaidAmt > poLine.CuryBilledAmt ? poLine.CuryReqPrepaidAmt : poLine.CuryBilledAmt) + tran.CuryTranAmt + tran.CuryRetainageAmt > poLine.CuryExtCost + poLine.CuryRetainageAmt) { sender.RaiseExceptionHandling <APTran.curyTranAmt>(tran, tran.CuryTranAmt, new PXSetPropertyException(Messages.PrepaidAmtCantExceedPOLine)); } else if (poLine.CuryReqPrepaidAmt + poLine.CuryBilledAmt + tran.CuryTranAmt + tran.CuryRetainageAmt > poLine.CuryExtCost + poLine.CuryRetainageAmt) { sender.RaiseExceptionHandling <APTran.curyTranAmt>(tran, tran.CuryTranAmt, new PXSetPropertyException(Messages.PrepaidAmtMayExceedPOLine, PXErrorLevel.Warning, poLine.OrderNbr)); } } }
public void CopyPOLineFields(POFixedDemand demand, POLine line) { PXResult <FSSODetSplit, FSSODet> fsSODetSplitDetRow = (PXResult <FSSODetSplit, FSSODet>) PXSelectJoin <FSSODetSplit, InnerJoin <FSSODet, On <FSSODet.lineNbr, Equal <FSSODetSplit.lineNbr>, And <FSSODet.srvOrdType, Equal <FSSODetSplit.srvOrdType>, And <FSSODet.refNbr, Equal <FSSODetSplit.refNbr> > > > >, Where <FSSODetSplit.planID, Equal <Required <FSSODetSplit.planID> > > > .Select(Base, demand.PlanID); if (fsSODetSplitDetRow != null) { FSSODet fsSODetRow = (FSSODet)fsSODetSplitDetRow; if (POSetupRecord.Current != null) { if (POSetupRecord.Current.CopyLineNotesFromServiceOrder == true || POSetupRecord.Current.CopyLineAttachmentsFromServiceOrder == true) { var fsSODetCache = new PXCache <FSSODet>(Base); fsSODetCache.Update(fsSODetRow); PXNoteAttribute.CopyNoteAndFiles(fsSODetCache, fsSODetRow, Base.Transactions.Cache, line, POSetupRecord.Current.CopyLineNotesFromServiceOrder == true, POSetupRecord.Current.CopyLineAttachmentsFromServiceOrder == true); } } line.TranDesc = fsSODetRow.TranDesc; } }
protected override void DeductAllocated(SiteStatus allocated, IMatrixItemLine line) { POLine poLine = (POLine)line; decimal lineQtyAvail = 0m; decimal lineQtyHardAvail = 0m; decimal signQtyAvail; decimal signQtyHardAvail; INItemPlanIDAttribute.GetInclQtyAvail <SiteStatus>(Base.Transactions.Cache, poLine, out signQtyAvail, out signQtyHardAvail); if (signQtyAvail != 0m) { lineQtyAvail -= signQtyAvail * (poLine.BaseOrderQty ?? 0m); } if (signQtyHardAvail != 0m) { lineQtyHardAvail -= signQtyHardAvail * (poLine.BaseOrderQty ?? 0m); } allocated.QtyAvail += lineQtyAvail; allocated.QtyHardAvail += lineQtyHardAvail; }
protected void rptPL_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView drv = e.Item.DataItem as DataRowView; if (drv == null) { return; } POLineStatus status = Cast.Enum <POLineStatus>(drv["LineStatus"]); Label lblStatus = e.Item.FindControl("lblLineStatus") as Label; lblStatus.Text = POLine.POLineStatusText(status); HtmlInputCheckBox chk; switch (status) { case POLineStatus.Open: lblStatus.ForeColor = System.Drawing.Color.Blue; break; case POLineStatus.Close: lblStatus.ForeColor = System.Drawing.Color.Black; chk = e.Item.FindControl("checkbox") as HtmlInputCheckBox; chk.Visible = false; break; case POLineStatus.Cancel: lblStatus.ForeColor = System.Drawing.Color.Gray; break; } }
private async Task <List <POAmendmentCSVRecord> > ProcessPOAmendment(PO porec, ApexDataDataContext apexData) { ProgressInfo.Add($"Filing P/O amendment {porec.Po1.Trim()}"); ApexSystem apexSystem = apexData.ApexSystems.FirstOrDefault(); List <POAmendmentCSVRecord> csvList = new List <POAmendmentCSVRecord>(); if (porec.Job != null && porec.Job != "") //Job based P/O { POAmendmentCSVRecord pocsvrec = BuildJobBasedAmendmentHeader(porec, apexSystem); for (int i = 0; i < porec.POLines.Count; i++) { POLine polinerec = porec.POLines[i]; string jobphase = String.IsNullOrEmpty(porec.JobPhase) ? "00" : porec.JobPhase; string wbs; COINSESB_WB wbsRec = apexData.COINSESB_WBs.Where(s => s.Job == porec.Job).FirstOrDefault(); if (wbsRec == null || !(wbsRec.UsesActivity ?? false)) { wbs = jobphase + "-"; } else { wbs = jobphase + "-00-"; } pocsvrec = BuildJobBasedAmendmentLine(polinerec, wbs, pocsvrec); csvList.Add(pocsvrec); pocsvrec = CreateNotNewCSVRec(); //Clear the header portion for subsequent line items } } else //Work Order based P/O { POAmendmentCSVRecord pocsvrec = BuildWOBasedAmendmentHeader(porec, apexSystem); for (int i = 0; i < porec.POLines.Count; i++) { POLine polinerec = porec.POLines[i]; pocsvrec = BuildWOBasedAmemdmentPOLine(porec, polinerec, pocsvrec); csvList.Add(pocsvrec); pocsvrec = CreateNotNewCSVRec(); //Clear the header portion for subsequent line items } } _StatusLines.Add(new StatusLine { PO = porec.Po1?.Trim(), Job = porec.Job?.Trim(), WorkOrd = porec.WorkOrd?.Trim(), Vendor = porec.Vendor?.Trim(), Message = "Amendment written to file" }); return(csvList); }
private void ValidatePoLine(POLine poLine) { var projectHasExpiredCompliance = service.ValidateRelatedProjectField <POLine, POLine.projectID>(poLine, poLine.ProjectID); var taskHasExpiredCompliance = service.ValidateRelatedField <POLine, ComplianceDocument.costTaskID, POLine.taskID>(poLine, poLine.TaskID); service.ValidateRelatedRow <POLine, PoLineExt.hasExpiredComplianceDocuments>(poLine, projectHasExpiredCompliance || taskHasExpiredCompliance); }
public virtual void CheckPartiallyReceiptedPOServices(PXCache sender, PXFieldUpdatedEventArgs e, string poOrderType) { POSetup row = (POSetup)e.Row; if (row != null) { PXResultset <POLine> partiallyReceiptedPOServices = PXSelectReadonly2 <POLine, InnerJoin <IN.InventoryItem, On <POLine.FK.InventoryItem> >, Where <POLine.orderType, Equal <Required <POLine.orderType> >, And <POLine.lineType, Equal <POLineType.service>, And <POLine.completed, NotEqual <True>, And <POLine.receivedQty, NotEqual <decimal0> > > > > > .SelectWindowed(this, 0, 1000, poOrderType); if (partiallyReceiptedPOServices.Count > 0) { if (poOrderType == POOrderType.RegularOrder) { if (row.AddServicesFromNormalPOtoPR == true) { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromNormalPOtoPR>(sender, row, Messages.PossibleOverbillingAPNormalPO); } else { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromNormalPOtoPR>(sender, row, Messages.PossibleOverbillingPRNormalPO); } } else { if (row.AddServicesFromDSPOtoPR == true) { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromDSPOtoPR>(sender, row, Messages.PossibleOverbillingAPDSPO); } else { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromDSPOtoPR>(sender, row, Messages.PossibleOverbillingPRDSPO); } } string overbillingMessage = Messages.PossibleOverbillingTraceList + " \n"; int i = 0; foreach (PXResult <POLine, IN.InventoryItem> line in partiallyReceiptedPOServices) { POLine poline = (POLine)line; IN.InventoryItem item = (IN.InventoryItem)line; overbillingMessage += string.Format(Messages.PossibleOverbillingTraceMessage, (poOrderType == POOrderType.RegularOrder ? Messages.RegularOrder : Messages.DropShip), poline.OrderNbr, poline.LineNbr, item.InventoryCD) + "\n"; i++; if (i >= 1000) { break; } } PXTrace.WriteWarning(overbillingMessage); } } }
protected override bool EraseCommitment(PXCache sender, object row) { POLine poline = (POLine)row; POOrder order = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder)); if (order.OrderType == POOrderType.Blanket || order.OrderType == POOrderType.StandardBlanket || order.Hold == true || order.Approved != true || ((order.Cancelled == true || poline.Cancelled == true) && poline.ReceivedQty == 0) || poline.TaskID == null) { return(true); } else { return(GetAccountGroup(sender, row) == null); } }
private decimal?GetCurrencyUnitCost(POOrder subcontract, POLine subcontractLine, PXCache cache) { if (subcontractLine.ManualPrice == true || subcontractLine.UOM == null || subcontractLine.InventoryID == null || subcontract?.VendorID == null) { return(subcontractLine.CuryUnitCost.GetValueOrDefault()); } var currencyInfo = currencyinfo.Search <CurrencyInfo.curyInfoID>(subcontract.CuryInfoID); return(APVendorPriceMaint.CalculateUnitCost( cache, subcontractLine.VendorID, subcontract.VendorLocationID, subcontractLine.InventoryID, subcontractLine.SiteID, currencyInfo, subcontractLine.UOM, subcontractLine.OrderQty, subcontract.OrderDate.GetValueOrDefault(), subcontractLine.CuryUnitCost)); }
private bool IsCommitmentSyncRequired(POLine row, POLine oldRow) { return(row.OrderQty != oldRow.OrderQty || row.ExtCost != oldRow.ExtCost || row.OpenQty != oldRow.OpenQty || row.OpenAmt != oldRow.OpenAmt || row.RequestedDate != oldRow.RequestedDate || row.ProjectID != oldRow.ProjectID || row.TaskID != oldRow.TaskID || row.ExpenseAcctID != oldRow.ExpenseAcctID || row.InventoryID != oldRow.InventoryID || row.CostCodeID != oldRow.CostCodeID || row.UOM != oldRow.UOM); }
private void ValidateInventoryItem(POLine subcontractLine, PXErrorLevel errorLevel) { if (!IsInventoryItemValid(subcontractLine)) { var inventoryItem = GetInventoryItem(subcontractLine.InventoryID); Transactions.Cache.RaiseException <POLine.inventoryID>(subcontractLine, ScMessages.ItemIsNotPresentedInTheProjectBudget, inventoryItem.InventoryCD, errorLevel); } else { Transactions.Cache.ClearFieldErrors <POLine.inventoryID>(subcontractLine); } }
private POAmendmentCSVRecord BuildWOBasedAmemdmentPOLine(PO porec, POLine polinerec, POAmendmentCSVRecord pocsvrec) { pocsvrec.OrderLineType = "m"; pocsvrec.Code = "CM-MA"; pocsvrec.ClauseCode = String.Empty; pocsvrec.OrderLineDescription = String.IsNullOrEmpty(polinerec.MfgDesc) ? "***Unknown***" : polinerec.MfgDesc; pocsvrec.WBSCode = porec.WorkOrd.Trim(); pocsvrec.CostCode = "NAB"; pocsvrec.CostCategory = "MA"; pocsvrec.Quantity = ((decimal)(polinerec.QtyOrd ?? 0) - (decimal)(polinerec.QtyIvc ?? 0)).ToString(); pocsvrec.Unit = "E"; pocsvrec.Price = (polinerec.Price ?? 0).ToString(); pocsvrec.Per = polinerec.UM; return(pocsvrec); }
private POAmendmentCSVRecord BuildJobBasedAmendmentLine(POLine polinerec, string wbs, POAmendmentCSVRecord pocsvrec) { pocsvrec.OrderLineType = "m"; //Changed from "C", which worked in testing but not production pocsvrec.Code = "CM-MA"; pocsvrec.ClauseCode = String.Empty; pocsvrec.OrderLineDescription = String.IsNullOrEmpty(polinerec.MfgDesc) ? "***Unknown***" : polinerec.MfgDesc; pocsvrec.WBSCode = wbs; pocsvrec.CostCode = polinerec.CostCode?.Trim(); pocsvrec.CostCategory = "MA"; pocsvrec.Quantity = ((decimal)(polinerec.QtyOrd ?? 0) - (decimal)(polinerec.QtyIvc ?? 0)).ToString(); pocsvrec.Unit = "E"; pocsvrec.Price = (polinerec.Price ?? 0).ToString(); pocsvrec.Per = polinerec.UM; return(pocsvrec); }
private void CopyNotesAndAttachments(PXCache cache, POLine poLineRow, POEnabledFSSODet poEnabledFSSODetRow) { if (poSetup.Current != null && (poSetup.Current.CopyLineNotesFromServiceOrder == true || poSetup.Current.CopyLineAttachmentsFromServiceOrder == true)) { SharedFunctions.CopyNotesAndFiles( new PXCache <FSSODet>(cache.Graph), cache, poEnabledFSSODetRow, poLineRow, poSetup.Current.CopyLineNotesFromServiceOrder, poSetup.Current.CopyLineAttachmentsFromServiceOrder); } }
protected virtual IAddressBase GetToAddress(POOrder order, POLine line) { if (order.OrderType.IsIn(POOrderType.RegularOrder, POOrderType.Blanket, POOrderType.StandardBlanket)) { return (PXSelectJoin <Address, InnerJoin <INSite, On <INSite.FK.Address> >, Where <INSite.siteID, Equal <Current <POLine.siteID> > > > .SelectSingleBound(Base, new[] { line }) .RowCast <Address>() .FirstOrDefault() ?? GetToAddress(order)); } return(GetToAddress(order)); }
private void ValidateNonStockInventoryItem(POLine subcontractLine) { var cache = Caches[typeof(POLine)]; if (subcontractLine.InventoryID != null) { var inventoryItem = GetInventoryItem(subcontractLine.InventoryID); if (inventoryItem.NonStockReceipt.GetValueOrDefault() && inventoryItem.StkItem.GetValueOrDefault()) { var exceptionMessage = new PXSetPropertyException <POLine.inventoryID>( ScMessages.InvalidInventoryItemMessage, PXErrorLevel.Error); cache.RaiseExceptionHandling <POLine.inventoryID>(subcontractLine, inventoryItem.InventoryCD, exceptionMessage); } } }
public virtual void Copy(POReceiptLine aDest, POLine aSrc, decimal aQtyAdj, decimal aBaseQtyAdj, CopyOrig del) { if (del != null) { del(aDest, aSrc, aQtyAdj, aBaseQtyAdj); } INItemPlan inItemPlanRow = PXSelect <INItemPlan, Where < INItemPlan.supplyPlanID, Equal <Required <INItemPlan.supplyPlanID> >, And <INItemPlan.planType, Equal <Required <INItemPlan.planType> > > > > .Select(Base, aSrc.PlanID, INPlanConstants.PlanF6); if (inItemPlanRow != null && inItemPlanRow.LocationID != null) { aDest.LocationID = inItemPlanRow.LocationID; } }
private void CreatePOOrderDocument( POOrderEntry graphPOOrderEntry, List <POEnabledFSSODet> itemGroup, POOrder poOrderRow, POLine poLineRow, POEnabledFSSODet firstPOEnabledFSSODetRow) { firstPOEnabledFSSODetRow = itemGroup[0]; this.InitializePOOrderDocument(graphPOOrderEntry, poOrderRow, firstPOEnabledFSSODetRow); foreach (POEnabledFSSODet poEnabledFSSODetRow in itemGroup) { this.InsertPOLine(graphPOOrderEntry, poLineRow, poEnabledFSSODetRow); } graphPOOrderEntry.Save.Press(); }
private bool IsInventoryItemValid(POLine subcontractLine) { if (subcontractLine.InventoryID == null || !ShouldValidateInventoryItem() || subcontractLine.ProjectID == null || ProjectDefaultAttribute.IsNonProject(subcontractLine.ProjectID)) { return(true); } var project = GetProject(subcontractLine.ProjectID); if (IsNonProjectAccountGroupsAllowed(project) || !IsItemLevel(project)) { return(true); } var result = IsInventoryItemUsedInProject(subcontractLine, subcontractLine.InventoryID); return(result); }
private bool IsInventoryItemUsedInProject(POLine subcontractLine, int?inventoryID) { if (subcontractLine.ProjectID == null || ProjectDefaultAttribute.IsNonProject(subcontractLine.ProjectID)) { return(false); } var project = GetProject(subcontractLine.ProjectID); if (!IsItemLevel(project)) { return(false); } var query = new PXSelect <PMCostBudget, Where <PMCostBudget.projectID, Equal <Required <PMCostBudget.projectID> > > >(this); var parameters = new List <object>(); parameters.Add(subcontractLine.ProjectID); if (subcontractLine.TaskID.HasValue) { query.WhereAnd <Where <PMCostBudget.projectTaskID, Equal <Required <PMCostBudget.projectTaskID> > > >(); parameters.Add(subcontractLine.TaskID); } var accountGroupID = GetAccountGroup(subcontractLine, inventoryID); if (accountGroupID.HasValue) { query.WhereAnd <Where <PMCostBudget.accountGroupID, Equal <Required <PMCostBudget.accountGroupID> > > >(); parameters.Add(accountGroupID); } if (subcontractLine.CostCodeID.HasValue) { query.WhereAnd <Where <PMCostBudget.costCodeID, Equal <Required <PMCostBudget.costCodeID> > > >(); parameters.Add(subcontractLine.CostCodeID); } var result = query.Select(parameters.ToArray()).AsEnumerable() .Any(b => ((PMCostBudget)b).InventoryID == inventoryID); return(result); }
private int?GetAccountGroup(POLine subcontractLine, int?inventoryID) { InventoryItem item = GetInventoryItem(inventoryID); if (item.StkItem == true && item.COGSAcctID != null) { Account account = (Account)PXSelectorAttribute.Select <InventoryItem.cOGSAcctID>(Caches[typeof(InventoryItem)], item); if (account != null && account.AccountGroupID != null) { return(account.AccountGroupID); } } else { Account account = (Account)PXSelectorAttribute.Select <POLine.expenseAcctID>(Transactions.Cache, subcontractLine); if (account != null && account.AccountGroupID != null) { return(account.AccountGroupID); } } return(null); }
protected override void CreateNewLine(int?siteID, int?inventoryID, string taxCategoryID, decimal qty) { POLine newline = PXCache <POLine> .CreateCopy(Base.Transactions.Insert(new POLine())); Base.Transactions.Cache.SetValueExt <POLine.inventoryID>(newline, inventoryID); newline = PXCache <POLine> .CreateCopy(Base.Transactions.Update(newline)); if (siteID != null) { newline.SiteID = siteID; newline = PXCache <POLine> .CreateCopy(Base.Transactions.Update(newline)); } newline.OrderQty = qty; newline = Base.Transactions.Update(newline); if (!string.IsNullOrEmpty(taxCategoryID)) { Base.Transactions.Cache.SetValueExt <POLine.taxCategoryID>(newline, taxCategoryID); newline = Base.Transactions.Update(newline); } }
private void InsertPOLine(POOrderEntry graphPOOrderEntry, POLine poLineRow, POEnabledFSSODet poEnabledFSSODetRow) { poLineRow = new POLine() { BranchID = poEnabledFSSODetRow.BranchID }; poLineRow = graphPOOrderEntry.Transactions.Current = graphPOOrderEntry.Transactions.Insert(poLineRow); poLineRow.InventoryID = poEnabledFSSODetRow.InventoryID; poLineRow.SiteID = poEnabledFSSODetRow.SiteID; poLineRow.OrderQty = poEnabledFSSODetRow.EstimatedQty; poLineRow.ProjectID = poEnabledFSSODetRow.ProjectID; poLineRow.TaskID = poEnabledFSSODetRow.ProjectTaskID; poLineRow.CuryUnitCost = poEnabledFSSODetRow.UnitCost; poLineRow = graphPOOrderEntry.Transactions.Update(poLineRow); poEnabledFSSODetRow.POType = poLineRow.OrderType; poEnabledFSSODetRow.POLineNbr = poLineRow.LineNbr; poEnabledFSSODetRow.POCompleted = poLineRow.Completed; this.CopyNotesAndAttachments(graphPOOrderEntry.Transactions.Cache, poLineRow, poEnabledFSSODetRow); }
BuildWOBasedPOLine(PO porec, POLine polinerec, int?pol_seq, string cat, bool pricechange, DateTime duedate) => new COINSESBService.COINSInterfacePo_hdrRowPo_lineRow { pol_type = "C", pol_code = "CM-MA", pol_seq = pol_seq ?? 0, pol_seqSpecified = pol_seq != null, rsp_action = pol_seq != null ? "U" : "I", pol_desc = String.IsNullOrEmpty(polinerec.MfgDesc) ? "***Unknown***" : polinerec.MfgDesc, jwb_code = porec.WorkOrd.Trim(), pol_qty = ((decimal)(polinerec.QtyOrd ?? 0) - (decimal)(polinerec.QtyIvc ?? 0)), pol_qtySpecified = true, pol_uoq = "E", pol_price = polinerec.Price ?? 0, pol_priceSpecified = true, pol_effdate = duedate, pol_effdateSpecified = pricechange, pol_per = polinerec.UM, pol_ddate = duedate, pol_ddateSpecified = true, pol_CostHead = "NAB", pol_cat = "MA" //cat later, but amendments won't work };
protected override PMCommitment FromRecord(PXCache sender, object row) { POLine poline = (POLine)row; POOrder order = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder)); PMCommitment commitment = new PMCommitment(); commitment.Type = PMCommitmentType.Internal; commitment.CommitmentID = poline.CommitmentID ?? Guid.NewGuid(); commitment.AccountGroupID = GetAccountGroup(sender, row); commitment.ProjectID = poline.ProjectID; commitment.ProjectTaskID = poline.TaskID; commitment.UOM = poline.UOM; if (poline.OrigExtCost == null) { commitment.OrigQty = poline.OrderQty; commitment.OrigAmount = poline.ExtCost + poline.RetainageAmt.GetValueOrDefault(); } else { commitment.OrigQty = poline.OrigOrderQty; commitment.OrigAmount = poline.OrigExtCost; } commitment.Qty = poline.OrderQty; commitment.Amount = poline.ExtCost + poline.RetainageAmt.GetValueOrDefault(); commitment.OpenQty = CalculateOpenQty(poline.OpenQty, poline.UnbilledQty); commitment.OpenAmount = CalculateOpenAmount(commitment.OpenQty, poline.OrderQty, poline.ExtCost, poline.UnbilledAmt); commitment.ReceivedQty = CalculateReceivedQty(poline.CompletedQty, poline.BilledQty); commitment.InvoicedQty = 0; commitment.InvoicedAmount = 0; commitment.InvoicedIsReadonly = true; commitment.RefNoteID = order.NoteID; commitment.InventoryID = poline.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID; commitment.CostCodeID = poline.CostCodeID ?? CostCodeAttribute.GetDefaultCostCode(); return(commitment); }
//弹出选择框,手工选择采购订单明细进行收货的方式 //这种方式暂时废弃不用 protected void cmdAddLines_Click(object sender, EventArgs e) { string[] linesArray = this.txtPOLines.Value.Trim().Trim(';').Split(';'); if (linesArray == null || linesArray.Length <= 0) { return; } using (ISession session = new Session()) { RCVHead head = RCVHead.Retrieve(session, this.OrderNumber); try { session.BeginTransaction(); foreach (string s in linesArray) { POLine poLine = null; if (!string.IsNullOrEmpty(s) && s.Trim().Length > 0) { poLine = POLine.Retrieve(session, head.RefOrderNumber, s); } if (poLine != null) { head.AddLine(session, poLine); } } head.Update(session, "CurrentLineNumber"); session.Commit(); } catch (Exception er) { session.Rollback(); WebUtil.ShowError(this, er); } this.QueryAndBindData(session, head); } }
public virtual void ProcessPOCommitments(PMProject project) { foreach (PXResult <POLine, POOrder> res in polines.Select(project.ContractID)) { POLine poline = (POLine)res; POOrder order = (POOrder)res; PXParentAttribute.SetParent(polines.Cache, poline, typeof(POOrder), order); PMCommitmentAttribute.Sync(polines.Cache, poline); } foreach (APTran tran in aptran.Select(project.ContractID)) { POLine poline = new POLine(); poline.OrderType = tran.POOrderType; poline.OrderNbr = tran.PONbr; poline.LineNbr = tran.POLineNbr; poline = polines.Locate(poline); if (poline != null && poline.CommitmentID != null) { decimal sign = (tran.DrCr == DrCr.Debit) ? Decimal.One : Decimal.MinusOne; PMCommitment container = new PMCommitment(); container.CommitmentID = poline.CommitmentID; container.UOM = tran.UOM; container.InventoryID = tran.InventoryID; container.CostCodeID = tran.CostCodeID.GetValueOrDefault(CostCodeAttribute.GetDefaultCostCode()); container.InvoicedAmount = sign * tran.LineAmt.GetValueOrDefault(); container.InvoicedQty = sign * tran.Qty.GetValueOrDefault(); PMCommitmentAttribute.AddToInvoiced(polines.Cache, container); } } }