fix number format

This commit is contained in:
2025-12-25 11:39:03 +01:00
parent 4d18d1f0a8
commit 3c571bd4f9

19
test_data/templates/invoice.html Normal file → Executable file
View File

@@ -146,6 +146,9 @@
</head> </head>
<body> <body>
{% macro format_number_de(value) -%}
{{ "{:,.2f}".format(value|float).replace(",", "X").replace(".", ",").replace("X", ".") }}
{%- endmacro %}
<!-- Content for Static Frame 'header_frame' --> <!-- Content for Static Frame 'header_frame' -->
<div id="address_frame_content"> <div id="address_frame_content">
<p class="underline small center">{{ envelope.AddressContent.AddressBoxSender }}</p> <p class="underline small center">{{ envelope.AddressContent.AddressBoxSender }}</p>
@@ -190,10 +193,10 @@
{% for position in invoice.Positions %} {% for position in invoice.Positions %}
<tr> <tr>
<td class="links position_top">{{ position.Title }}</td> <td class="links position_top">{{ position.Title }}</td>
<td class="rechts" rowspan="2">{{ format_float(position.Quantity | float) }}</td> <td class="rechts" rowspan="2">{{ format_number_de(position.Quantity) }}</td>
<td class="rechts" rowspan="2">{{ format_float((position.PricePerUnit or invoice.PricePerUnit) | float) }} <td class="rechts" rowspan="2">{{ format_number_de(position.PricePerUnit or invoice.PricePerUnit) }}
</td> </td>
<td class="rechts" rowspan="2">{{ format_float(position.Quantity * ( position.PricePerUnit or <td class="rechts" rowspan="2">{{ format_number_de(position.Quantity * ( position.PricePerUnit or
invoice.PricePerUnit ))}} invoice.PricePerUnit ))}}
</td> </td>
</tr> </tr>
@@ -204,17 +207,17 @@
<tr class="summe"> <tr class="summe">
<td></td> <td></td>
<td colspan="2" class="rechts">Nettosumme:</td> <td colspan="2" class="rechts">Nettosumme:</td>
<td class="rechts">{{ format_float(calculate_total(invoice)) }}</td> <td class="rechts">{{ format_number_de(calculate_total(invoice)) }}</td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td colspan="2" class="rechts">USt. ({{ format_float(invoice.Vat) }}%):</td> <td colspan="2" class="rechts">USt. ({{ format_number_de(invoice.Vat) }}%):</td>
<td class="rechts">{{ format_float(calculate_total(invoice) * ((invoice.Vat / 100))) }}</td> <td class="rechts">{{ format_number_de(calculate_total(invoice) * ((invoice.Vat / 100))) }}</td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td colspan="2" class="rechts bold overline">Gesamt Summe:</td> <td colspan="2" class="rechts bold overline">Gesamt Summe:</td>
<td class="rechts bold overline">{{ format_float(calculate_total(invoice) * ((invoice.Vat / 100)+1)) }}</td> <td class="rechts bold overline">{{ format_number_de(calculate_total(invoice) * ((invoice.Vat / 100)+1)) }}</td>
</tr> </tr>
</table> </table>
</section> </section>
@@ -224,4 +227,4 @@
add_days(invoice.DueDate)).strftime('%d. %B %Y')) }}</p> add_days(invoice.DueDate)).strftime('%d. %B %Y')) }}</p>
</section> </section>
</body> </body>
</html> </html>