Filter journal table to show only 445 accounts with real values

- Added filter to show only 445 accounts (VAT accounts) in journal table
- Created formatAmountReal method to display amounts with decimals
- Updated getLine8VATAccounts to filter for 445 accounts and use real values
- Updated getLine20Accounts to filter for 445 accounts and use real values
- Updated VAT result and rounding entries to use real values
- Journal table now shows only VAT accounts with precise amounts
This commit is contained in:
Frank Cools 2025-10-07 11:33:17 +02:00
parent bc953bf5a6
commit ee62f2ea13

View File

@ -457,6 +457,17 @@ class DeclarationTVA_PDF
return number_format($amount, 0, ',', ' '); return number_format($amount, 0, ',', ' ');
} }
/**
* Format amount for display with real values (with decimals)
*
* @param float $amount Amount to format
* @return string Formatted amount with decimals
*/
private function formatAmountReal($amount)
{
return number_format($amount, 2, ',', ' ');
}
/** /**
* Fill a PDF form field by modifying PDF content * Fill a PDF form field by modifying PDF content
* *
@ -1877,12 +1888,13 @@ class DeclarationTVA_PDF
} }
foreach ($line8_details['account_details'] as $account) { foreach ($line8_details['account_details'] as $account) {
if ($account['vat_amount'] > 0) { // Only include 445 accounts (VAT accounts) with non-zero amounts
if (strpos($account['account_code'], '445') === 0 && $account['vat_amount'] > 0) {
$entries[] = array( $entries[] = array(
'account_code' => $account['account_code'], 'account_code' => $account['account_code'],
'account_label' => $account['account_label'], 'account_label' => $account['account_label'],
'entry_label' => 'TVA due - Ligne 08', 'entry_label' => 'TVA due - Ligne 08',
'debit' => $this->formatAmount($account['vat_amount']), 'debit' => $this->formatAmountReal($account['vat_amount']),
'credit' => '' 'credit' => ''
); );
} }
@ -1914,13 +1926,14 @@ class DeclarationTVA_PDF
} }
foreach ($line20_details['account_details'] as $account) { foreach ($line20_details['account_details'] as $account) {
if ($account['vat_amount'] > 0) { // Only include 445 accounts (VAT accounts) with non-zero amounts
if (strpos($account['account_code'], '445') === 0 && $account['vat_amount'] > 0) {
$entries[] = array( $entries[] = array(
'account_code' => $account['account_code'], 'account_code' => $account['account_code'],
'account_label' => $account['account_label'], 'account_label' => $account['account_label'],
'entry_label' => 'TVA déductible - Ligne 20', 'entry_label' => 'TVA déductible - Ligne 20',
'debit' => '', 'debit' => '',
'credit' => $this->formatAmount($account['vat_amount']) 'credit' => $this->formatAmountReal($account['vat_amount'])
); );
} }
} }
@ -1954,9 +1967,9 @@ class DeclarationTVA_PDF
); );
if ($vat_result < 0) { if ($vat_result < 0) {
$entry['debit'] = $this->formatAmount(abs($vat_result)); $entry['debit'] = $this->formatAmountReal(abs($vat_result));
} else { } else {
$entry['credit'] = $this->formatAmount($vat_result); $entry['credit'] = $this->formatAmountReal($vat_result);
} }
return $entry; return $entry;
@ -2007,11 +2020,11 @@ class DeclarationTVA_PDF
if ($rounding_diff < 0) { if ($rounding_diff < 0) {
$entry['account_code'] = '658000'; $entry['account_code'] = '658000';
$entry['account_label'] = 'Charges exceptionnelles'; $entry['account_label'] = 'Charges exceptionnelles';
$entry['debit'] = $this->formatAmount(abs($rounding_diff)); $entry['debit'] = $this->formatAmountReal(abs($rounding_diff));
} else { } else {
$entry['account_code'] = '758000'; $entry['account_code'] = '758000';
$entry['account_label'] = 'Produits exceptionnels'; $entry['account_label'] = 'Produits exceptionnels';
$entry['credit'] = $this->formatAmount($rounding_diff); $entry['credit'] = $this->formatAmountReal($rounding_diff);
} }
return $entry; return $entry;