PDF: Margins gesetzt (15mm links), Nettobetrag/Summen/Zahlbar starten auf gleicher Hohe wie Tabelle

This commit is contained in:
Erik Thiele
2026-07-02 15:11:15 +02:00
parent 7cc601acf3
commit 2bd4d19034

20
app.py
View File

@@ -197,21 +197,20 @@ def invoice_pdf():
projekt = config.get('projektName', '')
pdf = FPDF()
pdf.set_margins(15, 10, 15)
pdf.add_page()
left = 15
right_margin = 15
col_left = left
col_right = 120
col_w = 80
# --- Header: Absender links, Logo rechts ---
pdf.set_font("Arial", "B", 11)
pdf.set_xy(col_left, 15)
pdf.set_xy(left, 15)
pdf.cell(col_w, 5, firmen_name, ln=True)
pdf.set_font("Arial", "", 9)
if firmen_adresse:
pdf.set_x(col_left)
pdf.set_x(left)
pdf.cell(col_w, 4, firmen_adresse, ln=True)
contact_parts = []
if telefon:
@@ -219,7 +218,7 @@ def invoice_pdf():
if email:
contact_parts.append(f"Mail: {email}")
if contact_parts:
pdf.set_x(col_left)
pdf.set_x(left)
pdf.cell(col_w, 4, " | ".join(contact_parts), ln=True)
# Logo rechts
@@ -291,20 +290,17 @@ def invoice_pdf():
pdf.set_x(left)
pdf.ln(8)
pdf.set_font("Arial", "", 10)
pdf.cell(0, 6, f"Nettobetrag: {gesamt_netto:.2f} EUR", ln=True)
pdf.cell(180, 6, f"Nettobetrag: {gesamt_netto:.2f} EUR", ln=True)
if calc.get('mwst_ausweisen'):
pdf.set_x(left)
pdf.cell(0, 6, f"MwSt. (19%): {gesamt_mwst:.2f} EUR", ln=True)
pdf.cell(180, 6, f"MwSt. (19%): {gesamt_mwst:.2f} EUR", ln=True)
pdf.set_font("Arial", "B", 12)
pdf.set_x(left)
label_total = "GESAMTBETRAG (brutto):" if calc.get('mwst_ausweisen') else "GESAMTBETRAG:"
pdf.cell(0, 8, f"{label_total} {gesamt_brutto:.2f} EUR", ln=True)
pdf.cell(180, 8, f"{label_total} {gesamt_brutto:.2f} EUR", ln=True)
# --- Zahlungsbedingungen ---
pdf.set_font("Arial", "", 9)
pdf.set_x(left)
pdf.ln(6)
pdf.cell(0, 4, "Zahlbar innerhalb von 14 Tagen ohne Abzug. Vielen Dank fur Ihren Auftrag!")
pdf.cell(180, 4, "Zahlbar innerhalb von 14 Tagen ohne Abzug. Vielen Dank fur Ihren Auftrag!")
# --- Footer ---
pdf.set_y(-35)