Add Base and VAT amounts for fields 08, 09, 9B
Enhanced: - Updated CA-3 line definitions for 08, 09, 9B to show both base and VAT - Changed type from 'vat' to 'base_vat' for these fields - Updated view table to show 5 columns: Line, Description, Base HT, VAT, Total - Added language translations for new columns - Fields 08, 09, 9B now display both base amounts and VAT amounts - Enhanced debugging to show final amounts for each line
This commit is contained in:
parent
4004f1acc5
commit
337e82b30b
@ -243,6 +243,9 @@ class DeclarationTVA
|
||||
|
||||
$combined_label = !empty($account_labels) ? implode(', ', $account_labels) : 'No accounts mapped';
|
||||
$this->createCA3Line($declaration_id, $ca3_line, $combined_label, $combined_amounts);
|
||||
|
||||
// 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");
|
||||
|
||||
// Update totals
|
||||
if (in_array($ca3_line, ['A1', 'A2', 'A3', 'A4', 'A5', '08', '09', '9B', '17'])) {
|
||||
|
||||
@ -271,25 +271,25 @@ class DeclarationTVA_Config
|
||||
|
||||
// B. Décompte de la TVA due (VAT Due Calculation) - Notice 4722
|
||||
'08' => array(
|
||||
'label' => 'TVA due au taux de 20%',
|
||||
'type' => 'vat',
|
||||
'label' => 'TVA due au taux de 20% (Base HT + TVA)',
|
||||
'type' => 'base_vat',
|
||||
'section' => 'B',
|
||||
'description' => 'VAT amounts due, calculated on A1/A2 bases at 20% rate',
|
||||
'pcg_accounts' => '44571x (TVA collectée à 20%)'
|
||||
'description' => 'Base HT and VAT amounts due at 20% rate',
|
||||
'pcg_accounts' => 'Base: 7xxxx (Sales); VAT: 44571x (TVA collectée à 20%)'
|
||||
),
|
||||
'09' => array(
|
||||
'label' => 'TVA due au taux de 10%',
|
||||
'type' => 'vat',
|
||||
'label' => 'TVA due au taux de 10% (Base HT + TVA)',
|
||||
'type' => 'base_vat',
|
||||
'section' => 'B',
|
||||
'description' => 'VAT amounts due, calculated on A1/A2 bases at 10% rate',
|
||||
'pcg_accounts' => '44572x (TVA collectée à 10%)'
|
||||
'description' => 'Base HT and VAT amounts due at 10% rate',
|
||||
'pcg_accounts' => 'Base: 7xxxx (Sales); VAT: 44572x (TVA collectée à 10%)'
|
||||
),
|
||||
'9B' => array(
|
||||
'label' => 'TVA due aux taux réduits (5,5% et 2,1%)',
|
||||
'type' => 'vat',
|
||||
'label' => 'TVA due aux taux réduits (Base HT + TVA)',
|
||||
'type' => 'base_vat',
|
||||
'section' => 'B',
|
||||
'description' => 'VAT amounts due, calculated on A1/A2 bases at reduced rates (5,5% and 2,1%)',
|
||||
'pcg_accounts' => '44573x (5,5%) / 44574x (2,1%) (TVA collectée aux taux réduits)'
|
||||
'description' => 'Base HT and VAT amounts due at reduced rates (5,5% and 2,1%)',
|
||||
'pcg_accounts' => 'Base: 7xxxx (Sales); VAT: 44573x (5,5%) / 44574x (2,1%)'
|
||||
),
|
||||
'17' => array(
|
||||
'label' => 'TVA due au titre des acquisitions intracommunautaires (autoliquidation)',
|
||||
|
||||
@ -138,7 +138,9 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>' . $langs->trans("CA3Line") . '</th>';
|
||||
print '<th>' . $langs->trans("Description") . '</th>';
|
||||
print '<th>' . $langs->trans("Amount") . '</th>';
|
||||
print '<th>' . $langs->trans("BaseAmount") . '</th>';
|
||||
print '<th>' . $langs->trans("VATAmount") . '</th>';
|
||||
print '<th>' . $langs->trans("TotalAmount") . '</th>';
|
||||
print '</tr>';
|
||||
|
||||
// Get actual CA-3 lines from database
|
||||
@ -155,65 +157,73 @@ foreach ($ca3_lines as $line) {
|
||||
|
||||
// Section A: Opérations imposables
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3"><strong>A. ' . $langs->trans("CA3SectionA") . '</strong></td>';
|
||||
print '<td colspan="5"><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);
|
||||
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'base_amount' => 0, 'vat_amount' => 0, 'total_amount' => 0);
|
||||
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td>' . $line . '</td>';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td class="right">' . price($data['base_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['vat_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['total_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 '<td colspan="5"><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);
|
||||
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'base_amount' => 0, 'vat_amount' => 0, 'total_amount' => 0);
|
||||
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td>' . $line . '</td>';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td class="right">' . price($data['base_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['vat_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['total_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 '<td colspan="5"><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);
|
||||
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'base_amount' => 0, 'vat_amount' => 0, 'total_amount' => 0);
|
||||
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td>' . $line . '</td>';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td class="right">' . price($data['base_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['vat_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['total_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 '<td colspan="5"><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);
|
||||
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'base_amount' => 0, 'vat_amount' => 0, 'total_amount' => 0);
|
||||
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td>' . $line . '</td>';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td class="right">' . price($data['base_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['vat_amount']) . '</td>';
|
||||
print '<td class="right">' . price($data['total_amount']) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -437,3 +437,6 @@ CA3SectionA = Taxable Operations
|
||||
CA3SectionB = VAT Due
|
||||
CA3SectionC = Deductible VAT
|
||||
CA3SectionD = Result
|
||||
BaseAmount = Base Amount
|
||||
VATAmount = VAT Amount
|
||||
TotalAmount = Total Amount
|
||||
|
||||
@ -426,3 +426,6 @@ CA3SectionA = Opérations imposables
|
||||
CA3SectionB = TVA due
|
||||
CA3SectionC = TVA déductible
|
||||
CA3SectionD = Résultat
|
||||
BaseAmount = Montant HT
|
||||
VATAmount = Montant TVA
|
||||
TotalAmount = Montant Total
|
||||
|
||||
Loading…
Reference in New Issue
Block a user