<?php
 refreshReportStatus('extractMainDataFromDb', 'runningMainSQL', 0); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Insert($reportTable); $reportCopyInfo->setMainTable($DBTRd_tasks, 'task'); $cols = [ 'task_id' =>'task.id', 'task_statusCode' =>'task.status', 'task_statusDescription' =>'task.statusDescription', 'task_statusReasonCode' =>'task.statusReason', 'task_date' =>'task.taskDate', 'task_description' =>'task.description', 'task_idUser' =>'task.idResponsibleUser', 'task_idDepartment' =>'task.idDepartment', 'task_idOffice' =>'task.idOffice', 'task_assignorIdUser' =>'task.idAssignorUser', 'task_idOperationType' =>'task.idOperationType', 'task_idCategory' =>'task.idCategory', 'task_priorityCode' =>'task.priority', 'task_comments' =>'task.comments', 'task_free' =>'task.free', 'task_deadlineTime' =>'task.deadline', 'task_estimatedFinishTime' =>'task.estimatedFinishTime', 'pivot_code' =>'task.pivot', 'pivot_id' =>'task.idPivot', 'task_idAddUser' =>'task.idAddUser', 'task_idUpdateUser' =>'task.idUpdateUser', 'task_addTime' =>'task.addTime', 'task_lastUpdateTime' =>'task.lastUpdateTime', 'task_updatesCount' =>'task.updatesCount', ]; $reportCopyInfo->setStructureColumns($cols); $reportCopyInfo->addStructureColumn("task_dateYM", "DATE_FORMAT(task.taskDate, '%Y-%m-01')", "task"); $reportCopyInfo->addStructureColumn("task_dateY", "DATE_FORMAT(task.taskDate, '%Y-01-01')", "task"); $reportCopyInfo->addStructureColumn("task_deadlineDate", "DATE_FORMAT(task.deadline, '%Y-%m-%d')", "task"); $reportCopyInfo->addStructureColumn("task_estimatedDurationMinutes", "task.estimatedDuration/60", "task"); $reportCopyInfo->setActiveColumns($availableTableColumns); if ($reportFilters['taskDate']['start']) { $reportCopyInfo->addFilter('task.taskDate', '>=', $reportFilters['taskDate']['start']); } if ($reportFilters['taskDate']['end']) { $reportCopyInfo->addFilter('task.taskDate', '<=', $reportFilters['taskDate']['end']); } if ($reportFilters['taskStatus']) { $reportCopyInfo->addFilter('task.status', 'IN', $reportFilters['taskStatus']); } if ($reportFilters['idOffice']) { $reportCopyInfo->addFilter('task.idOffice', '=', $reportFilters['idOffice']); } if ($reportFilters['idDepartment']) { $reportCopyInfo->addFilter('task.idDepartment', '=', $reportFilters['idDepartment']); } if ($reportFilters['idResponsibleUser']) { $reportCopyInfo->addFilter('task.idResponsibleUser', '=', $reportFilters['idResponsibleUser']); } if ($reportFilters['idAssignorUser']) { $reportCopyInfo->addFilter('task.idAssignorUser', '=', $reportFilters['idAssignorUser']); } $reportCopyInfo->addFilter('task.deleted', '=', 0); $reportCopyInfo->populate(); 