{% extends 'invoice/layout.html.twig' %} {% set fallback = app.request is not null ? app.request.locale : 'en' %} {% set language = model.template.language|default(fallback) %} {% set isDecimal = model.template.decimalDuration|default(false) %} {% set currency = model.currency %} {% block invoice %}
{{ 'invoice.from'|trans({}, 'messages', language) }}
{{ model.template.company }}
{{ model.template.address|trim|nl2br }} {% if model.template.vatId is not empty %}
{{ 'label.vat_id'|trans({}, 'messages', language) }}: {{ model.template.vatId }} {% endif %}
{{ 'invoice.to'|trans({}, 'messages', language) }}
{{ model.customer.company|default(model.customer.name) }}
{{ model.customer.address|nl2br }} {% if model.customer.vatId is not empty %}
{{ 'label.vat_id'|trans({}, 'messages', language) }}: {{ model.customer.vatId }} {% endif %} {% if model.customer.number is not empty %}
{{ 'label.number'|trans({}, 'messages', language) }}: {{ model.customer.number }} {% endif %} {% if model.query.project is not empty and model.query.project.orderNumber is not empty %}
{{ 'label.orderNumber'|trans({}, 'messages', language) }}: {{ model.query.project.orderNumber }} {% endif %}

{{ 'invoice.number'|trans({}, 'messages', language) }}: {{ model.invoiceNumber }}
{{ 'invoice.due_days'|trans({}, 'messages', language) }}: {{ model.dueDate|date_short }}

{% for entry in model.calculator.entries %} {% set duration = entry.duration|duration(isDecimal) %} {% if entry.fixedRate %} {% set rate = entry.fixedRate %} {% set duration = entry.amount|amount %} {% else %} {% set rate = entry.hourlyRate %} {% endif %} {% endfor %}
{{ 'label.date'|trans({}, 'messages', language) }} {{ 'label.description'|trans({}, 'messages', language) }} {{ 'label.unit_price'|trans({}, 'messages', language) }} {{ 'label.amount'|trans({}, 'messages', language) }} {{ 'label.total_rate'|trans({}, 'messages', language) }}
{{ entry.begin|date_short }} {% if entry.description is not empty %} {{ entry.description|nl2br }} {% else %} {% if entry.activity is not null %}{{ entry.activity.name }} / {% endif %}{{ entry.project.name }} {% endif %} {{ rate|money(currency) }} {{ duration }} {{ entry.rate|money(currency) }}
{{ 'invoice.subtotal'|trans({}, 'messages', language) }} {{ model.calculator.subtotal|money(currency) }}
{{ 'invoice.tax'|trans({}, 'messages', language) }} ({{ model.calculator.vat }}%) {{ model.calculator.tax|money(currency) }}
{{ 'invoice.total'|trans({}, 'messages', language) }} {{ model.calculator.total|money(currency) }}
{% if model.template.paymentTerms is not empty %}
{{ model.template.paymentTerms|nl2br|md2html }}
{% endif %}
{% endblock %}