<?php
namespace ModulesAbstract\PluginReports\Report\Model\Gatherer; class SupplierPayment extends GathererAbstract { protected $invoicePaymentsIterator = NULL; public function getRequiredFilters() { return [ 'interval', 'documentIssued', ]; } protected function objectInitialize() { $listObj = new \App\EntityList\SupplierInvoicePayments(); $listObj->setColumns(['doc.id']); $listObj->setFilter('doc.docDate', '>=', $this->filters['interval']['start']); $listObj->setFilter('doc.docDate', '<=', $this->filters['interval']['end']); $listObj->applyUserRestriction(false); if ($this->filters['documentIssued']) { $listObj->setFilter("doc.blockTime", '>', 0); } $this->invoicePaymentsIterator = $listObj->getExecution(); } protected function objectDestroy() { if ($this->invoicePaymentsIterator) { $this->invoicePaymentsIterator->Close(); $this->invoicePaymentsIterator = NULL; } } protected function objectNext() { if ($this->invoicePaymentsIterator && !$this->invoicePaymentsIterator->EOF) { $result = $this->invoicePaymentsIterator->FetchRow(); return ['invoicePaymentId' => $result['id']]; } return NULL; } }