Fix D-section calculation logic
Fixed: - Only sections B and C VAT amounts are summed for totals - Section A lines (A1-A5) are excluded from totals calculation - Only VAT amounts (not base amounts) are included in totals - This should fix line 25 showing correct value (406.28)
This commit is contained in:
parent
ddb6377245
commit
1cf0d3d6a5
@ -268,10 +268,12 @@ class DeclarationTVA
|
|||||||
// Log the final amounts for debugging
|
// Log the final amounts for debugging
|
||||||
error_log("DeclarationTVA: Final amounts for line $ca3_line: base=$line_total_base, vat=$line_total_vat, total=$line_total_amount");
|
error_log("DeclarationTVA: Final amounts for line $ca3_line: base=$line_total_base, vat=$line_total_vat, total=$line_total_amount");
|
||||||
|
|
||||||
// Update totals
|
// Update totals - only VAT amounts from sections B and C
|
||||||
if (in_array($ca3_line, ['A1', 'A2', 'A3', 'A4', 'A5', '08', '09', '9B', '17'])) {
|
if (in_array($ca3_line, ['08', '09', '9B', '17'])) {
|
||||||
|
// Section B: VAT amounts only
|
||||||
$total_vat_collected += $line_total_vat;
|
$total_vat_collected += $line_total_vat;
|
||||||
} elseif (in_array($ca3_line, ['20', '21', '22'])) {
|
} elseif (in_array($ca3_line, ['20', '21', '22'])) {
|
||||||
|
// Section C: VAT amounts only
|
||||||
$total_vat_deductible += $line_total_vat;
|
$total_vat_deductible += $line_total_vat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user