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
This commit is contained in:
Frank Cools 2025-10-07 12:33:05 +02:00
parent e4a940a1b4
commit c7cfd3e52d

View File

@ -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(