if ($arResult['ALLOW_LD_TAX']) { if ($arResult['INVOICE_MODE']) { $arResult['TAX_LIST'] = CCrmInvoice::getTaxList($ownerID); if (!is_array($arResult['TAX_LIST'])) { $arResult['TAX_LIST'] = array(); } foreach ($arResult['TAX_LIST'] as &$taxInfo) { $taxInfo['NAME'] = ''; if (isset($taxInfo['TAX_NAME'])) { $taxInfo['NAME'] = $taxInfo['TAX_NAME']; unset($taxInfo['TAX_NAME']); } } unset($taxInfo); } else { $totalInfo = CCrmProductRow::LoadTotalInfo($ownerType, $ownerID); $arResult['TAX_LIST'] = is_array($totalInfo['TAX_LIST']) ? $totalInfo['TAX_LIST'] : array(); } $arResult['TAX_LIST_PERCENT_PRECISION'] = defined("SALE_VALUE_PRECISION") ? SALE_VALUE_PRECISION : 2; } // Prepare totals $totalSum = 0.0; $totalTax = 0.0; $totalDiscount = 0.0; foreach ($arResult['PRODUCT_ROWS'] as &$row) { // invoice specific if ($arResult['INVOICE_MODE']) { $row['ID'] = isset($row['ID']) ? intval($row['ID']) : 0; $row['OWNER_ID'] = $row['ORDER_ID']; $row['OWNER_TYPE'] = $ownerType; $row['PRODUCT_ID'] = isset($row['PRODUCT_ID']) ? intval($row['PRODUCT_ID']) : 0;