fix(buchhaltung): show Übersicht tab first and count all booked transactions in budget overview
This commit is contained in:
@@ -496,10 +496,11 @@ async function getKontenTree(haushaltsjahrId: number) {
|
||||
kt.bezeichnung as konto_typ_bezeichnung, kt.art as konto_typ_art,
|
||||
pk.bezeichnung AS parent_bezeichnung,
|
||||
k.kategorie_id, kat.bezeichnung AS kategorie_bezeichnung,
|
||||
COALESCE(SUM(CASE WHEN t.typ='ausgabe' AND t.ausgaben_typ='gwg' AND t.status='gebucht' THEN t.betrag ELSE 0 END), 0) AS spent_gwg,
|
||||
COALESCE(SUM(CASE WHEN t.typ='ausgabe' AND t.ausgaben_typ='anlagen' AND t.status='gebucht' THEN t.betrag ELSE 0 END), 0) AS spent_anlagen,
|
||||
COALESCE(SUM(CASE WHEN t.typ='ausgabe' AND t.ausgaben_typ='instandhaltung' AND t.status='gebucht' THEN t.betrag ELSE 0 END), 0) AS spent_instandhaltung,
|
||||
COALESCE(SUM(CASE WHEN t.typ='einnahme' AND t.status='gebucht' THEN t.betrag ELSE 0 END), 0) AS einnahmen_betrag
|
||||
COALESCE(SUM(CASE WHEN t.typ='ausgabe' AND t.ausgaben_typ='gwg' AND t.status IN ('gebucht','freigegeben') THEN t.betrag ELSE 0 END), 0) AS spent_gwg,
|
||||
COALESCE(SUM(CASE WHEN t.typ='ausgabe' AND t.ausgaben_typ='anlagen' AND t.status IN ('gebucht','freigegeben') THEN t.betrag ELSE 0 END), 0) AS spent_anlagen,
|
||||
COALESCE(SUM(CASE WHEN t.typ='ausgabe' AND t.ausgaben_typ='instandhaltung' AND t.status IN ('gebucht','freigegeben') THEN t.betrag ELSE 0 END), 0) AS spent_instandhaltung,
|
||||
COALESCE(SUM(CASE WHEN t.typ='ausgabe' AND t.status IN ('gebucht','freigegeben') THEN t.betrag ELSE 0 END), 0) AS spent_gesamt,
|
||||
COALESCE(SUM(CASE WHEN t.typ='einnahme' AND t.status IN ('gebucht','freigegeben') THEN t.betrag ELSE 0 END), 0) AS einnahmen_betrag
|
||||
FROM buchhaltung_konten k
|
||||
LEFT JOIN buchhaltung_konto_typen kt ON k.konto_typ_id = kt.id
|
||||
LEFT JOIN buchhaltung_konten pk ON pk.id = k.parent_id
|
||||
|
||||
Reference in New Issue
Block a user