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
This commit is contained in:
Frank Cools 2025-10-08 22:36:26 +02:00
parent 5ace391b5b
commit 39198df2c3

View File

@ -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";