<?php
 refreshReportStatus('extractMainDataFromDb', 'updateDocDetails', 0); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $availableTableColumns); $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', $availableTableColumns); $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', $availableTableColumns); $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', $availableTableColumns); $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', $availableTableColumns); $reportCopyInfo->addCaseStructureColumn("impDoc_processStatusName", "impDoc_processStatusCode", (Array)$_LANG['importedDocuments']['statusName']); $reportCopyInfo->populate(); $reportCopyInfo = new \App\Reports\Db\ManageRecords\Update($reportTable, 'rep', $availableTableColumns); $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', $availableTableColumns); $reportCopyInfo->addCaseStructureColumn("impDoc_docTypeName", "impDoc_docTypeCode", \App\Config\PaymentDocuments::getInstance()->getList()); $reportCopyInfo->addFilter('rep.impDoc_docCategoryCode', '=', 'payment'); $reportCopyInfo->populate();