web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / DAX Beginners / How to: Calculate purchase ...

How to: Calculate purchase order total value

Christian Silva Profile Picture Christian Silva 707

Today I will post a piece of code used to get the purchase order total value.
This value can also be found on Totals form, which can be accessed through:
Accounts payable/Common/Purchase orders/All purchase orders/Tab – Purchase Order/Group – View/Totals

How to get it through X++, in this example I have created a new Job.

static void _GetPurchTotalAmount(Args _args)
{
    PurchTotals purchTotals;
    PurchTable  purchTable  = PurchTable::find('000023');
    DiscAmount  discAmount;
    ;

    purchTotals = PurchTotals::newPurchTable(purchTable);
    purchTotals.calc();
    discAmount = purchTotals.purchTotalAmount();

    setPrefix('Purchase Order');
    info(strFmt('%1 - Total Value: %2', purchTable.PurchId, discAmount));
}

Result:



This was originally posted here.

Comments

*This post is locked for comments