Exemplo n.º 1
0
 // Select report currency
 $siteId = CBaseSaleReportHelper::getDefaultSiteId();
 $siteCurrencyId = '';
 if ($siteId !== null) {
     $arCurr = \CSaleLang::GetByID($siteId);
     if (!empty($arCurr['CURRENCY'])) {
         $siteCurrencyId = $arCurr['CURRENCY'];
     }
 }
 if (empty($siteCurrencyId)) {
     $siteCurrencyId = \COption::GetOptionString('sale', 'default_currency', null, $siteId !== null ? $siteId : false);
 }
 CBaseSaleReportHelper::setSiteCurrencyId($siteCurrencyId);
 $reportCurrencyId = $siteCurrencyId;
 if (isset($_REQUEST['F_SALE_CURRENCY'])) {
     $currenciesIds = array_keys(CBaseSaleReportHelper::getCurrencies());
     if (in_array($_REQUEST['F_SALE_CURRENCY'], $currenciesIds, true)) {
         $reportCurrencyId = $_REQUEST['F_SALE_CURRENCY'];
     }
 }
 CBaseSaleReportHelper::setSelectedCurrency($reportCurrencyId);
 $reportCurrency = CCurrencyLang::GetById($reportCurrencyId, LANGUAGE_ID);
 $reportWeightUnits = CBaseSaleReportHelper::getDefaultSiteWeightUnits();
 $arParams['REPORT_CURRENCY_LABEL_TEXT'] = GetMessage('SALE_REPORT_VIEW_CURRENCY_LABEL_TITLE') . ': ' . $reportCurrency['FULL_NAME'];
 $arParams['REPORT_WEIGHT_UNITS_LABEL_TEXT'] = GetMessage('SALE_REPORT_VIEW_WEIGHT_UNITS_LABEL_TITLE') . ': ' . $reportWeightUnits;
 // Beforehand we get report parameters.
 $arRepParams = array();
 if (!($arRepParams = Bitrix\Report\ReportTable::getById($ID)->fetch())) {
     $errorMessage .= GetMessage("SALE_REPORT_VIEW_ERROR_GET_REP_PARAMS") . '<br>';
     $fCriticalError = true;
 }