Tuesday, 13 September 2016

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
2014-04-17 11_07_15-‪Totals‬ (‎‪2‬ - ‎‪usmf‬)‎‪ - ‎‪‪‪Purchase order‬_ ‎‪000023‬‬, ‎‪‪Fabrikam Suppl
How to get it through X++, in this example I have created a new Job.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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:


2014-04-17 12_30_50-‪Infolog‬ (‎‪1‬)‎

1 comment:

  1. Interesting stuff guys. Now almost in all the countries of world prefer to buy products online to save time as well as the money. I also prefer digital portals for saving time instead of visiting the market. Selection of objects for comparison. Then you have to choose the subject of the reference comparison. Depending on the goals, you can focus on guts(.)pk/ products, processes, practices. Thanks for it

    ReplyDelete

POSTMAN D365

  Postman is useful to test the behavior of different OData class from/to D365FO. In this post we will see the steps to setup Postman with D...