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(