fix number format

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

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

@@ -146,6 +146,9 @@
</head>
<body>
{% macro format_number_de(value) -%}
{{ "{:,.2f}".format(value|float).replace(",", "X").replace(".", ",").replace("X", ".") }}
{%- endmacro %}
<!-- Content for Static Frame 'header_frame' -->
<div id="address_frame_content">
<p class="underline small center">{{ envelope.AddressContent.AddressBoxSender }}</p>
@@ -190,10 +193,10 @@
{% for position in invoice.Positions %}
<tr>
<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_float((position.PricePerUnit or invoice.PricePerUnit) | float) }}
<td class="rechts" rowspan="2">{{ format_number_de(position.Quantity) }}</td>
<td class="rechts" rowspan="2">{{ format_number_de(position.PricePerUnit or invoice.PricePerUnit) }}
</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 ))}}
</td>
</tr>
@@ -204,17 +207,17 @@
<tr class="summe">
<td></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>
<td></td>
<td colspan="2" class="rechts">USt. ({{ format_float(invoice.Vat) }}%):</td>
<td class="rechts">{{ format_float(calculate_total(invoice) * ((invoice.Vat / 100))) }}</td>
<td colspan="2" class="rechts">USt. ({{ format_number_de(invoice.Vat) }}%):</td>
<td class="rechts">{{ format_number_de(calculate_total(invoice) * ((invoice.Vat / 100))) }}</td>
</tr>
<tr>
<td></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>
</table>
</section>