{% macro account_with_children(booking_id, account, indent) %}
- <tr class="alternating">
- <td class="money">
- {% if account.get_wealth(booking_id).moneys|length == 1 %}
- <table>
- {% for curr, amt in account.get_wealth(booking_id).moneys.items() %}
- {{ macros.tr_money_balance(amt, curr) }}
- {% endfor %}
- </table>
- {% else %}
- <details>
- <summary>
- <table>
- {% for curr, amt in account.get_wealth(booking_id).moneys.items() %}
- {% if 1 == loop.index %}
- {{ macros.tr_money_balance(amt, curr) }}
- {% endif %}
- {% endfor %}
- </table>
- </summary>
- <table>
- {% for curr, amt in account.get_wealth(booking_id).moneys.items() %}
- {% if 1 < loop.index %}
+ {% if account.get_wealth(booking_id).moneys|length > 0 %}
+ <tr class="alternating">
+ <td class="money">
+ {% if account.get_wealth(booking_id).moneys|length == 1 %}
+ <table>
+ {% for curr, amt in account.get_wealth(booking_id).moneys.items() %}
{{ macros.tr_money_balance(amt, curr) }}
- {% endif %}
+ {% endfor %}
+ </table>
+ {% else %}
+ <details>
+ <summary>
+ <table>
+ {% for curr, amt in account.get_wealth(booking_id).moneys.items() %}
+ {% if 1 == loop.index %}
+ {{ macros.tr_money_balance(amt, curr) }}
+ {% endif %}
+ {% endfor %}
+ </table>
+ </summary>
+ <table>
+ {% for curr, amt in account.get_wealth(booking_id).moneys.items() %}
+ {% if 1 < loop.index %}
+ {{ macros.tr_money_balance(amt, curr) }}
+ {% endif %}
+ {% endfor %}
+ </table>
+ </details>
+ {% endif %}
+ </td>
+ <td class="acc"><span class="indent">{% for i in range(indent) %} {% endfor %}</span>{% if account.parent %}:{% endif %}{{account.basename}}{% if account.children %}:{% endif %}</td>
+ <td>{{account.desc}}</td>
+ </tr>
+ {% for child in account.children %}
+ {{ account_with_children(booking_id, child, indent=indent+1) }}
{% endfor %}
- </table>
- </details>
{% endif %}
- </td>
- <td class="acc"><span class="indent">{% for i in range(indent) %} {% endfor %}</span>{% if account.parent %}:{% endif %}{{account.basename}}{% if account.children %}:{% endif %}</td>
- <td>{{account.desc}}</td>
- </tr>
- {% for child in account.children %}
- {{ account_with_children(booking_id, child, indent=indent+1) }}
- {% endfor %}
{% endmacro %}