31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
// Per-column net total in the column header (credits - debits). Shown in every column of an
|
|
// enabled board, including "Total: R$0,00" -- never hidden on zero. Server-side, re-renders on
|
|
// every board refresh. Rendered on its own full-width line under the title; "Total:" stays the
|
|
// default (black) and only the amount is colored by sign.
|
|
if (empty($column['project_id']) || ! $this->FinanceHelper->isEnabled($column['project_id'])) {
|
|
return;
|
|
}
|
|
|
|
// Per-column opt-out, toggled from the column dropdown menu.
|
|
if ($this->FinanceHelper->isTotalHidden($column['project_id'], $column['id'])) {
|
|
return;
|
|
}
|
|
|
|
$net = $this->FinanceHelper->columnNet($column);
|
|
|
|
if ($net > 0) {
|
|
$amount_class = 'fb-total-credit';
|
|
$sign = '+';
|
|
} elseif ($net < 0) {
|
|
$amount_class = 'fb-total-debit';
|
|
$sign = '-';
|
|
} else {
|
|
$amount_class = 'fb-total-zero';
|
|
$sign = '';
|
|
}
|
|
?>
|
|
<div class="fb-column-total">
|
|
<span class="fb-total-pill"><?= t('Total') ?>: <span class="fb-amount <?= $amount_class ?>"><?= $sign ?>R$<?= \Kanboard\Plugin\FinanceBuddy\Helper\FinanceHelper::money(abs($net)) ?></span></span>
|
|
</div>
|