Fix table alignment with proper column spanning

Fixed:
- Description column now spans 2 columns (colspan='2') for normal rows
- All section headers span 4 columns (colspan='4')
- Table headers properly aligned with data rows
- Lines 08, 09, 9B: 4 columns (Line | Description | Base HT | VAT)
- All other lines: 3 columns (Line | Description spanning 2 | Amount)
- Table should now be properly aligned and readable
This commit is contained in:
Frank Cools 2025-10-02 21:51:28 +02:00
parent ae7768dd7b
commit 3d5e9b1ca8

View File

@ -155,7 +155,13 @@ foreach ($ca3_lines as $line) {
// Section A: Opérations imposables // Section A: Opérations imposables
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3"><strong>A. ' . $langs->trans("CA3SectionA") . '</strong></td>'; print '<td colspan="4"><strong>A. ' . $langs->trans("CA3SectionA") . '</strong></td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<th>' . $langs->trans("CA3Line") . '</th>';
print '<th colspan="2">' . $langs->trans("Description") . '</th>';
print '<th>' . $langs->trans("Amount") . '</th>';
print '</tr>'; print '</tr>';
$section_a_lines = array('A1', 'A2', 'A3', 'A4', 'A5'); $section_a_lines = array('A1', 'A2', 'A3', 'A4', 'A5');
@ -164,14 +170,14 @@ foreach ($section_a_lines as $line) {
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label']; $description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
print '<tr>'; print '<tr>';
print '<td>' . $line . '</td>'; print '<td>' . $line . '</td>';
print '<td>' . $description . '</td>'; print '<td colspan="2">' . $description . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>'; print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>'; print '</tr>';
} }
// Section B: TVA due // Section B: TVA due
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3"><strong>B. ' . $langs->trans("CA3SectionB") . '</strong></td>'; print '<td colspan="4"><strong>B. ' . $langs->trans("CA3SectionB") . '</strong></td>';
print '</tr>'; print '</tr>';
// Special header for lines 08, 09, 9B with base and VAT columns // Special header for lines 08, 09, 9B with base and VAT columns
@ -201,7 +207,7 @@ foreach ($base_vat_lines as $line) {
// Reset to normal layout for line 17 // Reset to normal layout for line 17
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th>' . $langs->trans("CA3Line") . '</th>'; print '<th>' . $langs->trans("CA3Line") . '</th>';
print '<th>' . $langs->trans("Description") . '</th>'; print '<th colspan="2">' . $langs->trans("Description") . '</th>';
print '<th>' . $langs->trans("Amount") . '</th>'; print '<th>' . $langs->trans("Amount") . '</th>';
print '</tr>'; print '</tr>';
@ -209,13 +215,19 @@ $data = isset($ca3_data['17']) ? $ca3_data['17'] : array('line_label' => '', 'va
$description = isset($ca3_definitions['17']) ? $ca3_definitions['17']['label'] : $data['line_label']; $description = isset($ca3_definitions['17']) ? $ca3_definitions['17']['label'] : $data['line_label'];
print '<tr>'; print '<tr>';
print '<td>17</td>'; print '<td>17</td>';
print '<td>' . $description . '</td>'; print '<td colspan="2">' . $description . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>'; print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>'; print '</tr>';
// Section C: TVA déductible // Section C: TVA déductible
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3"><strong>C. ' . $langs->trans("CA3SectionC") . '</strong></td>'; print '<td colspan="4"><strong>C. ' . $langs->trans("CA3SectionC") . '</strong></td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<th>' . $langs->trans("CA3Line") . '</th>';
print '<th colspan="2">' . $langs->trans("Description") . '</th>';
print '<th>' . $langs->trans("Amount") . '</th>';
print '</tr>'; print '</tr>';
$section_c_lines = array('20', '21', '22'); $section_c_lines = array('20', '21', '22');
@ -224,14 +236,20 @@ foreach ($section_c_lines as $line) {
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label']; $description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
print '<tr>'; print '<tr>';
print '<td>' . $line . '</td>'; print '<td>' . $line . '</td>';
print '<td>' . $description . '</td>'; print '<td colspan="2">' . $description . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>'; print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>'; print '</tr>';
} }
// Section D: Résultat // Section D: Résultat
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3"><strong>D. ' . $langs->trans("CA3SectionD") . '</strong></td>'; print '<td colspan="4"><strong>D. ' . $langs->trans("CA3SectionD") . '</strong></td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<th>' . $langs->trans("CA3Line") . '</th>';
print '<th colspan="2">' . $langs->trans("Description") . '</th>';
print '<th>' . $langs->trans("Amount") . '</th>';
print '</tr>'; print '</tr>';
$section_d_lines = array('25', '26', '28', '29'); $section_d_lines = array('25', '26', '28', '29');
@ -240,7 +258,7 @@ foreach ($section_d_lines as $line) {
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label']; $description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
print '<tr>'; print '<tr>';
print '<td>' . $line . '</td>'; print '<td>' . $line . '</td>';
print '<td>' . $description . '</td>'; print '<td colspan="2">' . $description . '</td>';
print '<td class="right">' . price($data['vat_amount']) . '</td>'; print '<td class="right">' . price($data['vat_amount']) . '</td>';
print '</tr>'; print '</tr>';
} }