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 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 '
' . $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 '| ' . $langs->trans("CA3Line") . ' | ';
- print '' . $langs->trans("AccountCode") . ' | ';
- print '' . $langs->trans("AccountLabel") . ' | ';
- print '' . $langs->trans("VATRate") . ' | ';
- print '' . $langs->trans("Status") . ' | ';
- print '
';
-
+ // Group by section for display
+ $mappings_by_section = array();
foreach ($mappings as $mapping) {
- print '';
- print '| ' . $mapping['ca3_line'] . ' | ';
- print '' . $mapping['account_code'] . ' | ';
- print '' . $mapping['account_label'] . ' | ';
- print '' . $mapping['vat_rate'] . '% | ';
- print '' . ($mapping['is_active'] ? $langs->trans("Active") : $langs->trans("Inactive")) . ' | ';
- 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 '';
+ print '';
+ print '| ' . $langs->trans("CA3Line") . ' | ';
+ print '' . $langs->trans("AccountCode") . ' | ';
+ print '' . $langs->trans("AccountLabel") . ' | ';
+ print '' . $langs->trans("VATRate") . ' | ';
+ print '' . $langs->trans("Status") . ' | ';
+ print '
';
+
+ foreach ($section_mappings as $mapping) {
+ print '';
+ print '| ' . $mapping['ca3_line'] . ' | ';
+ print '' . $mapping['account_code'] . ' | ';
+ print '' . $mapping['account_label'] . ' | ';
+ print '' . $mapping['vat_rate'] . '% | ';
+ print '' . ($mapping['is_active'] ? $langs->trans("Active") : $langs->trans("Inactive")) . ' | ';
+ print '
';
+ }
+ print '
';
+ 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