hasRight("declarationtva", "declarationtva", "admin")) { accessforbidden(); } // Load language files $langs->load("declarationtva@declarationtva"); // Initialize objects $config = new DeclarationTVA_Config($db, $conf->entity); // Handle form submission $action = GETPOST('action', 'alpha'); if ($action == 'update_mappings') { $ca3_definitions = $config->getCA3LineDefinitions(); 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'); if (!empty($account_code)) { $config->updateAccountMapping($line, $account_code, $account_label, $vat_rate); } } setEventMessages($langs->trans("ConfigurationUpdated"), null, 'mesgs'); } // Get current mappings $mappings = $config->getAllAccountMappings(); $account_mappings = array(); foreach ($mappings as $mapping) { $account_mappings[$mapping['ca3_line']] = $mapping; } // Get available accounting accounts $accounts = $config->getAccountingAccounts(); $vat_rates = $config->getVATRates(); $ca3_definitions = $config->getCA3LineDefinitions(); $section_headers = $config->getCA3SectionHeaders(); // Page title $title = $langs->trans("DeclarationTVASetup"); llxHeader('', $title); // Print page header print load_fiche_titre($title, '', 'title_accountancy'); // Print notice information print '
| ' . $langs->trans("CA3Line") . ' | '; print '' . $langs->trans("AccountCode") . ' | '; print '' . $langs->trans("AccountLabel") . ' | '; print '' . $langs->trans("VATRate") . ' | '; print '' . $langs->trans("Status") . ' | '; 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 '