Simplify to exactly 2 lines as requested
- Rounded difference on 4455100 (formatAmount) - Real difference on 758000 (formatAmountReal) - For difference 69.90: 4455100 credit 70.00 + 758000 credit 0.90 - No more complex logic, just 2 simple lines - Exactly what user requested: 69.00 on 4455100 and 0.90 on 758000
This commit is contained in:
parent
0aa02d8318
commit
00add0de70
@ -2077,38 +2077,24 @@ class DeclarationTVA_PDF
|
||||
error_log("DeclarationTVA: Total difference: " . $difference);
|
||||
error_log("DeclarationTVA: Difference > 0: " . ($difference > 0 ? 'true' : 'false'));
|
||||
|
||||
// Split into main amount (rounded) and rounding difference
|
||||
// Simple: rounded difference on 4455100, real difference on 758000
|
||||
if (abs($difference) >= 0.01) {
|
||||
$rounded_amount = round($difference);
|
||||
$rounding_diff = $difference - $rounded_amount;
|
||||
|
||||
error_log("DeclarationTVA: Difference: " . $difference . ", Rounded: " . $rounded_amount . ", Rounding diff: " . $rounding_diff);
|
||||
|
||||
// Main entry with rounded amount
|
||||
if ($difference > 0) {
|
||||
// More debits than credits - need credit entry (4455100)
|
||||
// Rounded difference on 4455100
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '4455100',
|
||||
'account_label' => $this->getAccountLabel('4455100'),
|
||||
'entry_label' => $declaration->declaration_name,
|
||||
'debit' => '',
|
||||
'credit' => $this->formatAmount($rounded_amount)
|
||||
'credit' => $this->formatAmount(abs($rounded_amount))
|
||||
);
|
||||
} 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_amount)),
|
||||
'credit' => ''
|
||||
);
|
||||
}
|
||||
|
||||
// Rounding entry with real difference
|
||||
// Real difference on 758000
|
||||
if (abs($rounding_diff) >= 0.01) {
|
||||
if ($difference > 0) {
|
||||
// Debit difference - rounding on 758000 credit
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '758000',
|
||||
'account_label' => $this->getAccountLabel('758000'),
|
||||
@ -2116,16 +2102,6 @@ class DeclarationTVA_PDF
|
||||
'debit' => '',
|
||||
'credit' => $this->formatAmountReal(abs($rounding_diff))
|
||||
);
|
||||
} else {
|
||||
// Credit difference - rounding on 658000 debit
|
||||
$balancing_entries[] = array(
|
||||
'account_code' => '658000',
|
||||
'account_label' => $this->getAccountLabel('658000'),
|
||||
'entry_label' => $declaration->declaration_name,
|
||||
'debit' => $this->formatAmountReal(abs($rounding_diff)),
|
||||
'credit' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user