Показать сообщение отдельно
Старый 19.10.2013, 17:24   #29  
MikeR is offline
MikeR
MCT
Аватар для MikeR
MCBMSS
Лучший по профессии 2015
Лучший по профессии 2014
 
1,628 / 627 (24) +++++++
Регистрация: 28.11.2005
Адрес: просто землянин
Подумал, что логично будет в этот раскрученный топик закинуть инфу по расчету курса

X++:
static void ExchangeRate(Args _args)
{
    // from CurrencyExchangeHelper class
    CurrencyExchangeHelper  currencyExchangeHelper;
    TransDate               transactionDate = today();
    CurrencyCode            transactionCurrency = 'USD';
    AmountCur               amountToConvert = 100.50;
    boolean                 shouldRoundResult = true;
    AmountMst               result;


    currencyExchangeHelper =
    CurrencyExchangeHelper::newExchangeDate(
         Ledger::current(),
         transactionDate);
    result =
    currencyExchangeHelper.calculateTransactionToAccounting( transactionCurrency, amountToConvert, shouldRoundResult);
    info(strfmt("%1",result));     
}

X++:
static void ExchangeRate2(Args _args)
{
    ExchangeRateHelper exchangeRateHelper;
    TransDate transactionDate = today();
    CurrencyCode transactionCurrency = 'USD';
    CurrencyExchangeRate exchangeRate1;
    CurrencyExchangeRate exchangeRate2;
    exchangeRateHelper = ExchangeRateHelper::newExchangeDate(
         Ledger::current(),
         transactionCurrency,
         transactionDate);
        exchangeRate1 = exchangeRateHelper.getExchangeRate1();
        exchangeRate2 = exchangeRateHelper.getExchangeRate2();
        info (strfmt("ExchRate1= %1; ExchRate2= %2",  exchangeRate1, exchangeRate2)); 
}
__________________
Axapta book for developer