...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_accounting_helper.php
- Класс: \CCrmAccountingHelper
- Вызов: CCrmAccountingHelper::PrepareAccountingData
static function PrepareAccountingData($arFields) { $accountCurrencyID = CCrmCurrency::GetAccountCurrencyID(); if (!isset($accountCurrencyID[0])) { return false; } $currencyID = isset($arFields['CURRENCY_ID']) ? strval($arFields['CURRENCY_ID']) : ''; if (!CCrmCurrency::GetByID($currencyID)) { // Currency is invalid or not assigned return false; } if ($currencyID === $accountCurrencyID) { // Avoid conversion to float since possible data lost return [ 'ACCOUNT_CURRENCY_ID' => $accountCurrencyID, 'ACCOUNT_SUM' => isset($arFields['SUM']) ? $arFields['SUM'] : 0.0, ]; } $account = CCrmCurrency::ConvertMoney( isset($arFields['SUM']) ? doubleval($arFields['SUM']) : 0.0, $currencyID, $accountCurrencyID, isset($arFields['EXCH_RATE']) ? doubleval($arFields['EXCH_RATE']) : -1 ); return [ 'ACCOUNT_CURRENCY_ID' => $accountCurrencyID, 'ACCOUNT_SUM' => $account, ]; }