Files
BlackMarkandClaude Opus 5.5 45424e6fd6 Vermietungs-Tool
A local web app for a small room-rental business in Austria: guest register,
room ledger, occupancy plan, invoices, the monthly tourist-tax report and the
quarterly VAT list. Application code only; it ships no data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 16:52:27 +01:00

46 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""German number/currency formatting for display (1.234,56 €)."""
from app import i18n
def de_number(value, decimals=2):
if value is None or value == "":
return ""
formatted = f"{float(value):,.{decimals}f}" # 1,234.56
return formatted.replace(",", "\x00").replace(".", ",").replace("\x00", ".")
def euro(value):
if value is None or value == "":
return ""
return f"{de_number(value)} €"
WEEKDAYS = i18n.t("weekdays_short")
def de_date_wd(iso):
"""'Mo 13.09.2026' — the weekday before the date, so the lists show at once which day an arrival or
departure falls on (weekly prices run from weekday to weekday)."""
import datetime
text = de_date(iso)
if not text:
return text
try:
day = datetime.date.fromisoformat(str(iso)[:10])
except ValueError:
return text # not a real date (a month name or the like) — leave it as it is
# a non-breaking space: on paper the table would otherwise break between weekday and date
# ("So" on one line, "13.09.2026" on the next)
return f"{WEEKDAYS[day.weekday()]} {text}"
def de_date(iso):
"""ISO yyyy-mm-dd -> German dd.mm.yyyy for display."""
if not iso:
return ""
try:
y, m, d = str(iso).split("-")
return f"{d}.{m}.{y}"
except ValueError:
return str(iso)