{% set entry_types = ['open', 'close', 'transaction', 'balance', 'note', 'document', 'pad', 'query', 'custom', 'budget'] %} {% set transaction_types = ['cleared', 'pending', 'other'] %} {% set default_show_type = { 'open': config['journal-show-type-open'], 'close': config['journal-show-type-close'], 'transaction': config['journal-show-type-transaction'], 'balance': config['journal-show-type-balance'], 'note': config['journal-show-type-note'], 'document': config['journal-show-type-document'], 'pad': config['journal-show-type-pad'], 'query': config['journal-show-type-query'], 'custom': config['journal-show-type-custom'], 'budget': config['journal-show-type-budget'], 'cleared': config['journal-show-transaction-cleared'], 'pending': config['journal-show-transaction-pending'], 'other': config['journal-show-transaction-other'], 'metadata': config['journal-show-metadata'], 'legs': config['journal-show-legs'], } %} {% if request.args.get('show', False) %} {% set show_type = { 'open': 'open' in request.args.getlist('show'), 'close': 'close' in request.args.getlist('show'), 'transaction': 'transaction' in request.args.getlist('show'), 'balance': 'balance' in request.args.getlist('show'), 'note': 'note' in request.args.getlist('show'), 'document': 'document' in request.args.getlist('show'), 'pad': 'pad' in request.args.getlist('show'), 'query': 'query' in request.args.getlist('show'), 'custom': 'custom' in request.args.getlist('show'), 'budget': 'budget' in request.args.getlist('show'), 'cleared': 'cleared' in request.args.getlist('show'), 'pending': 'pending' in request.args.getlist('show'), 'other': 'other' in request.args.getlist('show'), 'metadata': 'metadata' in request.args.getlist('show'), 'legs': 'legs' in request.args.getlist('show'), } %} {% else %} {% set show_type = { 'open': default_show_type['open'], 'close': default_show_type['close'], 'transaction': default_show_type['transaction'], 'balance': default_show_type['balance'], 'note': default_show_type['note'], 'document': default_show_type['document'], 'pad': default_show_type['pad'], 'query': default_show_type['query'], 'custom': default_show_type['custom'], 'budget': default_show_type['budget'], 'cleared': default_show_type['cleared'], 'pending': default_show_type['pending'], 'other': default_show_type['other'], 'metadata': default_show_type['metadata'], 'legs': default_show_type['legs'], } %} {% endif %} {% set transaction_type_buttons = { 'cleared': ('*', _('Cleared Transactions')), 'pending': ('!', _('Pending Transactions')), 'other': ('x', _('Other Transactions')), } %} {% if show_tablefilter %}
{% for type in entry_types %} {% if type != 'budget' or api.has_budgets() %} {% if type == 'transaction' %} {% for txn_type in transaction_types %} {% endfor %} {% endif %} {% endif %} {% endfor %}
{% endif %} {% set context_url = url_for('context', ehash='REPLACEME') %} {% set account_url = url_for('account_with_journal', name='REPLACEME') %} {% set tag_url = url_for_current(tag=['REPLACEME']+g.filters['tag']) %} {% macro account_link(name) -%} {{ name }} {%- endmacro %} {% macro render_inventory(inv) -%} {% if inv %} {% for currency, number in inv.items() %} {{ number|format_currency(currency) }} {{ currency }}
{% endfor %} {% endif %} {%- endmacro %} {% macro render_metadata(metadata, show_metadata) -%} {% if metadata %}
{% for key, value in metadata.items() %}
{{ key }}
{%- if key == 'statement' %}{% endif -%} {{ value }} {%- if key == 'statement' %}{% endif -%}
{% endfor %}
{% endif %} {%- endmacro %}
  1. {{ _('Date') }} {{ _('F') }} {{ _('Narration/Payee') }} {{ _('Position') }} {{ _('Price') }} {{ _('Cost') }} {% if show_change_and_balance %} {{ _('Change') }} {{ _('Balance') }} {% endif %}

  2. {% for entry in journal %} {% set type = entry.meta.type %}
  3. {{ entry.date }} {{ entry.flag }} {% if type == 'open' %} Open {{ account_link(entry.account) }} {% elif type == 'close' %} Close {{ account_link(entry.account) }} {% elif type == 'note' %} 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' %} Custom {{ entry.type }} {% for value in entry['values'] %}   {%- if value.dtype|string == "" %}{{ account_link(value.value) }}{% endif -%} {%- if value.dtype|string == "" %}{{ value.value.number|format_currency(value.value.currency) }} {{ value.value.currency }}{% endif -%} {%- if value.dtype|string == "" %}"{{ value.value }}"{% endif -%} {%- if value.dtype|string == "" %}{{ value.value }}{% endif -%} {%- if value.dtype|string == "" %}{{ value.value }}{% endif -%} {% endfor %} {% elif type == 'budget' %} {%- if entry.period_type == 'daily' %}Daily{% endif %} {%- if entry.period_type == 'weekly' %}Weekly{% endif %} {%- if entry.period_type == 'monthly' %}Monthly{% endif %} {%- if entry.period_type == 'quarterly' %}Quarterly{% endif %} {%- if entry.period_type == 'yearly' %}Yearly{% endif %} budget for {{ account_link(entry.account) }} {{ entry.value.number|format_currency(entry.value.currency) }} {{ entry.value.currency }} {% elif type == 'document' %} Document for {{ account_link(entry.account) }}: {{ entry.filename|basename }} {% 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 '' }} {% for tag in entry.tags %}#{{ tag }}{% endfor %} {% endif %} {% if type == 'transaction' %} {% for posting in entry.postings %} {% endfor %} {% endif %} {% if show_change_and_balance %} {{ render_inventory(entry.change) }} {{ render_inventory(entry.balance) }}

    {% endif %} {{ render_metadata(entry.metadata, show_type['metadata']) }} {% if entry.postings %} {% endif %}
  4. {% endfor %}