{% extends "base.html" %} {% from "_macros.html" import state_badge, pay_badge, list_filters, branch_tag, icon with context %} {% set title = {'out_invoice': 'Customer Invoices', 'out_refund': 'Credit Notes', 'in_invoice': 'Vendor Bills', 'in_refund': 'Vendor Refunds'}[kind] %} {% block title %}{{ t(title) }}{% endblock %} {% block content %}

{{ t(title) }}

{% if can_write %}
{% if kind == 'out_invoice' %}+ {{ t('Advance invoice') }} + {{ t('Proforma') }}{% endif %} + {{ t(info.label) }}
{% endif %}
{% if kind == 'out_invoice' %}
{% for code, lbl in (('', 'All types'), ('standard', 'Tax Invoice'), ('simplified', 'Simplified Tax Invoice'), ('advance', 'Advance Payment Tax Invoice'), ('progress', 'Progress Tax Invoice'), ('debit_note', 'Debit Note'), ('proforma', 'Proforma Invoice')) if code != 'progress' or has('projects') %} {{ t(lbl) }}{% endfor %}
{% endif %}
{% for code, lbl in [('', 'All'), ('not_paid', 'Not paid'), ('partial', 'Partially paid'), ('paid', 'Paid'), ('overdue', 'Overdue')] %} {{ t(lbl) }} {% endfor %}
{% set hidden %}{% if payment %}{% endif %}{% endset %} {{ list_filters(f, ['draft', 'posted', 'cancelled'], hidden) }}
{{ t('Number') }}{{ t('Partner') }}{{ t('Branch') }}{{ t('Date') }}{{ t('Due Date') }} {{ t('Total') }}{{ t('Amount Due') }}{{ t('Status') }}{{ t('Payment') }} {% set ns = namespace(total=0, due=0) %} {% for i in rows %} {% set cur = i.currency or (branches[i.branch_id].currency if i.branch_id in branches else none) %} {{ i.number or t('Draft') }}{% if kind == 'out_invoice' and i.invoice_type not in ('standard', none) %} {{ t(types[i.invoice_type][0]) }}{% endif %}{% if i.files %}{{ icon('clip', 'ic clip') }}{% endif %}{% if i.ref %}
{{ i.ref }}{% endif %} {{ nm({'name_en': i.pname_en, 'name_ar': i.pname_ar}) }} {{ branch_tag(branches, i.branch_id) }} {{ i.date }} {{ i.due_date or '' }} {% if i.overdue %}{{ t('Overdue') }}{% endif %} {{ i.amount_total|money(cur) }} {{ cur }} {{ i.residual|money(cur, true) if i.state == 'posted' else '' }} {{ state_badge(i.state) }}{{ pay_badge(i.pay_state) }} {% else %}{{ t('Nothing yet.') }}{% endfor %}
{% endblock %}