FunnelWidget::prepareTotals

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. FunnelWidget
  4. prepareTotals
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/widget/funnelwidget.php
  • Класс: Bitrix\Crm\Widget\FunnelWidget
  • Вызов: FunnelWidget::prepareTotals
protected function prepareTotals(array $values, array &$totals)
{
	if($this->entityTypeID === \CCrmOwnerType::Lead || $this->entityTypeID === \CCrmOwnerType::Invoice)
	{
		foreach($values as $value)
		{
			$statusID = isset($value['STATUS_ID']) ? $value['STATUS_ID'] : '';
			$qty = isset($value['QTY']) ? (int)$value['QTY'] : 0;
			if(isset($totals[$statusID]))
			{
				$totals[$statusID]['TOTAL'] += $qty;
			}
		}
	}
	elseif($this->entityTypeID === \CCrmOwnerType::Deal)
	{
		foreach($values as $value)
		{
			$stageID = isset($value['STAGE_ID']) ? $value['STAGE_ID'] : '';
			$qty = isset($value['QTY']) ? (int)$value['QTY'] : 0;
			if(isset($totals[$stageID]))
			{
				$totals[$stageID]['TOTAL'] += $qty;
			}
		}
	}
}

Добавить комментарий