public static function formatResultValue($k, &$v, &$row, &$cInfo, $total) { $dataType = self::getFieldDataType($cInfo['field']); /** @var Bitrix\Main\Entity\Field[] $cInfo */ if ($dataType !== 'float') { parent::formatResultValue($k, $v, $row, $cInfo, $total); } // Inserting zero in numerical fields with null value. if (empty($v)) { if (in_array($dataType, array('integer', 'float'))) { $v = 0; } //else $v = ' '; } // Formatting of monetary fields. foreach (self::$monetaryFields as $monField) { if (preg_match('/' . $monField . '$/', $k)) { $v = self::calculateInReportCurrency($v); $v = number_format(doubleval($v), 2, '.', ' '); break; } } // Formatting fields with goods quantity. foreach (self::$goodsQuantityFields as $qField) { if (preg_match('/' . $qField . '$/', $k)) { if (!empty($v) && !is_null($v) && $v != ' ') { if (self::$fDecimalQuant) { $v = sprintf('%.3f', round($v, 3)); } else { $v = sprintf('%d', round($v, 0)); } } break; } } // Formatting short name fields of buyers. foreach (self::$userNotAuthNameFields as $uField) { if (preg_match('/' . $uField . '$/', $k)) { if (empty($v) || is_null($v) || $v == ' ') { $v = GetMessage('SALE_REPORT_USER_NOT_AUTH'); } break; } } // runtime fields which align right if (self::$bUsePriceTypesColumns) { if (strpos($k, 'PRICE_TYPE_') === 0 && is_numeric(substr($k, 11))) { $cInfo['align'] = 'right'; } } // Formatting fields of price types if (preg_match('/[A-Za-z_]*PRICE_TYPE_[0-9]+$/', $k) && !empty($v) && $v !== ' ') { $v = trim($v); $spacePos = strpos(trim($v), ' '); $v = number_format(doubleval(substr($v, 0, $spacePos)), 2, '.', ' ') . substr($v, $spacePos); } }