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 :

How to get Exchange rate in D365 F&O x++ ?

Rahul Kiran Profile Picture Rahul Kiran 481


public display Amount TIDF_ExchangeRate()
{
    ExchangeRate     exchangeRate;
    ExchangeRateType ExchangeRateType;
    ExchangeRateCurrencyPair exchangeRateCurrencyPair;
    real             exchRate;

    CurrencyCode fromCurrency  = this.CurrencyCode;
    CurrencyCode toCurrency    = Ledger::find(Ledger::current()).AccountingCurrency ; //"AED";
    TransDate    transDate     = this.TransDate;


    select firstonly exchangeRateCurrencyPair
    where
        exchangeRateCurrencyPair.ExchangeRateType == Ledger::find(Ledger::current()).DefaultExchangeRateType
    &&  exchangeRateCurrencyPair.FromCurrencyCode == fromCurrency
    &&  exchangeRateCurrencyPair.ToCurrencyCode   == toCurrency;

   // if ( date2str(this.TransDate ,1,1,1) == 5/9/2018);
    exchRate = exchangeRate::findByDate(exchangeRateCurrencyPair.RecId,transDate).ExchangeRate;
    //info(strFmt("%1",exchRate/100));

    return exchRate/100;

}









This was originally posted here.

Comments

*This post is locked for comments