Fix to use TD amount directly without rounding

- TD amount is already rounded (69.00), so no rounding difference needed
- Only creates single entry with TD amount on 4455100
- No more unnecessary rounding calculations
- Should show 4455100 with 69.00 (exact TD amount)
This commit is contained in:
Frank Cools 2025-10-07 15:44:58 +02:00
parent cf3eb9d359
commit ff6350890a

View File

@ -2095,30 +2095,16 @@ class DeclarationTVA_PDF
error_log("DeclarationTVA: Line 16: " . $line_16_amount . ", Line 23: " . $line_23_amount . ", TD: " . $td_amount);
if (abs($td_amount) >= 0.01) {
$rounded_td = round($td_amount);
$rounding_diff = $td_amount - $rounded_td;
error_log("DeclarationTVA: TD amount: " . $td_amount . " (already rounded)");
error_log("DeclarationTVA: TD amount: " . $td_amount . ", Rounded: " . $rounded_td . ", Rounding diff: " . $rounding_diff);
// Main TD amount (rounded) on 4455100
// TD amount is already rounded, so just use it directly
$balancing_entries[] = array(
'account_code' => '4455100',
'account_label' => $this->getAccountLabel('4455100'),
'entry_label' => $declaration->declaration_name,
'debit' => '',
'credit' => $this->formatAmount(abs($rounded_td))
'credit' => $this->formatAmount(abs($td_amount))
);
// Rounding difference on 758000
if (abs($rounding_diff) >= 0.01) {
$balancing_entries[] = array(
'account_code' => '758000',
'account_label' => $this->getAccountLabel('758000'),
'entry_label' => $declaration->declaration_name,
'debit' => '',
'credit' => $this->formatAmountReal(abs($rounding_diff))
);
}
}
return $balancing_entries;