CakeAccounting/templates/element/DeAccounts/row.php

39 lines
1.1 KiB
PHP

<?php
/**
* @var \App\View\AppView $this
* @var \CakeAccounting\Model\Entity\DeAccount $account
* @var int $nestLevel
* @var array $totals
*/
if (!isset($nestLevel)) {
$nestLevel = 0;
}
$indent = '';
for ( $i = 0; $i < $nestLevel; $i++) {
$indent .= ' -- ';
}
$nestLevel++;
$hasChildren = isset($account->children) && $account->children;
?>
<tr>
<td><?= $account->account_type_code ?></td>
<td><?= $indent . $account->account_number ?></td>
<td><?= $indent . h($account->name) ?></td>
<td>
<?= $totals && array_key_exists('balance', $totals) ? $this->Number->format($totals['balance']) : 0; ?>
</td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $account->account_number]) ?>
</td>
</tr>
<?php if ($hasChildren) : ?>
<?php foreach ($account->children as $child) : ?>
<?= $this->element('DeAccounts/row', [
'account' => $child,
'nestLevel' => $nestLevel,
'totals' => array_key_exists($child->account_number, $totals['children']) ? $totals['children'][$child->account_number] : [],
]); ?>
<?php endforeach; ?>
<?php endif; ?>