Fix reversed account selection logic
- Debit difference: now uses 4455100 credit (not 4456700) - Credit difference: now uses 4456700 debit (not 4455100) - Rounding accounts also corrected: 758000 for debit diff, 658000 for credit diff - Should now match user examples correctly
This commit is contained in:
parent
43e4072a67
commit
6f742bda84
@ -2082,22 +2082,22 @@ class DeclarationTVA_PDF
|
||||
if ($rounded_difference != 0) {
|
||||
// Main balancing entry with rounded amount
|
||||
if ($difference > 0) {
|
||||
// More credits than debits - need debit entry (4456700)
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '4456700',
|
||||
'account_label' => $this->getAccountLabel('4456700'),
|
||||
'entry_label' => $declaration->declaration_name,
|
||||
'debit' => $this->formatAmount($rounded_difference),
|
||||
'credit' => ''
|
||||
);
|
||||
} else {
|
||||
// More debits than credits - need credit entry (4455100)
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '4455100',
|
||||
'account_label' => $this->getAccountLabel('4455100'),
|
||||
'entry_label' => $declaration->declaration_name,
|
||||
'debit' => '',
|
||||
'credit' => $this->formatAmount($rounded_difference)
|
||||
);
|
||||
} else {
|
||||
// More credits than debits - need debit entry (4456700)
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '4456700',
|
||||
'account_label' => $this->getAccountLabel('4456700'),
|
||||
'entry_label' => $declaration->declaration_name,
|
||||
'debit' => $this->formatAmount(abs($rounded_difference)),
|
||||
'credit' => ''
|
||||
'credit' => $this->formatAmount(abs($rounded_difference))
|
||||
);
|
||||
}
|
||||
|
||||
@ -2106,7 +2106,7 @@ class DeclarationTVA_PDF
|
||||
error_log("DeclarationTVA: Rounding difference: " . $rounding_diff);
|
||||
|
||||
if (abs($rounding_diff) >= 0.01) {
|
||||
if ($difference < 0) {
|
||||
if ($difference > 0) {
|
||||
// Credit difference - rounding goes to 658000 debit
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '658000',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user