From c7cfd3e52d2c8bd6ebc6bf618f4fbcc1e55aba50 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Tue, 7 Oct 2025 12:33:05 +0200 Subject: [PATCH] Add debugging to rounding calculation to identify why 1.00 instead of 0.90 - Added error_log statements to track total difference and VAT TD amount - Added logging for remaining difference calculation - Will help identify why rounding entry shows 1.00 instead of 0.90 - Check error logs after generating PDF to see calculation values --- core/class/declarationtva_pdf.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 6866a9a..c06f171 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -2074,6 +2074,10 @@ class DeclarationTVA_PDF // Get VAT amount from line TD (this should be the main balancing amount) $vat_td_amount = $this->getVATAmountFromLineTD($declaration); + // Debug logging + error_log("DeclarationTVA: Total difference: " . $difference); + error_log("DeclarationTVA: VAT TD amount: " . $vat_td_amount); + if ($vat_td_amount > 0) { // Main balancing entry using VAT amount from line TD if ($difference < 0) { @@ -2098,6 +2102,8 @@ class DeclarationTVA_PDF // Rounding entry for the remaining difference (use real value, not rounded) $remaining_diff = abs($difference) - $vat_td_amount; + error_log("DeclarationTVA: Remaining difference: " . $remaining_diff); + if ($remaining_diff >= 0.01) { if ($difference < 0) { $balancing_entries[] = array(