{% 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 %}
{{ _('QUOTE') }}
{{ _('Quote #') }}
{{ quote.quote_number }}
{{ _('Date') }}
{{ format_date(quote.created_at) if quote.created_at else 'N/A' }}
{% if quote.valid_until %}
{{ _('Valid Until') }}
{{ format_date(quote.valid_until) }}
{% endif %}
{{ _('Status') }}
{{ _(quote.status|title) }}
{{ _('Quote For') }}
{{ quote.client.name|e if quote.client else 'N/A' }}
{% if quote.client and quote.client.email %}
{{ quote.client.email|e }}
{% endif %} {% if quote.client and quote.client.address %}
{{ quote.client.address|e }}
{% endif %}
{{ _('Quote Details') }}
{{ quote.title|e }}
{% if quote.description %}
{{ quote.description|e }}
{% endif %} {% if quote.payment_terms %}
{{ _('Payment Terms') }}: {{ quote.payment_terms|e }}
{% endif %}
{% for item in quote.items %} {% endfor %} {% if quote.discount_value > 0 %} {% endif %} {% if quote.tax_rate > 0 %} {% endif %}
{{ _('Description') }} {{ _('Quantity') }} {{ _('Unit Price') }} {{ _('Total Amount') }}
{{ item.description|e }} {{ '%.2f' % item.quantity }} {% if item.unit %}{{ item.unit }}{% endif %} {{ format_money(item.unit_price) }} {{ format_money(item.total_amount) }}
{{ _('Subtotal:') }} {{ format_money(quote.subtotal) }}
{{ _('Discount') }} {% if quote.discount_type == 'percentage' %} ({{ "%.2f"|format(quote.discount_amount) }}%) {% endif %} {% if quote.coupon_code %} - {{ quote.coupon_code }} {% endif %} -{{ format_money(quote.discount_value) }}
{{ _('Subtotal After Discount:') }} {{ format_money(quote.subtotal_after_discount) }}
{{ _('Tax (%(rate).2f%%):', rate=quote.tax_rate) }} {{ format_money(quote.tax_amount) }}
{{ _('Total Amount:') }} {{ format_money(quote.total_amount) }}
{% if quote.description or quote.terms %}
{% if quote.description %}

{{ _('Description:') }}

{{ quote.description|e }}

{% endif %} {% if quote.terms %}

{{ _('Terms & Conditions:') }}

{{ quote.terms|e }}

{% endif %}
{% endif %}