<?php
 namespace App\ReportsData\Populate\Entity; class SupplierInvoicePayment extends \App\ReportsData\Populate\GeneralAbstract { protected function getDbTableName() { global $DBTRd_supplierInvoicePayments; return $DBTRd_supplierInvoicePayments; } protected function getEntityFields() { $entity = \Entity\SupplierInvoicePayment::select($this->id); if (!$entity->recordExists()) { return null; } $defaultCurrency = \App\CurrencyExchange\Date::getInstance($entity->docDate)->getMarketCurrency(); $currencyRate = \App\CurrencyExchange\Rates::getInstance($entity->docDate)->convert(1, $entity->currency, $defaultCurrency, null); $return = [ 'id' => $this->id, 'deleted' => $entity->deleted, 'idInvoice' => $entity->idInvoice, 'idPaymentSeries' => $entity->idPaymentSeries, 'docType' => $entity->docType, 'docDate' => $entity->docDate, 'docNumber' => $entity->docNumber, 'value' => $entity->value, 'currency' => $entity->currency, 'currencyRate' => $currencyRate, 'invoicePayedValue' => $entity->invoicePayedValue, 'idBankAccount' => $entity->idBankAccount, 'explanations' => $entity->explanations, 'comments' => $entity->comments, 'idImportedDoc' => $entity->idImportedDoc, 'remarks' => $entity->remarks, 'processedRemarks' => ($entity->processedRemarks ? json_encode($entity->processedRemarks) : ''), 'idUser' => $entity->idUser, 'idOffice' => $entity->idOffice, 'idIssueUser' => $entity->idIssueUser, 'issueTime' => ( $entity->issueTime ? \Engine\DateTime::createFromTimestamp($entity->issueTime)->formatDatetimeIso() : null ), 'idAddUser' => $entity->idAddUser, 'addTime' => \Engine\DateTime::createFromTimestamp($entity->addTime)->formatDatetimeIso(), 'idUpdateUser' => $entity->idUpdateUser, 'lastUpdateTime' => ( $entity->lastUpdateTime ? \Engine\DateTime::createFromTimestamp($entity->lastUpdateTime)->formatDatetimeIso() : null ), 'updatesCount' => $entity->updatesCount, 'idBlockUser' => $entity->idBlockUser, 'blockTime' => ( $entity->blockTime ? \Engine\DateTime::createFromTimestamp($entity->blockTime)->formatDatetimeIso() : null ), ]; $this->addPopulatingReference('SupplierInvoice', $entity->idInvoice); if ($entity->idImportedDoc) { $this->addPopulatingReference('ImportedDocument', $entity->idImportedDoc); } return $return; } } 