Stückzahl-Feld: Formular, Rechnungsvorschau, PDF
This commit is contained in:
15
app.py
15
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)
|
||||
|
||||
Reference in New Issue
Block a user