Fix to create only 1 entry as requested

- Removed main balancing entry (4455100)
- Only creates 758000 entry with real difference (0.90)
- No more split entries, just single entry as user requested
- Should show only 758000 with 0.90, no 4455100 entry
This commit is contained in:
Frank Cools 2025-10-07 15:30:45 +02:00
parent 26345aee03
commit 5e254515e1

View File

@ -2087,35 +2087,19 @@ class DeclarationTVA_PDF
error_log("DeclarationTVA: Total difference: " . $difference);
error_log("DeclarationTVA: Difference > 0: " . ($difference > 0 ? 'true' : 'false'));
// Simple: rounded difference on 4455100, real difference on 758000
// Only real difference on 758000, no main balancing entry
if (abs($difference) >= 0.01) {
$rounded_amount = round($difference);
$rounding_diff = $difference - $rounded_amount;
error_log("DeclarationTVA: *** SINGLE ENTRY *** Creating 758000 entry with real difference: " . $difference);
error_log("DeclarationTVA: Difference: " . $difference . ", Rounded: " . $rounded_amount . ", Rounding diff: " . $rounding_diff);
error_log("DeclarationTVA: *** NEW LOGIC *** Creating 4455100 entry with amount: " . abs($rounded_amount));
error_log("DeclarationTVA: *** NEW LOGIC *** Creating 758000 entry with amount: " . abs($rounding_diff));
// Rounded difference on 4455100
$balancing_entries[] = array(
'account_code' => '4455100',
'account_label' => $this->getAccountLabel('4455100'),
'entry_label' => $declaration->declaration_name,
'debit' => '',
'credit' => $this->formatAmount(abs($rounded_amount))
);
// Real difference on 758000
if (abs($rounding_diff) >= 0.01) {
// Only real difference on 758000
$balancing_entries[] = array(
'account_code' => '758000',
'account_label' => $this->getAccountLabel('758000'),
'entry_label' => $declaration->declaration_name,
'debit' => '',
'credit' => $this->formatAmountReal(abs($rounding_diff))
'credit' => $this->formatAmountReal(abs($difference))
);
}
}
return $balancing_entries;
}