diff --git a/app.py b/app.py index eef3640..a59b588 100644 --- a/app.py +++ b/app.py @@ -30,6 +30,7 @@ DEFAULT_VALUES = { 'arbeitszeit': 0, 'stundenlohn': 25, 'gewinnmarge': 20, + 'stueckzahl': 1, 'rechnungsnummer': '', 'datum': datetime.now().strftime('%Y-%m-%d'), 'dark_mode': False, @@ -153,6 +154,10 @@ def invoice_pdf(): data = request.form config = load_config() calc = calculate(config) + stueckzahl = int(config.get('stueckzahl', 1)) + gesamt_netto = round(calc['verkaufspreis'] * stueckzahl, 2) + gesamt_mwst = round(gesamt_netto * 0.19, 2) + gesamt_brutto = round(gesamt_netto + gesamt_mwst, 2) pdf = FPDF() pdf.add_page() @@ -176,18 +181,18 @@ def invoice_pdf(): pdf.cell(0, 8, "Leistungsbeschreibung:", ln=True) pdf.set_font("Arial", "", 11) pdf.cell(100, 8, f"3D-Druck: {config.get('projektName', '')}") - pdf.cell(30, 8, "1", align='R') + pdf.cell(30, 8, str(stueckzahl), align='R') pdf.cell(30, 8, f"{calc['verkaufspreis']:.2f} EUR", align='R') - pdf.cell(30, 8, f"{calc['verkaufspreis']:.2f} EUR", ln=True, align='R') + pdf.cell(30, 8, f"{gesamt_netto:.2f} EUR", ln=True, align='R') pdf.ln(10) pdf.cell(130, 6, "Nettobetrag:") - pdf.cell(60, 6, f"{calc['verkaufspreis']:.2f} EUR", ln=True, align='R') + pdf.cell(60, 6, f"{gesamt_netto:.2f} EUR", ln=True, align='R') pdf.cell(130, 6, "MwSt. (19%):") - pdf.cell(60, 6, f"{calc['mwst']:.2f} EUR", ln=True, align='R') + pdf.cell(60, 6, f"{gesamt_mwst:.2f} EUR", ln=True, align='R') pdf.set_font("Arial", "B", 12) pdf.cell(130, 8, "GESAMTBETRAG:") - pdf.cell(60, 8, f"{calc['gesamt_brutto']:.2f} EUR", ln=True, align='R') + pdf.cell(60, 8, f"{gesamt_brutto:.2f} EUR", ln=True, align='R') pdf.ln(10) pdf.set_font("Arial", "", 10) diff --git a/templates/index.html b/templates/index.html index bc5d6d9..338d429 100644 --- a/templates/index.html +++ b/templates/index.html @@ -115,10 +115,14 @@
Gewinnmarge
-
+
+
+ + +
diff --git a/templates/invoice.html b/templates/invoice.html index 4464193..70cead7 100644 --- a/templates/invoice.html +++ b/templates/invoice.html @@ -64,18 +64,22 @@
Vorschau
+ {% set stueckzahl = config.stueckzahl|default(1)|int %} + {% set gesamt_netto = (calc.verkaufspreis * stueckzahl)|round(2) %} + {% set gesamt_mwst = (gesamt_netto * 0.19)|round(2) %} + {% set gesamt_brutto = (gesamt_netto + gesamt_mwst)|round(2) %}
LEISTUNGSBESCHREIBUNG: {{ '\u2500' * 50 }} Position: 3D-Druck - {{ config.projektName }} -Menge: 1 +Menge: {{ stueckzahl }} Einzelpreis: {{ "%.2f"|format(calc.verkaufspreis) }} EUR -Gesamt: {{ "%.2f"|format(calc.verkaufspreis) }} EUR +Gesamt: {{ "%.2f"|format(gesamt_netto) }} EUR {{ '\u2500' * 50 }} -Nettobetrag: {{ "%.2f"|format(calc.verkaufspreis) }} EUR -MwSt. (19%): {{ "%.2f"|format(calc.mwst) }} EUR +Nettobetrag: {{ "%.2f"|format(gesamt_netto) }} EUR +MwSt. (19%): {{ "%.2f"|format(gesamt_mwst) }} EUR {{ '\u2550' * 50 }} -GESAMTBETRAG: {{ "%.2f"|format(calc.gesamt_brutto) }} EUR +GESAMTBETRAG: {{ "%.2f"|format(gesamt_brutto) }} EUR Zahlbar innerhalb von 14 Tagen ohne Abzug. Vielen Dank fur Ihren Auftrag!