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);