{% if link %} {% set entry_types = ['transaction', 'document'] %} {% else %} {% set entry_types = ['open', 'close', 'transaction', 'balance', 'note', 'document', 'pad', 'query', 'custom', 'budget'] %} {% endif %} {% set transaction_types = ['cleared', 'pending', 'other'] %} {% set flags_to_types = {'*': 'cleared', '!': 'pending'} %} {% set document_types = ['discovered', 'statement'] %} {% set default_show_type = { 'open': 'open' in config['journal-show'], 'close': 'close' in config['journal-show'], 'balance': 'balance' in config['journal-show'], 'note': 'note' in config['journal-show'], 'pad': 'pad' in config['journal-show'], 'query': 'query' in config['journal-show'], 'custom': 'custom' in config['journal-show'], 'budget': 'budget' in config['journal-show'], 'transaction': 'transaction' in config['journal-show'], 'cleared': 'cleared' in config['journal-show-transaction'], 'pending': 'pending' in config['journal-show-transaction'], 'other': 'other' in config['journal-show-transaction'], 'document': 'document' in config['journal-show'], 'discovered': 'discovered' in config['journal-show-document'], 'statement': 'statement' in config['journal-show-document'], 'metadata': 'metadata' in config['journal-show'], 'postings': 'postings' in config['journal-show'], } %} {% if request.args.get('show', False) %} {% set _list = request.args.getlist('show') %} {% set show_type = { 'open': 'open' in _list, 'close': 'close' in _list, 'balance': 'balance' in _list, 'note': 'note' in _list, 'pad': 'pad' in _list, 'query': 'query' in _list, 'custom': 'custom' in _list, 'budget': 'budget' in _list, 'transaction': 'transaction' in _list, 'cleared': 'cleared' in _list, 'pending': 'pending' in _list, 'other': 'other' in _list, 'document': 'document' in _list, 'discovered': 'discovered' in _list, 'statement': 'statement' in _list, 'metadata': 'metadata' in _list, 'postings': 'postings' in _list, } %} {% else %} {% set show_type = default_show_type %} {% endif %} {% set transaction_type_buttons = { 'cleared': ('*', _('Cleared Transactions')), 'pending': ('!', _('Pending Transactions')), 'other': ('x', _('Other Transactions')), } %} {% set document_type_buttons = { 'discovered': ('D', _('Documents discovered by beancount')), 'statement': ('S', _('Statements from metadata')) } %}
{% for type in entry_types %} {% if type != 'budget' or api.budgets %} {% if type == 'transaction' %} {% for txn_type in transaction_types %} {% endfor %} {% endif %} {% if type == 'document' %} {% for doc_type in document_types %} {% endfor %} {% endif %} {% endif %} {% endfor %}
{% set context_url = url_for('context', ehash='REPLACEME') %} {% set account_url = url_for('account', name='REPLACEME') %} {% set tag_url = url_for_current(tag='REPLACEME,'+(g.filters['tag'] or '')) %} {% macro account_link(name) -%} {% set levels = name|account_level %} {%- for level in range(0, levels) -%} {% set subaccount_name = name.rsplit(':', maxsplit=levels-loop.index)[0] %} {% set subaccount_part = name.split(':')[level] %} {%- if loop.last -%} {{ subaccount_part }} {%- else -%} {{ subaccount_part }}: {%- endif -%} {%- endfor -%} {%- endmacro %} {% macro render_inventory(inv) -%} {% for pos in inv %} {{ pos.units|format_amount }}
{% endfor %} {%- endmacro %} {% macro render_metadata(metadata, show_metadata, entry=None) -%} {% if metadata %}
{% for key, value in metadata.items() %}
{{ key }}
{%- if key.startswith('statement') %} {% endif -%} {{ value }} {%- if key.startswith('statement') %}{% endif -%}
{% endfor %}
{% endif %} {%- endmacro %} {% macro render_tags_links(entry) -%} {% for tag in entry.tags or [] %}#{{ tag }}{% endfor %} {% for link_ in entry.links or [] %}^{{ link_ }}{% endfor %} {%- endmacro %}
  1. {{ _('Date') }} {{ _('F') }} {{ _('Narration/Payee') }} {{ _('Position') }} {{ _('Price') }} {{ _('Cost') }} {% if show_change_and_balance %} {{ _('Change') }} {{ _('Balance') }} {% endif %}

  2. {% for entry in journal %} {% if show_change_and_balance %} {% set entry, _, change, balance = entry %} {% endif %} {% set type = entry.__class__.__name__.lower() %}
  3. {{ entry.date }} {{ entry.flag }} {% if type == 'open' %} Open {{ account_link(entry.account) }} {% elif type == 'close' %} Close {{ account_link(entry.account) }} {% elif type == 'note' %} {{ entry.comment }} {% elif type == 'query' %} Query: {{ entry.name }} {% elif type == 'pad' %} Pad {{ account_link(entry.account) }} from {{ account_link(entry.source_account) }} {% elif type == 'custom' %} {% if entry.type == 'budget' %} {% set account = entry.values[0].value %} {% set period_type = entry.values[1].value %} {% set value = entry.values[2].value %} {{ period_type|capitalize }} budget for {{ account_link(account) }} {{ value.number|format_currency(value.currency) }} {{ value.currency }} {% else %} Custom {{ entry.type }} {% for value in entry['values'] %}   {%- if value.dtype|string == "" %}{{ account_link(value.value) }}{% endif -%} {%- if value.dtype|string == "" %}{{ value.value|format_amount }}{% endif -%} {%- if value.dtype|string == "" %}"{{ value.value }}"{% endif -%} {%- if value.dtype|string == "" %}{{ value.value }}{% endif -%} {%- if value.dtype|string == "" %}{{ value.value }}{% endif -%} {% endfor %} {% endif %} {% elif type == 'budget' %} {% elif type == 'document' %} Document for {{ account_link(entry.account) }} {{ entry.filename|basename }} {{ render_tags_links(entry) }} {% elif type == 'balance' %} Balance {{ account_link(entry.account) }} {% if entry.diff_amount %} fails; expected = {{ entry.amount|format_amount }} balance = {{ (entry.amount.number + entry.diff_amount.number)|format_currency(entry.amount.currency) }} {{ entry.amount.currency }} difference = {{ entry.diff_amount|format_amount }} {% else %} has {{ entry.amount }} {% endif %} {% elif type == 'transaction' %} {{ entry.payee or '' }}{% if entry.payee and entry.narration %} {% endif %}{{ entry.narration or '' }} {{ render_tags_links(entry) }} {% endif %} {% if type == 'transaction' %} {% for posting in entry.postings %} {% endfor %} {% endif %} {% if show_change_and_balance %} {{ render_inventory(change) }} {{ render_inventory(balance) }}

    {% endif %} {{ render_metadata(entry.meta|remove_keys(['__tolerances__', '__automatic__', 'filename', 'lineno']), show_type['metadata'], entry) }} {% if entry.postings %} {% endif %}
  4. {% endfor %}