List fixed assets
Lists the fixed assets of the new fixed assets module with their status, book value and last depreciated period. Companies on the classic module use List fixed assets (classic).
fixedAssets()->search($pattern)searches code and description, with filters such asstatus(),regime(),inClass(),inGroup()andinvestedBetween().- The book value and purchase value are those of the youngest regime;
get()gives the values per regime. postingErrorMessagesays why Twinfield could not post the last depreciation.
Needs the scope readFixedAssets.
$twinfield = Example::twinfield();
$search = $twinfield->fixedAssets()->search($argv[1] ?? '*')->orderBy('code');
if (isset($argv[2])) { $search = $search->status(FixedAssetStatus::from($argv[2]));}
foreach ($search->all() as $asset) { echo sprintf( '%s %s: %s, book value %s of %s%s', $asset->code, $asset->description, $asset->status->value, $asset->netBookValue, $asset->purchaseValue, $asset->lastDepreciatedPeriod === null ? '' : ', depreciated up to ' . $asset->lastDepreciatedPeriod, ), PHP_EOL;
if ($asset->postingErrorMessage !== null) { echo ' Posting error: ', $asset->postingErrorMessage, PHP_EOL; }}php examples/fixed-assets/list-fixed-assets/example.phpphp examples/fixed-assets/list-fixed-assets/example.php '6*' activeAdd TWINFIELD_DEBUG=1 to see the requests and responses.
60000 Delivery van: active, book value 21250.00 of 32000.00, depreciated up to 2026/1060001 Office furniture: active, book value 4100.00 of 8200.00, depreciated up to 2026/1060002 Laptop: disposed, book value 0.00 of 1499.00, depreciated up to 2025/06 Posting error: General ledger account 4800 needs a cost center.Source
Section titled “Source”View examples/fixed-assets/list-fixed-assets/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.