How to: Calculate purchase order total value
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:
May 6, 2014 at 7:22 am
how to get PO sub total value, can you tell me…
May 6, 2014 at 10:26 am
Good day Celeb,
Use “purchTotals.purchBalance()” instead of “purchTotals.purchTotalAmount()”.
Regards,
Christian Silva
May 6, 2014 at 12:46 pm
[…] Celeb Kiran has asked me on my post How to: Calculate purchase order total value how get the Subtotal Amount instead of Total Amount. Since one man’s doubt is another […]
August 11, 2015 at 1:35 am
I would like the Net Total and the Total Amount to be included in the “Export to Microsoft Excel” add-in under Procurement and Sourcing/Common/Purchase orders/All purchase orders or have it under Menu Items by creating SSRS report. I am stuck with trying to create SSRS report for this.
August 13, 2015 at 6:13 am
Good day Felina,
It might be necessary to create a Display method for that. Hope this link gives you an idea.
http://stoneridgesoftware.com/using-display-methods-in-ax-2012-srs-reports/
Regards,
Christian Silva
August 17, 2015 at 10:02 pm
Hey Christian,
Thanks for this. I am currently looking into this and it pretty much seems to be what I am looking for.
April 27, 2017 at 1:11 am
Hello Christian,
Thank you, it’s very usefull for me…
Best Regards,
Saiful Akrom
July 19, 2017 at 4:22 pm
This is almost what I was looking for…. Do you know how I can calculate the purchase order total value by using SQL?
July 19, 2017 at 5:29 pm
Sorry, but I dont know, if possible avoid creating scripts on SQL.
January 22, 2019 at 5:25 am
Sir, how to get Sales Tax value, can you tell me…
September 5, 2019 at 11:53 am
See link below:
https://dhruvrthakar.wordpress.com/2017/07/18/get-calculated-sales-tax-values-for-sales-order-in-dynamics-ax-2012-using-x/