Compare commits

..

2 Commits

Author SHA1 Message Date
3c571bd4f9 fix number format 2025-12-25 11:39:03 +01:00
4d18d1f0a8 Fix Build dependancies 2025-12-25 10:55:56 +01:00
3 changed files with 18 additions and 13 deletions

View File

@@ -15,10 +15,11 @@ classifiers = [
dependencies = [ dependencies = [
'PyYAML', 'PyYAML==6.0.1',
'Jinja2', 'Jinja2==3.1.3',
'xhtml2pdf', 'xhtml2pdf==0.2.15',
'Markdown' 'Markdown==3.5.2',
'python-bidi==0.4.2'
] ]
[build-system] [build-system]

View File

@@ -2,3 +2,4 @@ Jinja2==3.1.3
Markdown==3.5.2 Markdown==3.5.2
PyYAML==6.0.1 PyYAML==6.0.1
xhtml2pdf==0.2.15 xhtml2pdf==0.2.15
python-bidi==0.4.2

17
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>