<?php
 namespace App\EntityList; class SupplierInvoicePayments extends SupplierInvoices { public function __construct() { global $DBTSupplierInvoicePayment, $DBTSupplierInvoices, $DBTImportedDocuments_documents; $this->tableName = $DBTSupplierInvoicePayment; $this->tableAlias = 'doc'; $this->allowedTables['doc'] = ['table'=>$DBTSupplierInvoicePayment, 'type'=>'month']; $this->allowedTables['inv'] = ['table'=>$DBTSupplierInvoices, 'type'=>'month', 'foreignKeyRef'=>"doc.idInvoice=inv.id", 'joinType'=>'INNER']; $this->allowedTables['impDoc'] = ['table'=>$DBTImportedDocuments_documents, 'type'=>'single', 'foreignKeyRef'=>"doc.idImportedDoc=impDoc.id", 'joinType'=>'LEFT']; GeneralMtAbstract::__construct(); $this->setColumn('doc.id', 'id'); } public function getMonthTablesList(): array { $tableMonths_idInv1=$this->getMonthTablesList_id(['inv.id']); $tableMonths_idInv2=$this->getMonthTablesList_id(['doc.idInvoice']); $tableMonths_idDoc=$this->getMonthTablesList_id(['doc.id']); $tableMonths_invDate=$this->getMonthTablesList_invoiceDate(); $tableMonths_docDate=$this->getMonthTablesList_documentDate(); $tableMonths=array_intersect($tableMonths_idInv1, $tableMonths_idInv2, $tableMonths_idDoc, $tableMonths_invDate, $tableMonths_docDate); return $tableMonths; } protected function getMonthTablesList_documentDate() { $period=$this->getMonthTablesList_period( ['doc.docDate', 'docDate'] ); if ($period['startDate']>$period['endDate']) return []; $paymentTablesList = \App\Utils\Db\TablesUtilsCached::getInstance()->getRealYmFromVirtualDate('supplierInvoicePayment', $period['startDate'], $period['endDate']); return $paymentTablesList; } protected function addUserRestrictionFilter() { } } 