<?php
namespace ModulesAbstract\PluginReports\Report\Model\Gatherer; class SupplierInvoiceRows extends GathererAbstract { protected $invoiceRowsIterator = NULL; public function getRequiredFilters() { return [ 'invoiceDate', ]; } public function getAcceptedFilters() { return [ 'invoiceDate', 'invoiceIssued', ]; } protected function objectInitialize() { $listObj = new \App\EntityList\SupplierInvoiceRows(); $listObj->setColumns([ 'invRow.id'=>'idInvoiceRow', 'invRow.idInvoice', 'invRow.serviceCode', 'invRow.rowType', 'invRow.externalReservationId', 'invRow.externalReservationDate', 'invRow.reservationCode', 'invRow.reservationNumber', 'invRow.reservationId', 'invRow.checkIn', 'invRow.priceValue', 'invRow.vatValue', ]); $listObj->setFilter('invoiceDate', '>=', $this->filters['invoiceDate']['start']); $listObj->setFilter('invoiceDate', '<=', $this->filters['invoiceDate']['end']); $listObj->setFilter('inv.invoiceNumber', '!=', 0); $listObj->applyUserRestriction(false); if ($this->filters['invoiceIssued']) { $listObj->setFilter('blockTime', '>', 0); } $listObj->setOrderBy('idInvoice', 'DESC'); $listObj->setOrderBy('idInvoiceRow', 'ASC'); $this->invoiceRowsIterator = $listObj->getExecution(); } protected function objectDestroy() { if ($this->invoiceRowsIterator) { $this->invoiceRowsIterator->Close(); $this->invoiceRowsIterator = NULL; } } protected function objectNext() { if ($this->invoiceRowsIterator && !$this->invoiceRowsIterator->EOF) { $result = $this->invoiceRowsIterator->FetchRow(); return $result; } return NULL; } }