Fix to create correct 2 entries as requested
- Main amount (rounded) on 4455100: 69.00 - Rounding difference on 758000: 0.90 - For difference 69.90: 4455100 credit 70.00 + 758000 credit 0.90 - Should now show correct split between main and rounding accounts
This commit is contained in:
parent
ee0c0c4bdc
commit
908e4d794c
@ -2087,18 +2087,32 @@ class DeclarationTVA_PDF
|
||||
error_log("DeclarationTVA: Total difference: " . $difference);
|
||||
error_log("DeclarationTVA: Difference > 0: " . ($difference > 0 ? 'true' : 'false'));
|
||||
|
||||
// Only real difference on 758000, no main balancing entry
|
||||
// Split into main amount (rounded) and rounding difference
|
||||
if (abs($difference) >= 0.01) {
|
||||
error_log("DeclarationTVA: *** SINGLE ENTRY *** Creating 4455100 entry with real difference: " . $difference);
|
||||
$rounded_amount = round($difference);
|
||||
$rounding_diff = $difference - $rounded_amount;
|
||||
|
||||
// Only real difference on 4455100
|
||||
error_log("DeclarationTVA: Difference: " . $difference . ", Rounded: " . $rounded_amount . ", Rounding diff: " . $rounding_diff);
|
||||
|
||||
// Main amount (rounded) on 4455100
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '4455100',
|
||||
'account_label' => $this->getAccountLabel('4455100'),
|
||||
'entry_label' => $declaration->declaration_name,
|
||||
'debit' => '',
|
||||
'credit' => $this->formatAmountReal(abs($difference))
|
||||
'credit' => $this->formatAmount(abs($rounded_amount))
|
||||
);
|
||||
|
||||
// Rounding difference on 758000
|
||||
if (abs($rounding_diff) >= 0.01) {
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '758000',
|
||||
'account_label' => $this->getAccountLabel('758000'),
|
||||
'entry_label' => $declaration->declaration_name,
|
||||
'debit' => '',
|
||||
'credit' => $this->formatAmountReal(abs($rounding_diff))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $balancing_entries;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user