Commit 2d78eeb6 authored by olb's avatar olb
Browse files

fix percent value

parent ee6d5b0b
......@@ -43,11 +43,11 @@
<table>
<tr>
<td class="title"><span>Total</span></td>
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in liabilities.periods(periods_number) %}
{% set current = liabilities.balance(period=period) %}
{% set value.current = liabilities.balance(period=period) %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
</table>
......@@ -93,11 +93,11 @@
<table>
<tr>
<td class="title"><span>Total</span></td>
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in assets.periods(periods_number) %}
{% set current = - assets.balance(period=period) %}
{% set value.current = - assets.balance(period=period) %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
</table>
......
......@@ -16,14 +16,14 @@
{% endwith %}
{% endif %}
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in part.periods(periods_number) %}
{% set current = part.balance(period=period) %}
{% set value.current = part.balance(period=period) %}
{% if inverted %}
{% set current = - current %}
{% set value.current = - value.current %}
{% endif %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
</thead>
......@@ -34,14 +34,14 @@
<tr>
{% include "inc/account.html" %}
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in part.periods(periods_number) %}
{% set current = part.balance(account,period) %}
{% set value.current = part.balance(account,period) %}
{% if inverted %}
{% set current = - current %}
{% set value.current = - value.current %}
{% endif %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
{% endfor %}
......
......@@ -16,11 +16,11 @@
{% endwith %}
{% endif %}
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in part.periods(periods_number) %}
{% set current = part.balance(period=period) %}
{% set value.current = part.balance(period=period) %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
</thead>
......@@ -31,11 +31,11 @@
<tr>
{% include "inc/account.html" %}
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in part.periods(periods_number) %}
{% set current = part.balance(account,period) %}
{% set value.current = part.balance(account,period) %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
{% endfor %}
......
<td class="value">
<span>
{{ "%.0f"|format(current) }}
{{ "%.0f"|format(value.current) }}
</span>
<span class="percent">
{% if last %}
{{ "%+.0f%%"|format((current - last) / last * 100) }}
{% if value.last %}
{{ "%+.0f%%"|format((value.current - value.last) / value.last * 100) }}
{% endif %}
</span>
</td>
......
......@@ -47,11 +47,11 @@
<table class="part">
<tr>
<td class="title"><span>{{ conf.incomes.title }}</span></td>
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in incomes.periods(periods_number) %}
{% set current = incomes.balance(period=period) %}
{% set value.current = incomes.balance(period=period) %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
</table>
......@@ -65,11 +65,11 @@
<td>
<table>
<td class="title"><span>Résultat</span></td>
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in expenses.periods(periods_number) %}
{% set current = expenses.balance(period=period) + incomes.balance(period=period) %}
{% set value.current = expenses.balance(period=period) + incomes.balance(period=period) %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</table>
</td>
......@@ -177,11 +177,11 @@
<table>
<tr>
<td class="title"><span>Total</span></td>
{% set last = None %}
{% set value = namespace(current=None,last=None) %}
{% for period in incomes.periods(periods_number) %}
{% set current = incomes.balance(period=period) %}
{% set value.current = incomes.balance(period=period) %}
{% include "inc/value-percent.html" %}
{% set last = current %}
{% set value.last = value.current %}
{% endfor %}
</tr>
</table>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment