Wednesday, September 22, 2010

Purchase Order Print "Correct" Quantity

Standard AX functionality when printing an AP Purchase Order is to print the quantity of the Delivery Remainder (PurchLine.RemainPurchPhysical).  The Delivery Remainder is lowered as receipts are posted against the PO, so a PO that is printed after receipts have been posted can look confusing.  The PO will show a lower quantity and a lower dollar amount.

You can add the following code to class/purchFormLetter.createParmLine to show to total quantity of the PO: the delivery remainder plus the qty already received.

...
else
{
    [newPurchParmLine.ReceiveNow,  newPurchParmLine.RemainBefore      , newPurchParmLine.RemainAfter      ] = this.qtyPurch (_purchLine, naReal());
    [newPurchParmLine.InventNow,   newPurchParmLine.RemainBeforeInvent, newPurchParmLine.RemainAfterInvent] = this.qtyInvent(_purchLine, naReal());
}
//existing code above

//New Code: add the qty that was received already to the delivery remainder
if (purchParmUpdate.SpecQty == PurchUpdate::All && purchParmUpdate.DocumentStatus == DocumentStatus::PurchaseOrder)
{
    newPurchParmLine.ReceiveNow = _purchLine.RemainPurchPhysical + _purchLine.receivedInTotal();
}

No comments:

Post a Comment