protected override PMCommitment FromRecord(PXCache sender, object row) { SOMiscLine2 line = (SOMiscLine2)row; SOOrder order = (SOOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(SOOrder)); int sign = line.Operation == SOOperation.Issue ? 1 : -1; PMCommitment commitment = new PMCommitment(); commitment.Type = PMCommitmentType.Internal; commitment.CommitmentID = line.CommitmentID ?? Guid.NewGuid(); commitment.AccountGroupID = GetAccountGroup(sender, row); commitment.ProjectID = line.ProjectID; commitment.ProjectTaskID = line.TaskID; commitment.UOM = line.UOM; commitment.Qty = sign * line.OrderQty; commitment.Amount = sign * line.LineAmt; commitment.OpenQty = sign * line.UnbilledQty; commitment.OpenAmount = sign * line.UnbilledAmt; commitment.ReceivedQty = 0; commitment.InvoicedQty = 0; commitment.InvoicedAmount = 0; commitment.InvoicedIsReadonly = true; commitment.RefNoteID = order.NoteID; commitment.InventoryID = line.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID; commitment.CostCodeID = line.CostCodeID ?? CostCodeAttribute.GetDefaultCostCode(); return(commitment); }
private bool IsCommitmentSyncRequired(SOMiscLine2 row, SOMiscLine2 oldRow) { return(row.LineAmt != oldRow.LineAmt || row.UnbilledQty != oldRow.UnbilledQty || row.UnbilledAmt != oldRow.UnbilledAmt || row.ProjectID != oldRow.ProjectID || row.TaskID != oldRow.TaskID || row.SalesAcctID != oldRow.SalesAcctID || row.InventoryID != oldRow.InventoryID || row.CostCodeID != oldRow.CostCodeID || row.UOM != oldRow.UOM); }
protected override bool EraseCommitment(PXCache sender, object row) { SOMiscLine2 line = (SOMiscLine2)row; SOOrder order = (SOOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(SOOrder)); SOOrderType orderType = (SOOrderType)PXSelectorAttribute.Select <SOOrder.orderType>(sender.Graph.Caches[typeof(SOOrder)], order); if (order.Hold == true || order.Cancelled == true || orderType.CommitmentTracking != true || line.TaskID == null) { return(true); } else { return(GetAccountGroup(sender, row) == null); } }
public virtual ARTran CreateTranFromMiscLine(SOOrderShipment orderShipment, SOMiscLine2 orderline, CreateTranFromMiscLineDelegate baseMethod) { ARTran tran = baseMethod(orderShipment, orderline); SOLine line = PXSelect <SOLine, Where <SOLine.orderType, Equal <Required <SOLine.orderType> >, And <SOLine.orderNbr, Equal <Required <SOLine.orderNbr> >, And <SOLine.lineNbr, Equal <Required <SOLine.lineNbr> > > > > > .Select(Base, orderline.OrderType, orderline.OrderNbr, orderline.LineNbr); SOLineRUTROT lineRR = PXCache <SOLine> .GetExtension <SOLineRUTROT>(line); ARTranRUTROT tranRR = PXCache <ARTran> .GetExtension <ARTranRUTROT>(tran); tranRR.IsRUTROTDeductible = lineRR.IsRUTROTDeductible; tranRR.RUTROTItemType = lineRR.RUTROTItemType; tranRR.RUTROTWorkTypeID = lineRR.RUTROTWorkTypeID; return(tran); }