* do not traverse into invoice template subdirectories (#3735) * fix security open api definition * fix currency can be null, removed fluent interface * merged release 1.30.3 * allow to pre-fill timesheet metafields via URL * fix api description * added test accounts with simpler names and password * upgrade to Symfony 6.2 * removed FrameworkExtraBundle (by Sensio) and replaced with new native SF annotations * fixed symfony 6.2 deprecations * fixed #3768
179 lines
7.2 KiB
Twig
179 lines
7.2 KiB
Twig
<!DOCTYPE html>
|
||
{%- set fallback = app.request is not null ? app.request.locale : 'en' -%}
|
||
{%- set language = model.template.language|default(fallback) -%}
|
||
{%- set isDecimal = true -%}
|
||
{%- set currency = model.currency -%}
|
||
{%- set project = model.query.project -%}
|
||
<html lang="{{ language }}">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>{% block title %}{{ model.invoiceNumber }}-{{ model.customer.company|default(model.customer.name)|u.snake }}{% endblock %}</title>
|
||
<style>
|
||
{{ encore_entry_css_source('invoice-pdf')|raw }}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<!--mpdf
|
||
<htmlpageheader name="header">
|
||
<table class="header">
|
||
<tr>
|
||
<td class="text-small">
|
||
{{ model.template.company }} – {{ model.template.address|nl2str(' – ') }}
|
||
{% if model.template.vatId is not empty %}
|
||
– {{ 'vat_id'|trans }}: {{ model.template.vatId }}
|
||
{% endif %}
|
||
</td>
|
||
<td class="text-small text-right">
|
||
{{ 'export.page_of'|trans({'%page%': '{PAGENO}', '%pages%': '{nb}'}) }}
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</htmlpageheader>
|
||
<sethtmlpageheader name="header" page="ALL" value="on" show-this-page="1" />
|
||
<htmlpagefooter name="footer">
|
||
<table class="footer text-small">
|
||
<tr>
|
||
<td style="width: 33%">
|
||
<strong>{{ 'address'|trans }}</strong>
|
||
<br>
|
||
{{ model.template.company }}<br>
|
||
{{ model.template.address|nl2br }}
|
||
</td>
|
||
<td class="text-center">
|
||
<strong>{{ 'invoice_bank_account'|trans }}</strong>
|
||
<br>
|
||
{{ model.template.paymentDetails|nl2br }}
|
||
</td>
|
||
<td class="text-right" style="width: 33%">
|
||
<strong>{{ 'contact'|trans }}</strong>
|
||
<br>
|
||
{{ model.template.contact|nl2br }}
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</htmlpagefooter>
|
||
<sethtmlpagefooter page="ALL" value="on" name="footer" show-this-page="1" />
|
||
mpdf-->
|
||
<table class="addresses">
|
||
<tr>
|
||
<td>
|
||
<strong>{{ model.customer.company|default(model.customer.name) }}</strong><br>
|
||
{{ model.customer.address|nl2br }}
|
||
</td>
|
||
<td class="text-right">
|
||
{% set classLeft = 'text-left' %}
|
||
{% set classRight = 'text-right text-nowrap padding-left' %}
|
||
<table style="width: 240px">
|
||
<tr>
|
||
<td class="{{ classLeft }}">{{ 'date'|trans }}</td>
|
||
<td class="{{ classRight }}">{{ model.invoiceDate|date_short }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="{{ classLeft }}">{{ 'invoice.service_date'|trans }}</td>
|
||
<td class="{{ classRight }}">{{ model.query.end|month_name }} {{ model.query.end|date('Y') }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="{{ classLeft }}">{{ 'invoice.number'|trans }}</td>
|
||
<td class="{{ classRight }}">{{ model.invoiceNumber }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="{{ classLeft }}">{{ 'invoice.due_days'|trans }}</td>
|
||
<td class="{{ classRight }}">{{ model.dueDate|date_short }}</td>
|
||
</tr>
|
||
{% if model.customer.number is not empty %}
|
||
<tr>
|
||
<td class="{{ classLeft }}">{{ 'number'|trans }}</td>
|
||
<td class="{{ classRight }}">{{ model.customer.number }}</td>
|
||
</tr>
|
||
{% endif %}
|
||
{% if project is not null and project.orderNumber is not empty %}
|
||
<tr>
|
||
<td class="{{ classLeft }}">{{ 'orderNumber'|trans }}</td>
|
||
<td class="{{ classRight }}">{{ project.orderNumber }}</td>
|
||
</tr>
|
||
{% endif %}
|
||
{% if model.customer.vatId is not empty %}
|
||
<tr>
|
||
<td class="{{ classLeft }}">{{ 'vat_id'|trans }}</td>
|
||
<td class="{{ classRight }}">{{ model.customer.vatId }}</td>
|
||
</tr>
|
||
{% endif %}
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<h2 style="margin-top: 60px">{{ model.template.title }}</h2>
|
||
|
||
{% if model.customer.invoiceText is not empty%}
|
||
<p>{{ model.customer.invoiceText|md2html }}</p>
|
||
{% endif %}
|
||
|
||
<table class="items">
|
||
<thead>
|
||
<tr>
|
||
<th class="first">{{ 'description'|trans }}</th>
|
||
<th class="text-right">{{ 'unit_price'|trans }}</th>
|
||
<th class="text-right">{{ 'amount'|trans }}</th>
|
||
<th class="last text-right">{{ 'total_rate'|trans }}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for entry in model.calculator.entries %}
|
||
<!-- CONTENT_PART -->
|
||
{% set duration = entry.duration|duration(isDecimal) %}
|
||
{% if entry.fixedRate is not null %}
|
||
{% set rate = entry.fixedRate %}
|
||
{% set duration = entry.amount|amount %}
|
||
{% else %}
|
||
{% set rate = entry.hourlyRate %}
|
||
{% endif %}
|
||
|
||
<tr>
|
||
<td class="first">
|
||
{% if entry.description is not empty %}
|
||
{{ entry.description|nl2br }}
|
||
{% else %}
|
||
{% if entry.activity is not null %}{{ entry.activity.name }} / {% endif %}{{ entry.project.name }}
|
||
{% endif %}
|
||
</td>
|
||
<td class="text-right text-nowrap">{{ rate|money(currency) }}</td>
|
||
<td class="text-right text-nowrap">{{ duration }}</td>
|
||
<td class="last text-right text-nowrap">{{ entry.rate|money(currency) }}</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
<tfoot>
|
||
{% if model.calculator.tax > 0 or not model.isHideZeroTax() %}
|
||
<tr>
|
||
<td colspan="3" class="text-right">
|
||
{{ 'invoice.subtotal'|trans }}
|
||
</td>
|
||
<td class="last text-right">{{ model.calculator.subtotal|money(currency) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td colspan="3" class="text-right">
|
||
{{ 'invoice.tax'|trans }} ({{ model.calculator.vat }}%)
|
||
</td>
|
||
<td class="last text-right">{{ model.calculator.tax|money(currency) }}</td>
|
||
</tr>
|
||
{% endif %}
|
||
<tr>
|
||
<td colspan="3" class="text-right text-nowrap">
|
||
<strong>{{ 'invoice.total'|trans }}</strong>
|
||
</td>
|
||
<td class="last text-right">
|
||
<strong>{{ model.calculator.total|money(currency) }}</strong>
|
||
</td>
|
||
</tr>
|
||
</tfoot>
|
||
</table>
|
||
|
||
{% if model.template.paymentTerms is not empty %}
|
||
<p>
|
||
{{ model.template.paymentTerms|md2html }}
|
||
</p>
|
||
{% endif %}
|
||
</body>
|
||
</html>
|