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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Total PO amount in Accounting and Reporting currency

(2) ShareShare
ReportReport
Posted on by 6

Hello, as per the title, I am adding new fields in the PurchTable Form, one for the total amount of the PO in Accounting currency and one in Reporting currency.

For the Accounting I am using currencyExchangeHelper.calculateTransactionToAccounting and for the Reporting currencyExchangeHelper.calculateCurrencyToCurrency.

I noticed that for TransactionToAccounting we do not need to check if there is an Exchange Rate available, as the system does not allow you to enter a PO line if there is no Exchange Rate available between vendor(PO) currency and Accounting Currency.


Is this the same for ReportingCurrency, or we need to add a "safety net" in our code to check for available exchange rate? If we need to add the safety net, any pointers would be greatly appreciated.

Thanks in advance!

Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    239,650 Most Valuable Professional on at
    Doesn't PurchTotals class already give you the amount in the accounting currency? You shouldn't need to work with currencies of individual PO lines.
  • Antonis M Profile Picture
    6 on at
    @Martin Dráb Thank you for the reply, I am new to this so I might be wrong:
    I am using the purchTotals.calc() to return the total amount of the PO in the suppliers currency. Maybe there is another method I am not aware of.

    But in general my main issue is with the total of the PO in Reporting Currency. And specifically if there is a possible case of no Exchange rate between Supplier and Reporting currency. Below is my code, if there is an easier or more consistent way please let me know. Or also if my understanding is wrong in any of the above
     
        [SysClientCacheDataMethodAttribute(true)]
        public display AmountMst purchaseTotalReportingCurrency()
        {
            CurrencyExchangeHelper currencyExchangeHelper;
            PurchTotals purchTotals = PurchTotals::newPurchTable(this);
            purchTotals.calc(); 
     
            AmountMst convertedAmount = 0;
            TransDate transactionDate = this.AccountingDate;
            currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), transactionDate );
            str reportingCurrency = Ledger::reportingCurrency(CompanyInfo::current());
            str fromCurrency = purchTotals.purchCurrency();

            if (reportingCurrency != fromCurrency)
            {
                convertedAmount = currencyExchangeHelper.calculateCurrencyToCurrency(fromCurrency, reportingCurrency, purchTotals.purchTotalAmount(), true);
            }
            else
            {
                convertedAmount = purchTotals.purchTotalAmount();
            }
            return  convertedAmount;
        }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 587

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 552 Super User 2026 Season 1

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 542 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans