<?php
 $currDir=dirname(__FILE__).'/'; $reportFilters['timestamp']['startDateSql']=standard2mysqlDateConversion($reportFilters['timestamp']['startDate']); $reportFilters['timestamp']['endDateSql']=standard2mysqlDateConversion($reportFilters['timestamp']['endDate']); $reportFilters['timestamp']['startDateStamp']=strtotime($reportFilters['timestamp']['startDateSql']); $reportFilters['timestamp']['endDateStamp']=strtotime($reportFilters['timestamp']['endDateSql'])+86399; list($reportFilters['user']['idOffice'], $reportFilters['user']['idUser']) = explode('|', $reportFilters['user']['id']); include($currDir."reportData_executeSQL.php"); refreshReportStatus('processingRecords', 'filterByOffice', 0); if ($reportFilters['user']['idOffice'] and !$reportFilters['user']['idUser']) { $updateReport_deleteByOfficeSQL="DELETE FROM `$reportTable` WHERE userOfficeId!='".$reportFilters['user']['idOffice']."'"; $updateReport_deleteByOfficeEx=$db->Execute($updateReport_deleteByOfficeSQL); if ($db->ErrorNo()) killReport("Could not run SQL in report. SQL: ".$updateReport_deleteByOfficeSQL); } refreshReportStatus('processingRecords', 'getOfficesInfo', 0); if($tableColumns['userOfficeName']){ $updateReportSQL="
		UPDATE `$reportTable` AS rep, `$DBTOffices` AS offices
		SET rep.userOfficeName=offices.name
		WHERE rep.userOfficeId=offices.id AND rep.userOfficeId>0
	"; $updateReportEx=$db->Execute($updateReportSQL); if ($db->ErrorNo()) killReport("Could not run SQL in report. SQL: ".$updateReportSQL); } refreshReportStatus('processingRecords', 'getDepartmentsInfo', 0); if($tableColumns['userDepartmentName'] || $tableColumns['userDepartmentCode']){ $updateReportSQL="UPDATE `$reportTable` AS rep, `$DBTDepartments` AS depts SET rep.userDepartmentId=depts.id "; if($tableColumns['userDepartmentName']) $updateReportSQL.=",rep.userDepartmentName=depts.name "; if($tableColumns['userDepartmentCode']) $updateReportSQL.=",rep.userDepartmentCode=depts.code "; $updateReportSQL.=" WHERE rep.userDepartmentId=depts.id AND rep.userDepartmentId>0"; $updateReportEx=$db->Execute($updateReportSQL); if ($db->ErrorNo()) killReport("Could not run SQL in report. SQL: ".$updateReportSQL); } include_once('reportData_loopRecords.php'); ?>