Add debugging for CA-3 line processing

Added:
- Log which CA-3 lines have mappings
- Log account codes being processed
- Log amounts found for each account
- Log when no mappings found for a line
- This will help identify why field 08 isn't working
This commit is contained in:
Frank Cools 2025-10-02 21:36:57 +02:00
parent ffece31f7a
commit 21ad4110e7

View File

@ -218,14 +218,20 @@ class DeclarationTVA
// Sum all accounts for this CA-3 line (if any mappings exist)
if (isset($grouped_mappings[$ca3_line])) {
error_log("DeclarationTVA: Processing CA-3 line $ca3_line with " . count($grouped_mappings[$ca3_line]) . " mapped accounts");
foreach ($grouped_mappings[$ca3_line] as $mapping) {
error_log("DeclarationTVA: Processing account " . $mapping['account_code'] . " for line $ca3_line");
$amounts = $this->getAccountAmounts($mapping['account_code'], $period['start_date'], $period['end_date']);
$line_total_base += $amounts['base_amount'];
$line_total_vat += $amounts['vat_amount'];
$line_total_amount += $amounts['total_amount'];
$account_labels[] = $mapping['account_label'];
error_log("DeclarationTVA: Account " . $mapping['account_code'] . " amounts: base=" . $amounts['base_amount'] . ", vat=" . $amounts['vat_amount']);
}
} else {
error_log("DeclarationTVA: No mappings found for CA-3 line $ca3_line");
}
// Create CA-3 line record with summed amounts (even if zero)