{% if settings.has_logo() %} {% set logo_path = settings.get_logo_path() %} {% if logo_path %} {# Base64 encode the logo for reliable PDF embedding #} {% set logo_data = get_logo_base64(logo_path) %} {% if logo_data %} {% else %} {# Fallback to file URI if base64 fails #} {% endif %} {% endif %} {% endif %}

{{ settings.company_name|e }}

{{ settings.company_address|e|replace('\n', '
')|safe }}
{{ _('Email') }}: {{ settings.company_email|e }} ยท {{ _('Phone') }}: {{ settings.company_phone|e }} {{ _('Website') }}: {{ settings.company_website|e }} {% if settings.company_tax_id %}
{{ _('Tax ID') }}: {{ settings.company_tax_id|e }}
{% endif %}
{{ _('INVOICE') }}
{{ _('Invoice #') }}
{{ invoice.invoice_number }}
{{ _('Issue Date') }}
{{ format_date(invoice.issue_date) }}
{{ _('Due Date') }}
{{ format_date(invoice.due_date) }}
{{ _('Status') }}
{{ _(invoice.status|title) }}
{{ _('Bill To') }}
{{ invoice.client_name|e }}
{% if invoice.client_email %}
{{ invoice.client_email|e }}
{% endif %} {% if invoice.client_address %}
{{ invoice.client_address|e }}
{% endif %}
{{ _('Project') }}
{{ invoice.project.name|e }}
{% if invoice.project.description %}
{{ invoice.project.description|e }}
{% endif %}
{% for item in invoice.items %} {% endfor %} {% for expense in invoice.expenses %} {% endfor %} {% for good in invoice.extra_goods %} {% endfor %} {% if invoice.tax_rate > 0 %} {% endif %}
{{ _('Description') }} {{ _('Quantity (Hours)') }} {{ _('Unit Price') }} {{ _('Total Amount') }}
{{ item.description|e }} {% if item.time_entry_ids %} {% set count = item.time_entry_ids.split(',')|length %}
{% endif %}
{{ '%.2f' % item.quantity }} {{ format_money(item.unit_price) }} {{ format_money(item.total_amount) }}
{{ expense.title|e }} {% if expense.description %}
{{ expense.description|e }} {% endif %} {% if expense.category %}
{{ _('Expense') }}: {{ expense.category|title|e }} {% endif %} {% if expense.vendor %}
{{ _('Vendor') }}: {{ expense.vendor|e }} {% endif %} {% if expense.expense_date %}
{{ _('Date') }}: {{ expense.expense_date.strftime('%Y-%m-%d') }} {% endif %}
1 {{ format_money(expense.total_amount) }} {{ format_money(expense.total_amount) }}
{{ good.name|e }} {% if good.description %}
{{ good.description|e }} {% endif %} {% if good.sku %}
{{ _('SKU') }}: {{ good.sku|e }} {% endif %} {% if good.category %}
{{ _('Category') }}: {{ good.category|title|e }} {% endif %}
{{ '%.2f' % good.quantity }} {{ format_money(good.unit_price) }} {{ format_money(good.total_amount) }}
{{ _('Subtotal:') }} {{ format_money(invoice.subtotal) }}
{{ _('Tax (%(rate).2f%%):', rate=invoice.tax_rate) }} {{ format_money(invoice.tax_amount) }}
{{ _('Total Amount:') }} {{ format_money(invoice.total_amount) }}
{% if invoice.notes or invoice.terms %}
{% if invoice.notes %}

{{ _('Notes:') }}

{{ invoice.notes|e }}

{% endif %} {% if invoice.terms %}

{{ _('Terms:') }}

{{ invoice.terms|e }}

{% endif %}
{% endif %}