Below code can be used to apply exchange rate for the amount. From currency and To currency must be mentioned along the amount to be converted.
AmountCur amountValue = 100;
AmountMst amountMST;
CurrencyCode fromCurrency = 'SAR', toCurrency = 'USD';
currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet());
amountMST = currencyExchangeHelper.calculateCurrencyToCurrency(fromCurrency, toCurrency, amountValue, false);
info(strfmt("%1", amountMST));
No comments:
Post a Comment