Created
October 27, 2022 15:20
-
-
Save bayramcetin/8b933f958f750619da1c14665bf4f31f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ETGFindExchRateHelper | |
{ | |
public static ExchRate findExchRate(TransDate _transDate, CurrencyCode _fromCurrency, CurrencyCode _toCurrency = Ledger::find(Ledger::current()).AccountingCurrency) | |
{ | |
ExchangeRateCurrencyPair exchangeRateCurrencyPair; | |
ExchRate exchRate; | |
select firstonly exchangeRateCurrencyPair | |
where exchangeRateCurrencyPair.ExchangeRateType == Ledger::find(Ledger::current()).DefaultExchangeRateType | |
&& exchangeRateCurrencyPair.FromCurrencyCode == _fromCurrency | |
&& exchangeRateCurrencyPair.ToCurrencyCode == _toCurrency; | |
exchRate = ExchangeRate::findByDate(exchangeRateCurrencyPair.RecId, _transDate).ExchangeRate; | |
return exchRate; | |
} | |
public static ExchRate findExchRateByExchangeRateType(ExchangeRateTypeRecId _exchangeRateType, TransDate _transDate, CurrencyCode _fromCurrency, CurrencyCode _toCurrency = Ledger::find(Ledger::current()).AccountingCurrency) | |
{ | |
ExchangeRateCurrencyPair exchangeRateCurrencyPair; | |
ExchRate exchRate; | |
select firstonly exchangeRateCurrencyPair | |
where exchangeRateCurrencyPair.ExchangeRateType == _exchangeRateType | |
&& exchangeRateCurrencyPair.FromCurrencyCode == _fromCurrency | |
&& exchangeRateCurrencyPair.ToCurrencyCode == _toCurrency; | |
exchRate = ExchangeRate::findByDate(exchangeRateCurrencyPair.RecId, _transDate).ExchangeRate; | |
return exchRate; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment