• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Accounting.php
  • Класс: Bitrix\Crm\Service\Accounting
  • Вызов: Accounting::calculateByItem
public function calculateByItem(Item $item): Accounting\Result
{
	if ($this->isResultCached($item))
	{
		return $this->getResultFromCache($item);
	}

	$productRows = $item->getProductRows() ? $item->getProductRows()->toArray() : [];
	$personTypeId = $this->resolvePersonTypeId($item);

	$locationId = null;
	if ($item->hasField(Item::FIELD_NAME_LOCATION_ID))
	{
		$locationId = $item->get(Item::FIELD_NAME_LOCATION_ID);
	}

	$result = Accounting\Result::initializeFromArray(
		$this->calculate($productRows, $item->getCurrencyId(), $personTypeId, $locationId)
	);

	$this->cacheResult($item, $result);

	return $result;
}