{% extends "base.html" %} {% block content %}

Invoice {{ invoice.invoice_number }}

Edit
{{ _('Export PDF') }}
{% if invoice.status != 'paid' and invoice.status != 'cancelled' %} {{ _('Pay Online') }} {% endif %} {{ _('Record Payment') }}

Client

{{ invoice.client_name }}

{{ invoice.client_email }}

{{ invoice.client_address }}

Details

Issue Date: {{ invoice.issue_date.strftime('%Y-%m-%d') }}

Due Date: {{ invoice.due_date.strftime('%Y-%m-%d') }}

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 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.strftime('%Y-%m-%d') 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.strftime('%Y-%m-%d') 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.strftime('%Y-%m-%d %H:%M:%S') if email.sent_at else 'N/A' }} {{ email.recipient_email }} {{ email.status|title }} {{ email.subject }}
Error: {{ email.error_message }}
{% endif %} {% endblock %}