From d7bb9d23e8bf24dd7bbc1dba4bf95b9481d3fe18 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Thu, 2 Oct 2025 16:36:12 +0200 Subject: [PATCH] Complete CA-3 configuration interface with all sections and headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configuration Interface Improvements: - Added all missing CA-3 lines from planning document - Implemented proper section headers (A, B, C, D) - Added section descriptions for better understanding - Organized lines by section for logical grouping CA-3 Lines Added: - A1, A2: Taxable operations base amounts - B1-B4: VAT rate breakdowns (20%, 10%, 5.5%, 2.1%) - 05, 06: Intra-EU operations (B2B) - 17: VAT due on intra-EU acquisitions - 20, 21: Deductible VAT (fixed assets, other) - 22, 28, 29: Result calculations Section Headers: - A. Opérations imposables (Taxable Operations) - B. TVA due (VAT Due) - C. TVA déductible (Deductible VAT) - D. Résultat (Result) Enhanced Features: - Section-based organization in configuration - Type indicators (Base/VAT) for each line - Improved visual layout with section headers - Better grouping in current configuration display Language Support: - Added English translations for all new labels - Added French translations for all new labels - Consistent terminology across both languages The configuration page now shows the complete CA-3 structure as defined in the planning document! --- admin/setup_mvp.php | 153 +++++++++++++-------- core/class/declarationtva_config.class.php | 62 +++++++-- langs/en_US/declarationtva.lang | 27 ++++ langs/fr_FR/declarationtva.lang | 27 ++++ 4 files changed, 202 insertions(+), 67 deletions(-) diff --git a/admin/setup_mvp.php b/admin/setup_mvp.php index 9342dbd..c9ae18d 100644 --- a/admin/setup_mvp.php +++ b/admin/setup_mvp.php @@ -1,7 +1,7 @@ entity); // Handle form submission $action = GETPOST('action', 'alpha'); if ($action == 'update_mappings') { - $ca3_lines = array('A1', 'A2', 'B1', 'B2', 'B3', 'B4', '17', '20', '21', '22', '28', '29'); + $ca3_definitions = $config->getCA3LineDefinitions(); - foreach ($ca3_lines as $line) { + foreach ($ca3_definitions as $line => $definition) { $account_code = GETPOST('account_code_' . $line, 'alpha'); $account_label = GETPOST('account_label_' . $line, 'alpha'); $vat_rate = GETPOST('vat_rate_' . $line, 'alpha'); @@ -60,6 +60,7 @@ foreach ($mappings as $mapping) { $accounts = $config->getAccountingAccounts(); $vat_rates = $config->getVATRates(); $ca3_definitions = $config->getCA3LineDefinitions(); +$section_headers = $config->getCA3SectionHeaders(); // Page title $title = $langs->trans("DeclarationTVASetup"); @@ -75,43 +76,65 @@ print ''; print '
'; print '
' . $langs->trans("DeclarationTVAPCGMapping") . '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - +// Group CA-3 lines by section +$lines_by_section = array(); foreach ($ca3_definitions as $line => $definition) { - $mapping = isset($account_mappings[$line]) ? $account_mappings[$line] : array(); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $lines_by_section[$section][$line] = $definition; } -print '
' . $langs->trans("CA3Line") . '' . $langs->trans("LineLabel") . '' . $langs->trans("AccountCode") . '' . $langs->trans("AccountLabel") . '' . $langs->trans("VATRate") . '
' . $line . '' . $definition['label'] . ''; - print ''; - print ''; - print ''; - print '
'; +// Print each section +foreach ($lines_by_section as $section_code => $lines) { + $section_info = $section_headers[$section_code]; + + // Section header + print '
' . $section_info['title'] . '
'; + print '
' . $section_info['description'] . '
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + foreach ($lines as $line => $definition) { + $mapping = isset($account_mappings[$line]) ? $account_mappings[$line] : array(); + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + print '
' . $langs->trans("CA3Line") . '' . $langs->trans("LineLabel") . '' . $langs->trans("AccountCode") . '' . $langs->trans("AccountLabel") . '' . $langs->trans("VATRate") . '' . $langs->trans("Type") . '
' . $line . '' . $definition['label'] . ''; + print ''; + print ''; + print ''; + print '' . ucfirst($definition['type']) . '
'; + print '
'; +} print '
' . $langs->trans("Actions") . '
'; print ''; @@ -119,36 +142,56 @@ print '
'; print ''; -// Print current configuration +// Print current configuration summary print '
'; print '
' . $langs->trans("CurrentConfiguration") . '
'; if (empty($mappings)) { print '
' . $langs->trans("NoConfigurationFound") . '
'; } else { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - + // Group by section for display + $mappings_by_section = array(); foreach ($mappings as $mapping) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $line = $mapping['ca3_line']; + if (isset($ca3_definitions[$line])) { + $section = $ca3_definitions[$line]['section']; + if (!isset($mappings_by_section[$section])) { + $mappings_by_section[$section] = array(); + } + $mappings_by_section[$section][] = $mapping; + } + } + + foreach ($mappings_by_section as $section_code => $section_mappings) { + $section_info = $section_headers[$section_code]; + + print '
' . $section_info['title'] . '
'; + + print '
' . $langs->trans("CA3Line") . '' . $langs->trans("AccountCode") . '' . $langs->trans("AccountLabel") . '' . $langs->trans("VATRate") . '' . $langs->trans("Status") . '
' . $mapping['ca3_line'] . '' . $mapping['account_code'] . '' . $mapping['account_label'] . '' . $mapping['vat_rate'] . '%' . ($mapping['is_active'] ? $langs->trans("Active") : $langs->trans("Inactive")) . '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + foreach ($section_mappings as $mapping) { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + print '
' . $langs->trans("CA3Line") . '' . $langs->trans("AccountCode") . '' . $langs->trans("AccountLabel") . '' . $langs->trans("VATRate") . '' . $langs->trans("Status") . '
' . $mapping['ca3_line'] . '' . $mapping['account_code'] . '' . $mapping['account_label'] . '' . $mapping['vat_rate'] . '%' . ($mapping['is_active'] ? $langs->trans("Active") : $langs->trans("Inactive")) . '
'; + print '
'; } - print ''; } print '
'; // Print footer llxFooter(); -?> +?> \ No newline at end of file diff --git a/core/class/declarationtva_config.class.php b/core/class/declarationtva_config.class.php index e748a4a..e0836dd 100644 --- a/core/class/declarationtva_config.class.php +++ b/core/class/declarationtva_config.class.php @@ -182,18 +182,56 @@ class DeclarationTVA_Config public function getCA3LineDefinitions() { return array( - 'A1' => array('label' => 'Montant hors TVA des opérations imposables', 'type' => 'base'), - 'A2' => array('label' => 'Opérations imposables mais ne relevant pas du CA courant', 'type' => 'base'), - 'B1' => array('label' => 'Répartition 20% (base + taxe)', 'type' => 'vat'), - 'B2' => array('label' => 'Répartition 10% (base + taxe)', 'type' => 'vat'), - 'B3' => array('label' => 'Répartition 5,5% (base + taxe)', 'type' => 'vat'), - 'B4' => array('label' => 'Répartition 2,1% (base + taxe)', 'type' => 'vat'), - '17' => array('label' => 'TVA due au titre des acquisitions intracommunautaires', 'type' => 'vat'), - '20' => array('label' => 'TVA déductible sur immobilisations', 'type' => 'vat'), - '21' => array('label' => 'TVA déductible sur autres biens et services', 'type' => 'vat'), - '22' => array('label' => 'Crédit de TVA reportable', 'type' => 'vat'), - '28' => array('label' => 'TVA nette à payer', 'type' => 'vat'), - '29' => array('label' => 'Crédit de TVA à reporter ou remboursement', 'type' => 'vat') + // A. Opérations imposables (Taxable Operations) + 'A1' => array('label' => 'Montant hors TVA des opérations imposables', 'type' => 'base', 'section' => 'A'), + 'A2' => array('label' => 'Opérations imposables mais ne relevant pas du CA courant', 'type' => 'base', 'section' => 'A'), + 'B1' => array('label' => 'Répartition 20% (base + taxe)', 'type' => 'vat', 'section' => 'A'), + 'B2' => array('label' => 'Répartition 10% (base + taxe)', 'type' => 'vat', 'section' => 'A'), + 'B3' => array('label' => 'Répartition 5,5% (base + taxe)', 'type' => 'vat', 'section' => 'A'), + 'B4' => array('label' => 'Répartition 2,1% (base + taxe)', 'type' => 'vat', 'section' => 'A'), + + // A. Opérations intracommunautaires (Intra-EU Operations) + '05' => array('label' => 'Livraisons intracommunautaires (B2B)', 'type' => 'base', 'section' => 'A'), + '06' => array('label' => 'Prestations intracommunautaires (B2B)', 'type' => 'base', 'section' => 'A'), + + // B. TVA due (VAT Due) + '17' => array('label' => 'TVA due au titre des acquisitions intracommunautaires', 'type' => 'vat', 'section' => 'B'), + + // C. TVA déductible (Deductible VAT) + '20' => array('label' => 'TVA déductible sur immobilisations', 'type' => 'vat', 'section' => 'C'), + '21' => array('label' => 'TVA déductible sur autres biens et services', 'type' => 'vat', 'section' => 'C'), + + // D. Résultat (Result) + '22' => array('label' => 'Crédit de TVA reportable', 'type' => 'vat', 'section' => 'D'), + '28' => array('label' => 'TVA nette à payer', 'type' => 'vat', 'section' => 'D'), + '29' => array('label' => 'Crédit de TVA à reporter ou remboursement', 'type' => 'vat', 'section' => 'D') + ); + } + + /** + * Get CA-3 section headers + * + * @return array Section headers + */ + public function getCA3SectionHeaders() + { + return array( + 'A' => array( + 'title' => 'A. Opérations imposables (Taxable Operations)', + 'description' => 'Base amounts and VAT for domestic taxable operations' + ), + 'B' => array( + 'title' => 'B. TVA due (VAT Due)', + 'description' => 'VAT amounts due from intra-EU acquisitions and other sources' + ), + 'C' => array( + 'title' => 'C. TVA déductible (Deductible VAT)', + 'description' => 'VAT amounts that can be deducted from purchases and expenses' + ), + 'D' => array( + 'title' => 'D. Résultat (Result)', + 'description' => 'Final calculation: net VAT to pay or credit to carry forward' + ) ); } diff --git a/langs/en_US/declarationtva.lang b/langs/en_US/declarationtva.lang index 26441c2..d040b28 100644 --- a/langs/en_US/declarationtva.lang +++ b/langs/en_US/declarationtva.lang @@ -330,3 +330,30 @@ DeclarationTVASupplierAnalysis = Supplier Analysis DeclarationTVAGeographicAnalysis = Geographic Analysis DeclarationTVAProductAnalysis = Product Analysis DeclarationTVASeasonalAnalysis = Seasonal Analysis + +# CA-3 Section Headers +CA3SectionA = Taxable Operations +CA3SectionB = VAT Due +CA3SectionC = Deductible VAT +CA3SectionD = Result + +# CA-3 Line Labels +CA3LineA1 = Base amount of taxable operations +CA3LineA2 = Taxable operations not part of current revenue +CA3LineB1 = 20% VAT operations +CA3LineB2 = 10% VAT operations +CA3LineB3 = 5.5% VAT operations +CA3LineB4 = 2.1% VAT operations +CA3Line05 = Intra-EU goods deliveries (B2B) +CA3Line06 = Intra-EU services (B2B) +CA3Line17 = VAT due on intra-EU acquisitions +CA3Line20 = Deductible VAT on fixed assets +CA3Line21 = Deductible VAT on other goods and services +CA3Line22 = VAT credit to carry forward +CA3Line28 = Net VAT to pay +CA3Line29 = VAT credit to carry forward or refund + +# Form Labels +Type = Type +Base = Base +VAT = VAT diff --git a/langs/fr_FR/declarationtva.lang b/langs/fr_FR/declarationtva.lang index 0269b35..d9f30db 100644 --- a/langs/fr_FR/declarationtva.lang +++ b/langs/fr_FR/declarationtva.lang @@ -319,3 +319,30 @@ DeclarationTVASupplierAnalysis = Analyse fournisseurs DeclarationTVAGeographicAnalysis = Analyse géographique DeclarationTVAProductAnalysis = Analyse produits DeclarationTVASeasonalAnalysis = Analyse saisonnière + +# En-têtes des sections CA-3 +CA3SectionA = Opérations imposables +CA3SectionB = TVA due +CA3SectionC = TVA déductible +CA3SectionD = Résultat + +# Labels des lignes CA-3 +CA3LineA1 = Montant hors TVA des opérations imposables +CA3LineA2 = Opérations imposables mais ne relevant pas du CA courant +CA3LineB1 = Opérations à 20% +CA3LineB2 = Opérations à 10% +CA3LineB3 = Opérations à 5,5% +CA3LineB4 = Opérations à 2,1% +CA3Line05 = Livraisons intracommunautaires (B2B) +CA3Line06 = Prestations intracommunautaires (B2B) +CA3Line17 = TVA due au titre des acquisitions intracommunautaires +CA3Line20 = TVA déductible sur immobilisations +CA3Line21 = TVA déductible sur autres biens et services +CA3Line22 = Crédit de TVA reportable +CA3Line28 = TVA nette à payer +CA3Line29 = Crédit de TVA à reporter ou remboursement + +# Labels de formulaire +Type = Type +Base = Base +VAT = TVA