Restore complete CA-3 table structure with sections

CA-3 Table Structure:
- Section A: Opérations imposables (A1, A2, A3, A4, A5)
- Section B: TVA due (08, 09, 9B, 17)
- Section C: TVA déductible (20, 21, 22)
- Section D: Résultat (25, 26, 28, 29)
- Proper section headers with bold formatting
- All 17 CA-3 lines as per configuration
- Real calculated amounts from database
- Bilingual section titles
This commit is contained in:
Frank Cools 2025-10-02 20:54:52 +02:00
parent 213ab61bdd
commit 877a66057d
3 changed files with 75 additions and 8 deletions

View File

@ -144,18 +144,77 @@ print '</tr>';
// Get actual CA-3 lines from database
$ca3_lines = $declarationtva->getCA3Lines($id);
// Create a lookup array for quick access
$ca3_data = array();
foreach ($ca3_lines as $line) {
$ca3_data[$line['ca3_line']] = $line;
}
// Section A: Opérations imposables
print '<tr class="liste_titre">';
print '<td colspan="3"><strong>A. ' . $langs->trans("CA3SectionA") . '</strong></td>';
print '</tr>';
$section_a_lines = array('A1', 'A2', 'A3', 'A4', 'A5');
foreach ($section_a_lines as $line) {
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'vat_amount' => 0);
print '<tr>';
print '<td>' . $line . '</td>';
print '<td>' . $data['line_label'] . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>';
}
// Section B: TVA due
print '<tr class="liste_titre">';
print '<td colspan="3"><strong>B. ' . $langs->trans("CA3SectionB") . '</strong></td>';
print '</tr>';
$section_b_lines = array('08', '09', '9B', '17');
foreach ($section_b_lines as $line) {
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'vat_amount' => 0);
print '<tr>';
print '<td>' . $line . '</td>';
print '<td>' . $data['line_label'] . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>';
}
// Section C: TVA déductible
print '<tr class="liste_titre">';
print '<td colspan="3"><strong>C. ' . $langs->trans("CA3SectionC") . '</strong></td>';
print '</tr>';
$section_c_lines = array('20', '21', '22');
foreach ($section_c_lines as $line) {
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'vat_amount' => 0);
print '<tr>';
print '<td>' . $line . '</td>';
print '<td>' . $data['line_label'] . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>';
}
// Section D: Résultat
print '<tr class="liste_titre">';
print '<td colspan="3"><strong>D. ' . $langs->trans("CA3SectionD") . '</strong></td>';
print '</tr>';
$section_d_lines = array('25', '26', '28', '29');
foreach ($section_d_lines as $line) {
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'vat_amount' => 0);
print '<tr>';
print '<td>' . $line . '</td>';
print '<td>' . $data['line_label'] . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>';
}
// Show message if no data
if (empty($ca3_lines)) {
print '<tr>';
print '<td colspan="3" class="center">' . $langs->trans("NoCA3Data") . '</td>';
print '</tr>';
} else {
foreach ($ca3_lines as $line) {
print '<tr>';
print '<td>' . $line['ca3_line'] . '</td>';
print '<td>' . $line['line_label'] . '</td>';
print '<td class="right">' . price($line['vat_amount']) . '</td>';
print '</tr>';
}
}
print '</table>';

View File

@ -433,3 +433,7 @@ NoCA3Data = No CA-3 data calculated yet. Click Recalculate to calculate amounts.
TotalVATCollected = Total VAT Collected
TotalVATDeductible = Total VAT Deductible
VATCredit = VAT Credit
CA3SectionA = Taxable Operations
CA3SectionB = VAT Due
CA3SectionC = Deductible VAT
CA3SectionD = Result

View File

@ -422,3 +422,7 @@ NoCA3Data = Aucune donnée CA-3 calculée. Cliquez sur Recalculer pour calculer
TotalVATCollected = TVA Collectée Totale
TotalVATDeductible = TVA Déductible Totale
VATCredit = Crédit de TVA
CA3SectionA = Opérations imposables
CA3SectionB = TVA due
CA3SectionC = TVA déductible
CA3SectionD = Résultat