From 39198df2c38fe9da4e9e436e7b1295a5860b8a96 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Wed, 8 Oct 2025 22:36:26 +0200 Subject: [PATCH] Add database verification to check actual saved values - Query database to see what values are actually saved - Check montant, numero_compte, sens fields in database - Verify if amounts are being saved correctly - Help identify if issue is with saving or display --- core/class/declarationtva.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index 6f68774..46c2edd 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -1349,6 +1349,18 @@ class DeclarationTVA error_log("DEBUG: Final verification - Total entries in database for declaration " . $declaration->declaration_name . ": " . $final_check_obj->total_entries); } + // Check what's actually in the database + $detail_check_sql = "SELECT rowid, doc_date, doc_ref, code_journal, numero_compte, label_compte, montant, sens, fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping + WHERE doc_ref = '" . $this->db->escape($declaration->declaration_name) . "' + ORDER BY rowid DESC LIMIT 5"; + $detail_check_result = $this->db->query($detail_check_sql); + if ($detail_check_result && $this->db->num_rows($detail_check_result) > 0) { + error_log("DEBUG: Recent entries in database:"); + while ($detail_obj = $this->db->fetch_object($detail_check_result)) { + error_log("DEBUG: Entry ID: " . $detail_obj->rowid . ", Account: " . $detail_obj->numero_compte . ", Amount: " . $detail_obj->montant . ", Sens: " . $detail_obj->sens . ", Journal: " . $detail_obj->code_journal); + } + } + // Also check what's actually in the accounting_bookkeeping table $debug_sql = "SELECT doc_ref, numero_compte, montant, sens FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_ref LIKE '%AOUT%' ORDER BY rowid DESC LIMIT 10";