Fix: Quartalssumme korrekt (alle inkl. Storno), Netto ausgeblendet (SW by-v977)
This commit is contained in:
parent
6104132714
commit
ed6dd8da13
5 changed files with 13 additions and 16 deletions
|
|
@ -467,18 +467,16 @@ def get_quarterly(year: int, q: int, admin=Depends(require_admin)):
|
|||
# Nach Datum sortieren
|
||||
entries.sort(key=lambda e: (e.get("created_at") or ""))
|
||||
|
||||
# Summen: Originalrechnungen positiv + Stornos negativ
|
||||
total_net = sum(e["amount_net"] for e in entries if e["status"] != "cancelled")
|
||||
total_tax = sum(e.get("tax_amount") or 0 for e in entries if e["status"] != "cancelled")
|
||||
total_gross = sum(e["amount_gross"] for e in entries if e["status"] != "cancelled")
|
||||
# Summen: alle Einträge — Storno (-) und Original (+) heben sich gegenseitig auf
|
||||
total_gross = sum(e.get("amount_gross") or 0 for e in entries)
|
||||
total_tax = sum(e.get("tax_amount") or 0 for e in entries)
|
||||
|
||||
return {
|
||||
"period": period,
|
||||
"invoices": entries,
|
||||
"total_net": round(total_net, 2),
|
||||
"total_tax": round(total_tax, 2),
|
||||
"total_gross": round(total_gross, 2),
|
||||
"count": len(entries),
|
||||
"period": period,
|
||||
"invoices": entries,
|
||||
"total_tax": round(total_tax, 2),
|
||||
"total_gross": round(total_gross, 2),
|
||||
"count": len(entries),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue