<?php
 namespace App\Reports\Sources\ImportedDocs; class PopulateQuickColumns extends \App\Reports\Sources\PopulateAbstract { public function populate() :void { global $DBTRd_corporates, $DBTRd_suppliers, $DBTRd_customers; $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); $reportTable = $this->tableManager->getTableName(); $activeColumns = array_keys( $this->columnsManager->getStdColumns() ); $this->reportGenerationStatusUpdate('extractMainDataFromDb', 'updateDocDetails', 0); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $activeColumns); $reportCopyInfo->addStructureColumn("impDoc_partnerId", "IF(rep.impDoc_supplierId, rep.impDoc_supplierId, IF(rep.impDoc_corporateId, rep.impDoc_corporateId, rep.impDoc_customerId))", "rep"); $reportCopyInfo->addStructureColumn("impDoc_partnerType", "IF(rep.impDoc_supplierId, 'supplier', IF(rep.impDoc_corporateId, 'corporate', 'customer'))", "rep"); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $activeColumns); $reportCopyInfo->addJoinTable($DBTRd_corporates, 'docCorp', 'rep.impDoc_corporateId=docCorp.id', 'LEFT'); $reportCopyInfo->addStructureColumn("impDoc_partnerName", "docCorp.alias", "docCorp"); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $activeColumns); $reportCopyInfo->addJoinTable($DBTRd_customers, 'docCust', 'rep.impDoc_customerId=docCust.id', 'LEFT'); $reportCopyInfo->addStructureColumn("impDoc_partnerName", "IF(rep.impDoc_partnerName = '' AND rep.impDoc_corporateId = 0, CONCAT(docCust.lastNameStd, ' ', docCust.firstNameStd), rep.impDoc_partnerName)", "docCust"); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $activeColumns); $reportCopyInfo->addJoinTable($DBTRd_suppliers, 'docSupp', 'rep.impDoc_supplierId=docSupp.id', 'LEFT'); $reportCopyInfo->addStructureColumn("impDoc_partnerName", "IF(rep.impDoc_supplierId, docSupp.alias, rep.impDoc_partnerName)", "docSupp"); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $activeColumns); $reportCopyInfo->addCaseStructureColumn("impDoc_processStatusName", "impDoc_processStatusCode", (Array)$_LANG['importedDocuments']['statusName']); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $activeColumns); $reportCopyInfo->addCaseStructureColumn("impDoc_docTypeName", "impDoc_docTypeCode", \App\Config\CashingDocuments::getInstance()->getList()); $reportCopyInfo->addFilter('rep.impDoc_docCategoryCode', '=', 'cashing'); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $activeColumns); $reportCopyInfo->addCaseStructureColumn("impDoc_docTypeName", "impDoc_docTypeCode", \App\Config\PaymentDocuments::getInstance()->getList()); $reportCopyInfo->addFilter('rep.impDoc_docCategoryCode', '=', 'payment'); $reportCopyInfo->populate(); } } 