feat: create validated ZUGFeRD invoices in one console command

This commit is contained in:
admin committed 2026-10-16 09:29:08 +02:00
1 parent e0c15fc7f2
commit a643cf5227
30 files changed
+1509 -207

No files matched your search

+9 -7
View File
@@ -1,9 +1,11 @@
from __future__ import annotations
from decimal import Decimal
def number_fmt(value, precision: int = 2) -> str:
value = Decimal(str(value))
precision = max(precision, -value.normalize().as_tuple().exponent)
return f"{value:,.{precision}f}".replace(",", "X").replace(".", ",").replace("X", ".")
def money_fmt(value, currency: str = "EUR") -> str:
try:
v = float(value)
except Exception:
v = 0.0
# de-DE formatting (simple, stable)
return f"{v:,.2f} {currency}".replace(",", "X").replace(".", ",").replace("X", ".")
return f"{Decimal(str(value)):,.2f} {currency}".replace(",", "X").replace(".", ",").replace("X", ".")