private bool IsCommitmentSyncRequired(SOLine4 row, SOLine4 oldRow)
 {
     return(row.UnbilledQty != oldRow.UnbilledQty ||
            row.UnbilledAmt != oldRow.UnbilledAmt ||
            row.OpenQty != oldRow.OpenQty ||
            row.OpenAmt != oldRow.OpenAmt);
 }
Пример #2
0
        protected override PMCommitment FromRecord(PXCache sender, object row)
        {
            SOLine4 line  = (SOLine4)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   = (Guid?)sender.GetValue(row, "CommitmentID") ?? Guid.NewGuid();
            commitment.AccountGroupID = GetAccountGroup(sender, row);
            commitment.ProjectID      = (int?)sender.GetValue(row, "ProjectID");
            commitment.ProjectTaskID  = (int?)sender.GetValue(row, "TaskID");
            commitment.UOM            = line.UOM;
            commitment.OrigQty        = sign * line.OrderQty;
            commitment.OrigAmount     = sign * (decimal?)sender.GetValue(row, "LineAmt");
            commitment.Qty            = sign * line.OrderQty;
            commitment.Amount         = sign * (decimal?)sender.GetValue(row, "LineAmt");
            if (order.Hold == true || order.Cancelled == true)
            {
                //Back Order put on Hold.
                commitment.OpenQty    = 0;
                commitment.OpenAmount = 0;
            }
            else
            {
                commitment.OpenQty    = sign * line.OpenQty;
                commitment.OpenAmount = sign * line.OpenAmt;
            }
            commitment.ReceivedQty        = sign * line.ShippedQty;
            commitment.InvoicedQty        = 0;
            commitment.InvoicedAmount     = 0;
            commitment.InvoicedIsReadonly = true;
            commitment.RefNoteID          = order.NoteID;
            commitment.InventoryID        = line.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID;

            return(commitment);
        }