<?php
 refreshReportStatus('extractMainDataFromDb', 'runningMainSQL', 0); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Insert($reportTable); $reportCopyInfo->setMainTable($DBTUsers, 'user'); $reportCopyInfo->addJoinTable($DBTUsersAccess, 'access', 'access.idUser = user.id'); $cols = [ 'idUser' => 'user.id', 'firstName' => 'user.firstName', 'lastName' => 'user.lastName', 'userProcessedRemarks' => 'user.processedRemarks', 'idOffice' => 'user.idOffice', 'idDepartment' => 'user.idDepartment', 'idProfile' => 'user.idUsersAccessProfile', 'idSection' => 'access.idSection', 'type' => 'access.type', 'optionValue' => 'access.optionValue', ]; $reportCopyInfo->setStructureColumns($cols); $reportCopyInfo->addStructureColumn("id", "CONCAT(user.id, '|', access.idSection)", "access"); $reportCopyInfo->setActiveColumns($availableTableColumns); if ($reportFilters['user']['id']) { $reportCopyInfo->addFilter('user.id', '=', $reportFilters['user']['id']); } $reportCopyInfo->addFilter('user.idUsersAccessProfile', '=', 0); $reportCopyInfo->addFilter('user.deleted', '=', 0); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Insert($reportTable); $reportCopyInfo->setMainTable($DBTUsers, 'user'); $reportCopyInfo->addJoinTable($DBTUsersProfilesAccess, 'profile', 'profile.idProfile = user.idUsersAccessProfile'); $cols = [ 'idUser' => 'user.id', 'firstName' => 'user.firstName', 'lastName' => 'user.lastName', 'userProcessedRemarks' => 'user.processedRemarks', 'idOffice' => 'user.idOffice', 'idDepartment' => 'user.idDepartment', 'idProfile' => 'user.idUsersAccessProfile', 'idSection' => 'profile.idSection', 'type' => 'profile.type', 'optionValue' => 'profile.optionValue', ]; $reportCopyInfo->setStructureColumns($cols); $reportCopyInfo->addStructureColumn("id", "CONCAT(user.id, '|', profile.idSection)", "profile"); $reportCopyInfo->setActiveColumns($availableTableColumns); if ($reportFilters['user']['id']) { $reportCopyInfo->addFilter('user.id', '=', $reportFilters['user']['id']); } $reportCopyInfo->addFilter('user.idUsersAccessProfile', '>', 0); $reportCopyInfo->addFilter('user.deleted', '=', 0); $reportCopyInfo->populate(); 