• Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/Currency/CurrencyFormat.php
  • Класс: BitrixUICurrencyCurrencyFormat
  • Вызов: CurrencyFormat::convertBySettings
static function convertBySettings(float $price, string $currency): string
{
	$formatSetting = [];
	$langSetting = [];
	if (Loader::includeModule('currency') && Loader::includeModule('bitrix24'))
	{
		$currentAreaConfig = CBitrix24::getCurrentAreaConfig();
		$formatSetting = self::getFormatFromApi($currentAreaConfig);
		$langSetting = CCurrencyLang::GetByID($currentAreaConfig['CURRENCY'], $currentAreaConfig["LANGUAGE_ID"]);
	}

	if (
		isset($formatSetting["DECIMALS"])
		&& isset($formatSetting["DECIMAL_SEPARATOR"])
		&& isset($formatSetting["THOUSANDS_SEPARATOR"])
	)
	{
		$formatSetting["THOUSANDS_SEP"] = $formatSetting["THOUSANDS_SEPARATOR"];
		$formatSetting["DEC_POINT"] = $formatSetting["DECIMAL_SEPARATOR"];
		$formatSetting["FORMAT_STRING"] = $langSetting["FORMAT_STRING"];

		return CCurrencyLang::formatValue($price, $formatSetting);
	}
	elseif (
		isset($langSetting["DECIMALS"])
		&& isset($langSetting["DEC_POINT"])
		&& isset($langSetting["THOUSANDS_SEP"])
	)
	{
		return CCurrencyLang::formatValue($price, $langSetting);
	}
	else
	{
		return self::convertByDefault($price, $currency);
	}

}