{% extends "base.html" %} {% from 'components/ui.html' import page_header %} {% block content %} {% set actions %}
Edit
{{ _('Export PDF') }}
{% if peppol_enabled %} {% endif %} {% if peppol_recipient_ready and (invoices_peppol_compliant or peppol_enabled) %} {{ _('Download UBL') }} {% endif %} {% if invoice.status != 'paid' and invoice.status != 'cancelled' %} {{ _('Pay Online') }} {% endif %} {{ _('Record Payment') }}
{% endset %} {{ page_header('fas fa-file-invoice', 'Invoice ' ~ invoice.invoice_number, actions_html=actions, breadcrumbs=[{'text': _('Invoices'), 'url': url_for('invoices.list_invoices')}, {'text': invoice.invoice_number or _('View Invoice')}]) }}

Client

{{ invoice.client_name }}

{{ invoice.client_email }}

{{ invoice.client_address }}

Details

Issue Date: {{ invoice.issue_date|format_date }}

Due Date: {{ invoice.due_date|format_date }}

Status: {{ invoice.status }}

{% if invoice.payment_reference %}

{{ _('Payment Reference') }}: {% set link_template = link_templates_by_field.get('payment_reference') if link_templates_by_field else None %} {% if link_template %} {% set rendered_url = link_template.render_url(invoice.payment_reference) %} {% if rendered_url %} {{ invoice.payment_reference }} {% else %} {{ invoice.payment_reference }} {% endif %} {% elif invoice.payment_reference is string and (invoice.payment_reference.startswith('http://') or invoice.payment_reference.startswith('https://')) %} {{ invoice.payment_reference }} {% elif invoice.payment_reference is string and invoice.payment_reference.startswith('www.') %} {{ invoice.payment_reference }} {% else %} {{ invoice.payment_reference }} {% endif %}

{% endif %} {% if invoice.approvals %} {% set latest_approval = invoice.approvals|sort(attribute='created_at', reverse=true)|first %} {% if latest_approval %}

{{ _('Approval Status') }}: {{ latest_approval.status|title }}

{% endif %} {% endif %}
{% if peppol_compliance_warnings %}

{{ _('PEPPOL compliance: the following are missing') }}

{% endif %} {% if invoice.status == 'draft' and (current_user.is_admin or has_permission('create_invoices')) %}

{{ _('Invoice Approval') }}

{{ _('Request approval before sending this invoice to the client.') }}

{% if not invoice.approvals or (invoice.approvals|selectattr('status', 'equalto', 'pending')|list|length == 0) %} {{ _('Request Approval') }} {% endif %}
{% endif %}

Items

{% for item in invoice.items %} {% endfor %}
Description Quantity Unit Price Total
{{ item.description }} {{ "%.2f"|format(item.quantity) }} {{ "%.2f"|format(item.unit_price) }} {{ invoice.currency_code }} {{ "%.2f"|format(item.total_amount) }} {{ invoice.currency_code }}
{% if invoice.expenses.count() > 0 %}

Expenses

{% for expense in invoice.expenses %} {% endfor %}
Title Description Category Date Vendor Amount
{{ expense.title }} {{ expense.description or '-' }} {{ expense.category|capitalize }} {{ expense.expense_date|format_date if expense.expense_date else '-' }} {{ expense.vendor or '-' }} {{ "%.2f"|format(expense.total_amount) }} {{ expense.currency_code }}
{% endif %} {% if invoice.extra_goods.count() > 0 %}

{{ _('Extra Goods') }}

{% for good in invoice.extra_goods %} {% endfor %}
Name Description Category Quantity Unit Price Total
{{ good.name }} {{ good.description or '-' }} {{ good.category|capitalize }} {{ "%.2f"|format(good.quantity) }} {{ "%.2f"|format(good.unit_price) }} {{ invoice.currency_code }} {{ "%.2f"|format(good.total_amount) }} {{ invoice.currency_code }}
{% endif %}
Subtotal {{ "%.2f"|format(invoice.subtotal) }} {{ invoice.currency_code }}
Tax ({{ "%.2f"|format(invoice.tax_rate) }}%) {{ "%.2f"|format(invoice.tax_amount) }} {{ invoice.currency_code }}
Total {{ "%.2f"|format(invoice.total_amount) }} {{ invoice.currency_code }}
Amount Paid {{ "%.2f"|format(invoice.amount_paid or 0) }} {{ invoice.currency_code }}
Outstanding {{ "%.2f"|format(invoice.outstanding_amount) }} {{ invoice.currency_code }}
{% if invoice.payments.count() > 0 %}

{{ _('Payment History') }}

Add Payment
{% for payment in invoice.sorted_payments %} {% endfor %}
Date Amount Method Reference Status Actions
{{ payment.payment_date|format_date if payment.payment_date else 'N/A' }} {{ "%.2f"|format(payment.amount) }} {{ payment.currency or invoice.currency_code }} {% if payment.gateway_fee %} (Fee: {{ "%.2f"|format(payment.gateway_fee) }}) {% endif %} {{ payment.method or 'N/A' }} {% if payment.reference %} {% set link_template = link_templates_by_field.get('payment_reference') if link_templates_by_field else None %} {% if link_template %} {% set rendered_url = link_template.render_url(payment.reference) %} {% if rendered_url %} {{ payment.reference }} {% else %} {{ payment.reference }} {% endif %} {% elif payment.reference is string and (payment.reference.startswith('http://') or payment.reference.startswith('https://')) %} {{ payment.reference }} {% elif payment.reference is string and payment.reference.startswith('www.') %} {{ payment.reference }} {% else %} {{ payment.reference }} {% endif %} {% else %} — {% endif %} {% if payment.status == 'completed' %} Completed {% elif payment.status == 'pending' %} Pending {% elif payment.status == 'failed' %} Failed {% elif payment.status == 'refunded' %} Refunded {% endif %} View
{% else %}

{{ _('Payment History') }}

Record First Payment

No payments recorded yet.

{% endif %}
{% if email_history|length > 0 %}

Email History

{% for email in email_history %} {% if email.error_message %} {% endif %} {% endfor %}
Sent At Recipient Status Subject Actions
{{ email.sent_at|user_datetime if email.sent_at else 'N/A' }} {{ email.recipient_email }} {{ email.status|title }} {{ email.subject }}
Error: {{ email.error_message }}
{% endif %} {% if peppol_history is defined and peppol_history|length > 0 %}

Peppol History

{% for tx in peppol_history %} {% endfor %}
Created Status Recipient Message ID Error
{{ tx.created_at|user_datetime if tx.created_at else 'N/A' }} {{ tx.status|title }} {{ (tx.recipient_scheme_id or '') ~ ':' ~ (tx.recipient_endpoint_id or '') }} {{ tx.message_id or '—' }} {{ tx.error_message or '—' }}
{% endif %} {% endblock %}