• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/classes/general/timeman_report_full.php
  • Класс: CTimeManReportFull
  • Вызов: CTimeManReportFull::__getReportJSDraw
static function __getReportJSDraw($arFields)
{
	$arResult = Array(
			"CELL_FROM"=>0,
			"CELL_COUNT"=>0
		);
	$cellCount = (($arFields["REPORT_DATE_TO"] - $arFields["REPORT_DATE_FROM"])/86400)+1;
	$dayCount = date('t', $arFields["PERIOD_DATE_FROM"]);
	$curMonth = date('n', $arFields["PERIOD_DATE_FROM"]);
	$dateFrom = getdate($arFields["REPORT_DATE_FROM"]);
	$dateTo = getdate($arFields["REPORT_DATE_TO"]);
	$rowCell = $dateFrom["mday"]-1;

	if ($dateTo["mday"]<$dateFrom["mday"]
		&& ($dateFrom["mon"]<$dateTo["mon"] || $dateFrom["year"]<$dateTo["year"])
	)
	{

		if ($curMonth == $dateFrom["mon"])
		{
			$cellCount = $dayCount - $dateFrom["mday"]+1;
			$rowCell = $dateFrom["mday"]-1;
		}
		elseif($curMonth == $dateTo["mon"])
		{
			$cellCount = $dateTo["mday"];
			$rowCell = 0;
		}
	}

	$arResult = Array(
			"CELL_FROM"=>$rowCell,
			"CELL_COUNT"=>round($cellCount),
		);

	return $arResult;

}