mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add sum.
This commit is contained in:
parent
f22a9799a1
commit
7a216f95ca
@ -52,7 +52,7 @@ class General extends Twig_Extension
|
|||||||
$this->getCurrencySymbol(),
|
$this->getCurrencySymbol(),
|
||||||
$this->phpdate(),
|
$this->phpdate(),
|
||||||
$this->env(),
|
$this->env(),
|
||||||
|
$this->getAmountFromJournal(),
|
||||||
$this->activeRouteStrict(),
|
$this->activeRouteStrict(),
|
||||||
$this->activeRoutePartial(),
|
$this->activeRoutePartial(),
|
||||||
$this->activeRoutePartialWhat(),
|
$this->activeRoutePartialWhat(),
|
||||||
@ -306,4 +306,16 @@ class General extends Twig_Extension
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Twig_SimpleFunction
|
||||||
|
*/
|
||||||
|
private function getAmountFromJournal()
|
||||||
|
{
|
||||||
|
return new Twig_SimpleFunction(
|
||||||
|
'getAmount', function (TransactionJournal $journal) : string {
|
||||||
|
return TransactionJournal::amount($journal);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<th class="hidden-xs">{{ trans('list.from') }}</th>
|
<th class="hidden-xs">{{ trans('list.from') }}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not hideDestination %}
|
{% if not hideDestination %}
|
||||||
<th class="hidden-xs">{{ trans('list.to') }}</th>
|
<th class="hidden-xs">{{ trans('list.to') }}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<!-- Hide budgets? -->
|
<!-- Hide budgets? -->
|
||||||
{% if not hideBudget %}
|
{% if not hideBudget %}
|
||||||
@ -23,7 +23,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<!--
|
||||||
|
Make sum:
|
||||||
|
{% set sum = 0 %}
|
||||||
|
-->
|
||||||
{% for journal in journals %}
|
{% for journal in journals %}
|
||||||
|
<!-- add to sum
|
||||||
|
{% set sum = (sum + getAmount(journal) ) %}
|
||||||
|
-->
|
||||||
<tr class="drag" data-date="{{ journal.date.format('Y-m-d') }}" data-id="{{ journal.id }}">
|
<tr class="drag" data-date="{{ journal.date.format('Y-m-d') }}" data-id="{{ journal.id }}">
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{{ journal|typeIcon }}
|
{{ journal|typeIcon }}
|
||||||
@ -38,22 +45,22 @@
|
|||||||
{{ journal.date.formatLocalized(monthAndDayFormat) }}
|
{{ journal.date.formatLocalized(monthAndDayFormat) }}
|
||||||
</td>
|
</td>
|
||||||
{% if not hideSource %}
|
{% if not hideSource %}
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{% if journal.source_account_type == 'Cash account' %}
|
{% if journal.source_account_type == 'Cash account' %}
|
||||||
<span class="text-success">(cash)</span>
|
<span class="text-success">(cash)</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ route('accounts.show',journal.source_account_id) }}">{{ journal.source_account_name }}</a>
|
<a href="{{ route('accounts.show',journal.source_account_id) }}">{{ journal.source_account_name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not hideDestination %}
|
{% if not hideDestination %}
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{% if journal.destination_account_type == 'Cash account' %}
|
{% if journal.destination_account_type == 'Cash account' %}
|
||||||
<span class="text-success">(cash)</span>
|
<span class="text-success">(cash)</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ route('accounts.show',journal.destination_account_id) }}">{{ journal.destination_account_name }}</a>
|
<a href="{{ route('accounts.show',journal.destination_account_id) }}">{{ journal.destination_account_name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Do NOT hide the budget? -->
|
<!-- Do NOT hide the budget? -->
|
||||||
@ -76,6 +83,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="text-align: right;"><em>{{ 'sum'|_ }}:</em></td>
|
||||||
|
<td>{{ sum|formatAmount }}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{{ journals.render|raw }}
|
{{ journals.render|raw }}
|
||||||
|
Loading…
Reference in New Issue
Block a user