From ea624ba3cb80cd6c68bc6456951c77b280eaa785 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Tue, 7 Oct 2025 12:03:31 +0200 Subject: [PATCH] Fix balancing entry account codes for proper VAT accounting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - If difference < 0 (more credits): Use 4456700 (TVA à payer) on debit side - If difference > 0 (more debits): Use 4455100 (TVA à recevoir) on credit side - Each account gets its real label from chart of accounts - Proper French VAT accounting logic for balancing entries --- core/class/declarationtva_pdf.class.php | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 2cd8e57..39d5f72 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -2073,23 +2073,24 @@ class DeclarationTVA_PDF return null; } - // Get real account description for 4456700 - $account_label = $this->getAccountLabel('4456700'); - - $entry = array( - 'account_code' => '4456700', - 'account_label' => $account_label, - 'entry_label' => $declaration->declaration_name, - 'debit' => '', - 'credit' => '' - ); - if ($difference < 0) { - // More credits than debits, add debit to balance - $entry['debit'] = $this->formatAmount(round(abs($difference))); + // More credits than debits, add debit to balance (TVA à payer) + $entry = array( + 'account_code' => '4456700', + 'account_label' => $this->getAccountLabel('4456700'), + 'entry_label' => $declaration->declaration_name, + 'debit' => $this->formatAmount(round(abs($difference))), + 'credit' => '' + ); } else { - // More debits than credits, add credit to balance - $entry['credit'] = $this->formatAmount(round($difference)); + // More debits than credits, add credit to balance (TVA à recevoir) + $entry = array( + 'account_code' => '4455100', + 'account_label' => $this->getAccountLabel('4455100'), + 'entry_label' => $declaration->declaration_name, + 'debit' => '', + 'credit' => $this->formatAmount(round($difference)) + ); } return $entry;