<?php
 namespace App\ReportsData\Populate\Entity; class CashBookDocument extends \App\ReportsData\Populate\GeneralAbstract { protected function getDbTableName() { global $DBTRd_cashbookDocuments; return $DBTRd_cashbookDocuments; } protected function getEntityFields() { $entity = \Entity\CashBookDocument::select($this->id); if (!$entity->recordExists()) { return null; } $defaultCurrency = \App\CurrencyExchange\Date::getInstance($entity->date)->getMarketCurrency(); $workCurrency = \App\Config\Currencies::getInstance()->getWorkCurrency(); $currencyRate = \App\CurrencyExchange\Rates::getInstance($entity->date)->convert(1, $entity->currency, $defaultCurrency, null); $workCurrencyRate = \App\CurrencyExchange\Rates::getInstance($entity->date)->convert(1, $workCurrency, $defaultCurrency, null); $return = [ 'id' => $this->id, 'deleted' => $entity->deleted, 'category' => $entity->category, 'type' => $entity->type, 'number' => $entity->number, 'date' => $entity->date, 'value' => $entity->value, 'currency' => $entity->currency, 'currencyRate' => $currencyRate, 'workCurrencyRate' => $workCurrencyRate, 'explanations' => $entity->explanations, 'comments' => $entity->comments, 'idBankAccount' => $entity->idAgencyBankAccount, 'partner' => $entity->partner, '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 ), ]; return $return; } } 