{% from 'macros/_commodity_macros.html' import render_num, render_amount %} {% set short_type = { 'balance': 'Bal', 'close': 'Close', 'document': 'Doc', 'note': 'Note', 'open': 'Open', } %} {% macro _account_link(name) %}{{ name }}{% endmacro %} {% macro _render_metadata_indicators(metadata) -%} {% for key, value in metadata %} {% endfor %} {%- endmacro %} {% macro _render_metadata(metadata, entry_hash=None) -%} {% if metadata %}
{% endif %} {% endmacro %} {% macro _render_tags_links(entry) -%} {% for tag in entry.tags|sort %}#{{ tag }}{% endfor %} {% for link_ in entry.links|sort %}^{{ link_ }}{% endfor %} {%- endmacro %} {% macro journal_table_contents(entries, show_change_and_balance=False, ledger=None) %} {% set ledger = ledger or g.ledger %} {% autoescape false %} {% for entry in entries %} {% if show_change_and_balance %} {% set index, entry, change, balance = entry %} {% else %} {% set index, entry = entry %} {% endif %} {% set type = entry.__class__.__name__.lower() %} {% set metadata_items = entry.meta|meta_items %} {% set entry_hash = entry|hash_entry -%}
{{ entry.date }}
{% if type == 'transaction' %}{{ entry.flag }}{% else %}{{ short_type.get(type, type[:3]) }}{% endif %}
{% if type == 'open' or type == 'close' %}
{{ _account_link(entry.account) }}
{% elif type == 'note' %}
{{ entry.comment }}
{% elif type == 'query' %}
{{ entry.name }}
{% elif type == 'pad' %}
{{ _account_link(entry.account) }} from {{ _account_link(entry.source_account) }}
{% elif type == 'custom' %}
{{ entry.type }}
{%- for value in entry['values'] -%}
{% if value.dtype|string == "
{% endfor -%}
{% endif %}
{%- for currency, number in balance.items() %}{{ render_num(ledger, currency, number) }}
{% endfor -%}
{% endif %}
{{ posting.flag or '' }} {{ _account_link(posting.account) }} {# We want the output these amounts with the same precision as in the input file. For computed values this might give a lot of digits, so format the price using the DisplayContext for now.#} {% if posting.units %}{{ posting.units.number|incognito }} {{ posting.units.currency }}{% endif %} {{ posting.cost.number|incognito }} {{ posting.cost.currency }} {{- ', {}'.format(posting.cost.date) if posting.cost.date else '' }} {{- ', "{}"'.format(posting.cost.label) if posting.cost.label else '' }} {{ render_amount(ledger, posting.price) }}
{{ _render_metadata(posting.meta|meta_items) }}