<?php
refreshReportStatus('extractMainDataFromDb', 'updateCorporateDetails', 0); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_corporateSegments, 'corp_segmentName', 'corp_idSegment', 'name'); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_users, 'corp_accountManagerName', 'corp_idAccountManager', "CONCAT(joinTable.lastName, ' ', joinTable.firstName)"); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_users, 'corp_collectionRespName', 'corp_idCollectionResp', "CONCAT(joinTable.lastName, ' ', joinTable.firstName)"); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_users, 'corp_invoiceRespName', 'corp_idInvoiceResp', "CONCAT(joinTable.lastName, ' ', joinTable.firstName)"); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_trusts, 'trust_name', 'trust_id', 'name'); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_activityDomains, 'domain_name', 'domain_id', 'name'); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_activityDomainCategories, 'domainCategory_name', 'domainCategory_id', 'name'); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $availableTableColumns); $reportCopyInfo->addJoinTable($DBTRd_corporates, 'realCorp', 'rep.realCorp_id=realCorp.id', 'LEFT'); $cols = [ 'realCorp_alias' => 'realCorp.alias', 'realCorp_companyNameStd' => 'realCorp.companyNameStd', 'realCorp_companyNameLoc' => 'realCorp.companyNameLoc', ]; $reportCopyInfo->setStructureColumns($cols); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_offices, 'corp_addOfficeName', 'corp_addOfficeId', "name"); $reportCopyInfo = new \App\Reports\Db\ManageRecords\UpdateSimple($reportTable, $availableTableColumns); $reportCopyInfo->populateSimple($DBTRd_users, 'corp_updateUserName', 'corp_idUpdateUser', "CONCAT(joinTable.lastName, ' ', joinTable.firstName)"); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $availableTableColumns); $reportCopyInfo->addJoinTable($DBTCorporateCreditLimitDetails, 'creditLimits', 'rep.corp_id=creditLimits.idCorporate', 'LEFT'); $reportCopyInfo->addStructureColumn("corp_creditLimitContactIds", "IF(LENGTH(creditLimits.idContactPersons), REPLACE(TRIM(BOTH '|' FROM creditLimits.idContactPersons), '|', ', '),'')", "creditLimits"); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $availableTableColumns); $reportCopyInfo->addStructureColumn('corp_hasContract', '(SELECT 1 FROM `'.$DBTRd_corporateContracts.'` WHERE rep.corp_id = idCorporate AND deleted=0 LIMIT 1)', 'rep'); $reportCopyInfo->populate();