• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/integration/report/handler/base.php
  • Класс: BitrixVoximplantIntegrationReportHandlerBase
  • Вызов: Base::addDateWithGrouping
public function addDateWithGrouping(Query $query, bool $useTimePeriod = false): void
{
	$dateWithShift = $this->getDateExpressionWithTimeShiftForQuery();

	if ($useTimePeriod)
	{
		$timePeriod = $this->getFilterParameters()['TIME_PERIOD_datesel'];
		switch ($timePeriod)
		{
			case DateType::YEAR:
			case DateType::QUARTER:
			case DateType::CURRENT_QUARTER:
				$expression = "date_format($dateWithShift, "%%Y-%%m")";
				break;
			default:
				$expression = "date($dateWithShift)";
				break;
		}
	}
	else
	{
		$expression = "date($dateWithShift)";
	}

	$query->registerRuntimeField(new ExpressionField(
		'DATE',
		$expression,
		['CALL_START_DATE']
	));

	$query->addSelect('DATE');
	$query->addGroup('DATE');
}