diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 8c5a557..1d3840e 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -2129,6 +2129,30 @@ class DeclarationTVA_PDF ); } } + } else { + // If rounded difference is 0, but real difference is not 0, create rounding entry only + if (abs($difference) >= 0.01) { + error_log("DeclarationTVA: Creating rounding-only entry for " . $difference); + if ($difference > 0) { + // Credit difference - rounding goes to 658000 debit + $balancing_entries[] = array( + 'account_code' => '658000', + 'account_label' => $this->getAccountLabel('658000'), + 'entry_label' => $declaration->declaration_name, + 'debit' => $this->formatAmountReal($difference), + 'credit' => '' + ); + } else { + // Debit difference - rounding goes to 758000 credit + $balancing_entries[] = array( + 'account_code' => '758000', + 'account_label' => $this->getAccountLabel('758000'), + 'entry_label' => $declaration->declaration_name, + 'debit' => '', + 'credit' => $this->formatAmountReal(abs($difference)) + ); + } + } } return $balancing_entries;