Purpose:
Demonstrate how to get purchase order total amount in X++
Application:
Dynamics 365 for Finance and Operations
Business requirement:
Business requirement is to get purchase order total amount and display this to the user.
Solution:
We can use the code below to get the total dollar amount of a given purchase order.
Code
[ExtensionOf(tableStr(PurchTable))]
internal final class ATLAS_PurchTable_Extension
{
/// <summary>
/// Gets PO total amount.
/// </summary>
/// <remarks>
/// Atlas Dynamics Pty Ltd.
/// </remarks>
public DiscAmount getPurchTotalAmount()
{
PurchTotals purchTotals;
DiscAmount purchTotalAmount;
// Get purchase order total amount
purchTotals = PurchTotals::newPurchTable(this);
purchTotals.calc();
purchTotalAmount = purchTotals.purchTotalAmount();
return purchTotalAmount;
}
}
Leave a comment