<?php
 namespace App\QuickReports\PivotTables\Data; class ClientInvoiceRows extends GeneralAbstract { protected $allAvailableColumns = [ 'invoiceDate', 'invoiceDateY', 'invoiceDateM', 'invoiceDateYM', 'dueDate', 'dueDays', 'dueDateY', 'dueDateM', 'dueDateYM', 'rowType', 'rowValOrg', 'rowVatOrg', 'rowTtlOrg', 'rowProfitOrg', 'rowCostOrg', 'currency', 'rowValDef', 'rowVatDef', 'rowTtlDef', 'rowProfitDef', 'rowCostDef', 'rowValWrk', 'rowVatWrk', 'rowTtlWrk', 'rowProfitWrk', 'rowCostWrk', 'rowVatPercent', 'rowVatText', 'orderDate', 'orderDateY', 'orderDateM', 'orderDateYM', 'offerStartDate', 'offerStartDateY', 'offerStartDateM', 'offerStartDateYM', 'idCorporate', 'idCorporateOffice', 'idCustomer', 'serviceCode', 'idService', 'serviceIdUser', 'serviceIdOffice', 'invoiceIdUser', 'invoiceIdOffice', 'clientType', 'idCorporateSegment', 'idCustomerSegment', 'clientCountryCode', 'idSupplier', 'offerDestCountryCode', 'offerDestCityId', 'cashedStatus', 'cashedOrg', 'cashedDef', 'cashedWrk', 'duePayOrg', 'duePayDef', 'duePayWrk', 'cashDate', 'cashDays', 'invoiceAddDate', 'invoiceIssueDate', 'invoiceVoidDate' ]; protected function getDbTable() { global $DBTPivotTablesData_clientInvoiceRows; return $DBTPivotTablesData_clientInvoiceRows; } public function getColumnDisplayValue($column, $value) { switch ($column) { case 'invoiceDate': case 'dueDate': case 'orderDate': case 'offerStartDate': case 'cashDate': case 'invoiceAddDate': case 'invoiceIssueDate': case 'invoiceVoidDate': { return \Engine\DateTime::isoToStd($value); } case 'invoiceDateM': case 'dueDateM': case 'orderDateM': case 'offerStartDateM': { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); return $_LANG['date']['month']['short'][$value]; } case 'invoiceDateYM': case 'dueDateYM': case 'orderDateYM': case 'offerStartDateYM': { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); $y = floor($value/100); $m = $value % 100; return $_LANG['date']['month']['short'][$m].' '.$y; } case 'idCorporate': { return \Entity\Corporate::select($value)->alias; } case 'idCorporateOffice': { return \Entity\CorporateOffice::select($value)->name; } case 'idCustomer': { if (\Entity\Customer::select($value)->nameStandard) { return \Entity\Customer::select($value)->nameStandard; } else { return \Entity\Customer::select($value)->nameLocal; } } case 'idCorporateSegment': { return \Entity\CorporateSegment::select($value)->name; } case 'idCustomerSegment': { return \Entity\CustomerSegment::select($value)->name; } case 'idSupplier': { return \Entity\Supplier::select($value)->alias; } case 'offerDestCountryCode': case 'clientCountryCode': { return \Entity\Country::select($value)->name; } case 'offerDestCityId': { return \Entity\City::select($value)->name; } case 'serviceIdUser': { return \Entity\User::select($value)->name; } case 'serviceIdOffice': { return \Entity\Office::select($value)->name; } case 'invoiceIdUser': { return \Entity\User::select($value)->name; } case 'invoiceIdOffice': { return \Entity\Office::select($value)->name; } case 'rowType': { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); return $_LANG['rowType'][$value]; } case 'clientType': { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); return $_LANG['generalData']['clientType'][$value]; } case 'cashedStatus': { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); return $_LANG['invoices']['status'][$value]; } case 'serviceCode': { return \App\Config\Services_Basic::getInstance()->getServiceName($value); } case 'rowVatPercent': { return $value.'%'; } default: { return parent::getColumnDisplayValue($column, $value); } } } } 