From 13ff3b59627efa626aacbe62f30f922e1a86029f Mon Sep 17 00:00:00 2001 From: data Date: Fri, 13 Mar 2026 11:52:46 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Jahresabschluss-Buchungen=20(closure)=20?= =?UTF-8?q?aus=20Kontenauswertung=20ausschlie=C3=9Fen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closure-Einträge (Saldovorträge) wurden fälschlicherweise als echte Buchungsdaten erkannt, was zu negativen Ausgaben und fehlenden Einnahmen führte wenn nur Abschlussbuchungen für ein Jahr existierten. Co-Authored-By: Claude Opus 4.6 --- core/boxes/box_gewinn_verlust.php | 6 +++++- core/boxes/box_rentabilitaet.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/boxes/box_gewinn_verlust.php b/core/boxes/box_gewinn_verlust.php index 6818fe7..d558fd4 100755 --- a/core/boxes/box_gewinn_verlust.php +++ b/core/boxes/box_gewinn_verlust.php @@ -315,6 +315,7 @@ class box_gewinn_verlust extends ModeleBoxes $sql .= " WHERE b.entity = ".((int) $conf->entity); $sql .= " AND YEAR(b.doc_date) = ".((int) $year); $sql .= " AND b.numero_compte LIKE '8%'"; // Erlöskonten + $sql .= " AND b.doc_type != 'closure'"; $sql .= " GROUP BY MONTH(b.doc_date)"; $resql = $this->db->query($sql); @@ -331,6 +332,7 @@ class box_gewinn_verlust extends ModeleBoxes $sql .= " WHERE b.entity = ".((int) $conf->entity); $sql .= " AND YEAR(b.doc_date) = ".((int) $year); $sql .= " AND b.numero_compte LIKE '3%'"; // Wareneinsatz/Materialkosten + $sql .= " AND b.doc_type != 'closure'"; $sql .= " GROUP BY MONTH(b.doc_date)"; $resql = $this->db->query($sql); @@ -381,7 +383,8 @@ class box_gewinn_verlust extends ModeleBoxes } /** - * Check if accounting data exists for the given year + * Check if real accounting data exists for the given year + * Excludes closure/opening balance entries (doc_type = 'closure') */ private function hasAccountingData($year) { @@ -390,6 +393,7 @@ class box_gewinn_verlust extends ModeleBoxes $sql = "SELECT COUNT(*) as cnt FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql .= " WHERE entity = ".((int) $conf->entity); $sql .= " AND YEAR(doc_date) = ".((int) $year); + $sql .= " AND doc_type != 'closure'"; $sql .= " LIMIT 1"; $resql = $this->db->query($sql); diff --git a/core/boxes/box_rentabilitaet.php b/core/boxes/box_rentabilitaet.php index 1e8093a..32ea937 100755 --- a/core/boxes/box_rentabilitaet.php +++ b/core/boxes/box_rentabilitaet.php @@ -326,6 +326,7 @@ class box_rentabilitaet extends ModeleBoxes $sql .= " WHERE b.entity = ".((int) $conf->entity); $sql .= " AND YEAR(b.doc_date) = ".((int) $year); $sql .= " AND b.numero_compte LIKE '8%'"; // Erlöskonten + $sql .= " AND b.doc_type != 'closure'"; $sql .= " GROUP BY MONTH(b.doc_date)"; $resql = $this->db->query($sql); @@ -342,6 +343,7 @@ class box_rentabilitaet extends ModeleBoxes $sql .= " WHERE b.entity = ".((int) $conf->entity); $sql .= " AND YEAR(b.doc_date) = ".((int) $year); $sql .= " AND (b.numero_compte LIKE '3%' OR b.numero_compte LIKE '4%')"; // Wareneinsatz + Betriebskosten + $sql .= " AND b.doc_type != 'closure'"; $sql .= " GROUP BY MONTH(b.doc_date)"; $resql = $this->db->query($sql); @@ -388,7 +390,8 @@ class box_rentabilitaet extends ModeleBoxes } /** - * Check if accounting data exists for the given year + * Check if real accounting data exists for the given year + * Excludes closure/opening balance entries (doc_type = 'closure') */ private function hasAccountingData($year) { @@ -397,6 +400,7 @@ class box_rentabilitaet extends ModeleBoxes $sql = "SELECT COUNT(*) as cnt FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql .= " WHERE entity = ".((int) $conf->entity); $sql .= " AND YEAR(doc_date) = ".((int) $year); + $sql .= " AND doc_type != 'closure'"; $sql .= " LIMIT 1"; $resql = $this->db->query($sql);