" %}
| {% for position in value|sort(attribute='units.currency') %}
    {{ commodity_macros.render_amount(ledger, position.units) }} {% elif type == "" %}{% endfor %}
 | {% if name == "account" %}
    {{ account_macros.account_name(ledger, value) }}
  {% elif name == "id" %}
  {{ value }}
  {% else %}
  {{ value }}
  {% endif %}{% elif type == "" or type == "" %} | {{ value|format_currency }}{% elif type == "" %} | {{ commodity_macros.render_amount(ledger, value) }}{% elif type == "" %} | {{ value|upper }}{% elif type == "" %} | {{ value }}{% elif type == "" %} | {{ value|join(',') }}{% elif type == "" %} | {{ value or '' }}{% elif type == "" %} | {{ commodity_macros.render_amount(ledger, value.units) }}{% else %} | {{ value }}{% endif %}
{% endmacro %}
{% macro querytable(ledger, contents, types, rows, filter_empty=None, footer=None) %}
{% if contents %} | {{ contents }}
{% elif types %}
  
    
      {% for name, type in types %}
      | {{ name }}{% endfor %} | 
  
  
    {% for row in rows if filter_empty == None or not row[filter_empty].is_empty() %}
    
      {% for name, type in types %}
      {{ querycell(ledger, name, row[name], type)  }}
      {% endfor %}
    
    {% endfor %}
  
  {% if footer %}
  
    
      {% for type, value in footer %}
        {{ querycell(ledger, '', value, type)  }}
      {% endfor %}
    
  
  {% endif %}
{% endif %}
{% endmacro %}
{% macro download_links(query) -%}
  
    ({{ _('Download as') }}
    CSV{% if config['HAVE_EXCEL'] %},
      XLS,
      XLSX, or
      ODS
    {% endif %})
  
{%- endmacro %}