• Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/ProductGrid/SummaryQuery.php
  • Класс: BitrixCrmMobileProductGridSummaryQuery
  • Вызов: SummaryQuery::execute
public function execute(): array
{
	$result = $this->accounting->calculate(
		$this->products,
		$this->currencyId,
		$this->getPersonTypeId(),
		$this->getLocationId()
	);

	if (!is_array($result))
	{
		$result = [];
	}

	$totalDiscount = $this->getTotalDiscount();
	$totalSum = isset($result['PRICE']) ? round((float)$result['PRICE'], $this->precision) : 0.0;
	$totalTax = isset($result['TAX_VALUE']) ? round((float)$result['TAX_VALUE'], $this->precision) : 0.0;

	$totalBeforeDiscount = round($totalSum + $totalDiscount, $this->precision);

	$totalDelivery = $this->entity->getId()
		? $this->accounting->calculateDeliveryTotal(ItemIdentifier::createByItem($this->entity))
		: 0.0;

	if ($this->additionalConfig['addDeliveryToTotal'] ?? true)
	{
		$totalSum += $totalDelivery;
	}

	return [
		'totalRows' => count($this->products),
		'totalCost' => $totalSum,
		'totalDelivery' => $totalDelivery,
		'totalTax' => $totalTax,
		'totalDiscount' => $totalDiscount,
		'totalWithoutDiscount' => $totalBeforeDiscount,
		'currency' => $this->currencyId,
		'taxIncluded' => $this->isTaxIncluded(),
		'taxPartlyIncluded' => $this->isTaxPartlyIncluded(),
	];
}