• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/integration/report/handler/callactivity/callactivitygraph.php
  • Класс: BitrixVoximplantIntegrationReportHandlerCallActivityCallActivityGraph
  • Вызов: CallActivityGraph::getQueryForReport
public function getQueryForReport($startDate, $finishDate, $filterParameters): Query
{
	$query = StatisticTable::query();

	$this->addDateWithGrouping($query);
	$query->addSelect('DAY_OF_WEEK');
	$query->addSelect('HOUR');

	$dateWithShift = $this->getDateExpressionWithTimeShiftForQuery();
	$query->registerRuntimeField(new ExpressionField(
		'DAY_OF_WEEK',
		"dayofweek($dateWithShift) - 1",
		['CALL_START_DATE']
	));

	$query->registerRuntimeField(new ExpressionField(
		'HOUR',
		"hour($dateWithShift)",
		['CALL_START_DATE']
	));

	$this->addCallTypeField($query, CallType::INCOMING, 'CALL_INCOMING');
	$this->addCallTypeField($query, CallType::MISSED, 'CALL_MISSED');

	$this->addToQueryFilterCase($query, $filterParameters);
	$query->whereBetween('CALL_START_DATE', $startDate, $finishDate);

	return $query;
}