Implement inline dropdown panels for CA-3 line details
Features: - Replaced separate page with inline dropdown panels - Click any CA-3 line code to expand/collapse account details - AJAX loading of account breakdown data - Professional styling matching Dolibarr UI - JavaScript toggle functionality with loading states - Account details table with: * Account codes and labels * Base amounts, VAT amounts, total amounts * Mapping types and totals * Summary information - Removed separate line details page - Added comprehensive translations for dropdown interface This provides seamless inline access to account breakdowns without page navigation.
This commit is contained in:
parent
b0934c55d4
commit
f39a7f140a
@ -1,183 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* DeclarationTVA Line Details Page
|
||||
* Shows detailed breakdown of accounts for a specific CA-3 line
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
if (file_exists('../main.inc.php')) {
|
||||
$res = @include '../main.inc.php';
|
||||
} elseif (file_exists('../../main.inc.php')) {
|
||||
$res = @include '../../main.inc.php';
|
||||
} elseif (file_exists('../../../main.inc.php')) {
|
||||
$res = @include '../../../main.inc.php';
|
||||
} else {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
// Load module classes
|
||||
require_once DOL_DOCUMENT_ROOT . '/custom/declarationtva/core/class/declarationtva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/custom/declarationtva/core/class/declarationtva_config.class.php';
|
||||
|
||||
// Access control
|
||||
if (!$user->hasRight("declarationtva", "declarationtva", "read")) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Get parameters
|
||||
$declaration_id = GETPOST('declaration_id', 'int');
|
||||
$ca3_line = GETPOST('ca3_line', 'alpha');
|
||||
|
||||
// Validate parameters
|
||||
if (empty($declaration_id) || empty($ca3_line)) {
|
||||
setEventMessages($langs->trans("ErrorMissingParameters"), null, 'errors');
|
||||
header("Location: declarationtvaindex.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Initialize objects
|
||||
$declarationtva = new DeclarationTVA($db);
|
||||
$config = new DeclarationTVA_Config($db);
|
||||
|
||||
// Get declaration info
|
||||
if (!$declarationtva->fetch($declaration_id)) {
|
||||
setEventMessages($langs->trans("DeclarationNotFound"), null, 'errors');
|
||||
header("Location: declarationtvaindex.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get detailed breakdown
|
||||
$line_details = $declarationtva->getCA3LineDetails($declaration_id, $ca3_line);
|
||||
|
||||
if (empty($line_details)) {
|
||||
setEventMessages($langs->trans("NoDataFoundForLine"), null, 'errors');
|
||||
header("Location: declarationtva_view.php?id=" . $declaration_id);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get CA-3 line definition
|
||||
$ca3_definitions = $config->getCA3LineDefinitions();
|
||||
$line_definition = isset($ca3_definitions[$ca3_line]) ? $ca3_definitions[$ca3_line] : null;
|
||||
|
||||
// Page title
|
||||
$title = $langs->trans("CA3LineDetails") . " - " . $ca3_line;
|
||||
if ($line_definition) {
|
||||
$title .= " - " . $line_definition['label'];
|
||||
}
|
||||
|
||||
// Load page header
|
||||
llxHeader('', $title);
|
||||
|
||||
// Page header
|
||||
print load_fiche_titre($title, '', 'fa-list-alt');
|
||||
|
||||
// Breadcrumb
|
||||
print '<div class="tabsAction">';
|
||||
print '<a href="declarationtvaindex.php" class="butAction">' . $langs->trans("BackToList") . '</a>';
|
||||
print '<a href="declarationtva_view.php?id=' . $declaration_id . '" class="butAction">' . $langs->trans("BackToDeclaration") . '</a>';
|
||||
print '</div>';
|
||||
|
||||
// Declaration info
|
||||
print '<div class="fiche">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">' . $langs->trans("DeclarationInfo") . '</th>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("DeclarationNumber") . '</td>';
|
||||
print '<td>' . $declarationtva->declaration_number . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Period") . '</td>';
|
||||
print '<td>' . dol_print_date($declarationtva->start_date, 'day') . ' - ' . dol_print_date($declarationtva->end_date, 'day') . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("CA3Line") . '</td>';
|
||||
print '<td><strong>' . $ca3_line . '</strong></td>';
|
||||
print '</tr>';
|
||||
if ($line_definition) {
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td>' . $line_definition['label'] . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">' . $langs->trans("LineSummary") . '</th>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("AccountCount") . '</td>';
|
||||
print '<td><strong>' . $line_details['account_count'] . '</strong></td>';
|
||||
print '</tr>';
|
||||
if ($line_details['calculated_line']) {
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("CalculatedTotal") . '</td>';
|
||||
print '<td><strong>' . price($line_details['calculated_line']->total_amount) . '</strong></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
// Account details table
|
||||
print '<div class="fiche">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>' . $langs->trans("AccountCode") . '</th>';
|
||||
print '<th>' . $langs->trans("AccountLabel") . '</th>';
|
||||
print '<th class="right">' . $langs->trans("BaseAmount") . '</th>';
|
||||
print '<th class="right">' . $langs->trans("VATAmount") . '</th>';
|
||||
print '<th class="right">' . $langs->trans("TotalAmount") . '</th>';
|
||||
print '<th>' . $langs->trans("MappingType") . '</th>';
|
||||
print '</tr>';
|
||||
|
||||
$total_base = 0;
|
||||
$total_vat = 0;
|
||||
$total_amount = 0;
|
||||
|
||||
foreach ($line_details['account_details'] as $account) {
|
||||
$total_base += $account['base_amount'];
|
||||
$total_vat += $account['vat_amount'];
|
||||
$total_amount += $account['total_amount'];
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><strong>' . $account['account_code'] . '</strong></td>';
|
||||
print '<td>' . $account['account_label'] . '</td>';
|
||||
print '<td class="right">' . price($account['base_amount']) . '</td>';
|
||||
print '<td class="right">' . price($account['vat_amount']) . '</td>';
|
||||
print '<td class="right">' . price($account['total_amount']) . '</td>';
|
||||
print '<td>' . $account['mapping_type'] . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Totals row
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2"><strong>' . $langs->trans("Total") . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($total_base) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($total_vat) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($total_amount) . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Additional info if calculated line exists
|
||||
if ($line_details['calculated_line']) {
|
||||
print '<div class="info">';
|
||||
print '<strong>' . $langs->trans("Note") . ':</strong> ';
|
||||
print $langs->trans("CalculatedLineNote");
|
||||
if (!empty($line_details['calculated_line']->line_label)) {
|
||||
print '<br><em>' . $line_details['calculated_line']->line_label . '</em>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Close page
|
||||
llxFooter();
|
||||
?>
|
||||
119
declarationtva_line_details_ajax.php
Normal file
119
declarationtva_line_details_ajax.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* AJAX endpoint for loading CA-3 line details
|
||||
* Returns HTML content for inline dropdown display
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
if (file_exists('../main.inc.php')) {
|
||||
$res = @include '../main.inc.php';
|
||||
} elseif (file_exists('../../main.inc.php')) {
|
||||
$res = @include '../../main.inc.php';
|
||||
} elseif (file_exists('../../../main.inc.php')) {
|
||||
$res = @include '../../../main.inc.php';
|
||||
} else {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
// Load module classes
|
||||
require_once DOL_DOCUMENT_ROOT . '/custom/declarationtva/core/class/declarationtva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/custom/declarationtva/core/class/declarationtva_config.class.php';
|
||||
|
||||
// Access control
|
||||
if (!$user->hasRight("declarationtva", "declarationtva", "read")) {
|
||||
http_response_code(403);
|
||||
echo "Access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get parameters
|
||||
$declaration_id = GETPOST('declaration_id', 'int');
|
||||
$ca3_line = GETPOST('ca3_line', 'alpha');
|
||||
|
||||
// Validate parameters
|
||||
if (empty($declaration_id) || empty($ca3_line)) {
|
||||
echo '<div class="error">' . $langs->trans("ErrorMissingParameters") . '</div>';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Initialize objects
|
||||
$declarationtva = new DeclarationTVA($db);
|
||||
$config = new DeclarationTVA_Config($db);
|
||||
|
||||
// Get declaration info
|
||||
if (!$declarationtva->fetch($declaration_id)) {
|
||||
echo '<div class="error">' . $langs->trans("DeclarationNotFound") . '</div>';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get detailed breakdown
|
||||
$line_details = $declarationtva->getCA3LineDetails($declaration_id, $ca3_line);
|
||||
|
||||
if (empty($line_details)) {
|
||||
echo '<div class="info">' . $langs->trans("NoDataFoundForLine") . '</div>';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get CA-3 line definition
|
||||
$ca3_definitions = $config->getCA3LineDefinitions();
|
||||
$line_definition = isset($ca3_definitions[$ca3_line]) ? $ca3_definitions[$ca3_line] : null;
|
||||
|
||||
// Display account details table
|
||||
echo '<table class="noborder centpercent">';
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<th>' . $langs->trans("AccountCode") . '</th>';
|
||||
echo '<th>' . $langs->trans("AccountLabel") . '</th>';
|
||||
echo '<th class="right">' . $langs->trans("BaseAmount") . '</th>';
|
||||
echo '<th class="right">' . $langs->trans("VATAmount") . '</th>';
|
||||
echo '<th class="right">' . $langs->trans("TotalAmount") . '</th>';
|
||||
echo '<th>' . $langs->trans("MappingType") . '</th>';
|
||||
echo '</tr>';
|
||||
|
||||
$total_base = 0;
|
||||
$total_vat = 0;
|
||||
$total_amount = 0;
|
||||
|
||||
foreach ($line_details['account_details'] as $account) {
|
||||
$total_base += $account['base_amount'];
|
||||
$total_vat += $account['vat_amount'];
|
||||
$total_amount += $account['total_amount'];
|
||||
|
||||
echo '<tr class="oddeven">';
|
||||
echo '<td><strong>' . $account['account_code'] . '</strong></td>';
|
||||
echo '<td>' . $account['account_label'] . '</td>';
|
||||
echo '<td class="right">' . price($account['base_amount']) . '</td>';
|
||||
echo '<td class="right">' . price($account['vat_amount']) . '</td>';
|
||||
echo '<td class="right">' . price($account['total_amount']) . '</td>';
|
||||
echo '<td>' . $account['mapping_type'] . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
// Totals row
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td colspan="2"><strong>' . $langs->trans("Total") . '</strong></td>';
|
||||
echo '<td class="right"><strong>' . price($total_base) . '</strong></td>';
|
||||
echo '<td class="right"><strong>' . price($total_vat) . '</strong></td>';
|
||||
echo '<td class="right"><strong>' . price($total_amount) . '</strong></td>';
|
||||
echo '<td></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '</table>';
|
||||
|
||||
// Additional info if calculated line exists
|
||||
if ($line_details['calculated_line']) {
|
||||
echo '<div class="info" style="margin-top: 10px;">';
|
||||
echo '<strong>' . $langs->trans("Note") . ':</strong> ';
|
||||
echo $langs->trans("CalculatedLineNote");
|
||||
if (!empty($line_details['calculated_line']->line_label)) {
|
||||
echo '<br><em>' . $line_details['calculated_line']->line_label . '</em>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// Summary info
|
||||
echo '<div class="info" style="margin-top: 10px;">';
|
||||
echo '<strong>' . $langs->trans("Summary") . ':</strong> ';
|
||||
echo $langs->trans("AccountCount") . ': ' . $line_details['account_count'] . ' | ';
|
||||
echo $langs->trans("Period") . ': ' . dol_print_date($line_details['start_date'], 'day') . ' - ' . dol_print_date($line_details['end_date'], 'day');
|
||||
echo '</div>';
|
||||
?>
|
||||
@ -173,10 +173,22 @@ foreach ($section_a_lines as $line) {
|
||||
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'vat_amount' => 0);
|
||||
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td><a href="declarationtva_line_details.php?declaration_id=' . $declarationtva->rowid . '&ca3_line=' . $line . '" class="butAction">' . $line . '</a></td>';
|
||||
print '<td><a href="#" onclick="toggleDetails(\'' . $line . '\'); return false;" class="butAction">' . $line . '</a></td>';
|
||||
print '<td colspan="2">' . $description . '</td>';
|
||||
print '<td class="right">' . formatAmountWithOriginal($data['vat_amount'], $data['line_label']) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Add dropdown row for account details
|
||||
print '<tr id="details_' . $line . '" style="display: none;">';
|
||||
print '<td colspan="4">';
|
||||
print '<div class="account-details">';
|
||||
print '<div class="account-details-header">' . $langs->trans("AccountBreakdown") . ' - ' . $line . '</div>';
|
||||
print '<div class="account-details-content" id="content_' . $line . '">';
|
||||
print '<div class="loading">' . $langs->trans("Loading") . '...</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Section B: TVA due
|
||||
@ -201,11 +213,23 @@ foreach ($base_vat_lines as $line) {
|
||||
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'base_amount' => 0, 'vat_amount' => 0);
|
||||
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td><a href="declarationtva_line_details.php?declaration_id=' . $declarationtva->rowid . '&ca3_line=' . $line . '" class="butAction">' . $line . '</a></td>';
|
||||
print '<td><a href="#" onclick="toggleDetails(\'' . $line . '\'); return false;" class="butAction">' . $line . '</a></td>';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td class="right">' . formatAmountWithOriginal($data['base_amount'], $data['line_label'], 'base') . '</td>';
|
||||
print '<td class="right">' . formatAmountWithOriginal($data['vat_amount'], $data['line_label']) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Add dropdown row for account details
|
||||
print '<tr id="details_' . $line . '" style="display: none;">';
|
||||
print '<td colspan="4">';
|
||||
print '<div class="account-details">';
|
||||
print '<div class="account-details-header">' . $langs->trans("AccountBreakdown") . ' - ' . $line . '</div>';
|
||||
print '<div class="account-details-content" id="content_' . $line . '">';
|
||||
print '<div class="loading">' . $langs->trans("Loading") . '...</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Line 16: Subtotal (calculated automatically)
|
||||
@ -226,11 +250,23 @@ print '</tr>';
|
||||
$data = isset($ca3_data['17']) ? $ca3_data['17'] : array('line_label' => '', 'vat_amount' => 0);
|
||||
$description = isset($ca3_definitions['17']) ? $ca3_definitions['17']['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td><a href="declarationtva_line_details.php?declaration_id=' . $declarationtva->rowid . '&ca3_line=17" class="butAction">17</a></td>';
|
||||
print '<td><a href="#" onclick="toggleDetails(\'17\'); return false;" class="butAction">17</a></td>';
|
||||
print '<td colspan="2">' . $description . '</td>';
|
||||
print '<td class="right">' . formatAmountWithOriginal($data['vat_amount'], $data['line_label']) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Add dropdown row for account details
|
||||
print '<tr id="details_17" style="display: none;">';
|
||||
print '<td colspan="4">';
|
||||
print '<div class="account-details">';
|
||||
print '<div class="account-details-header">' . $langs->trans("AccountBreakdown") . ' - 17</div>';
|
||||
print '<div class="account-details-content" id="content_17">';
|
||||
print '<div class="loading">' . $langs->trans("Loading") . '...</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Section C: TVA déductible
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><strong>C. ' . $langs->trans("CA3SectionC") . '</strong></td>';
|
||||
@ -247,10 +283,22 @@ foreach ($section_c_lines as $line) {
|
||||
$data = isset($ca3_data[$line]) ? $ca3_data[$line] : array('line_label' => '', 'vat_amount' => 0);
|
||||
$description = isset($ca3_definitions[$line]) ? $ca3_definitions[$line]['label'] : $data['line_label'];
|
||||
print '<tr>';
|
||||
print '<td><a href="declarationtva_line_details.php?declaration_id=' . $declarationtva->rowid . '&ca3_line=' . $line . '" class="butAction">' . $line . '</a></td>';
|
||||
print '<td><a href="#" onclick="toggleDetails(\'' . $line . '\'); return false;" class="butAction">' . $line . '</a></td>';
|
||||
print '<td colspan="2">' . $description . '</td>';
|
||||
print '<td class="right">' . formatAmountWithOriginal($data['vat_amount'], $data['line_label']) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Add dropdown row for account details
|
||||
print '<tr id="details_' . $line . '" style="display: none;">';
|
||||
print '<td colspan="4">';
|
||||
print '<div class="account-details">';
|
||||
print '<div class="account-details-header">' . $langs->trans("AccountBreakdown") . ' - ' . $line . '</div>';
|
||||
print '<div class="account-details-content" id="content_' . $line . '">';
|
||||
print '<div class="loading">' . $langs->trans("Loading") . '...</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Line 23: Subtotal (calculated automatically)
|
||||
@ -284,10 +332,22 @@ foreach ($section_d_lines as $line) {
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
print '<td><a href="declarationtva_line_details.php?declaration_id=' . $declarationtva->rowid . '&ca3_line=' . $line . '" class="butAction">' . $line . '</a></td>';
|
||||
print '<td><a href="#" onclick="toggleDetails(\'' . $line . '\'); return false;" class="butAction">' . $line . '</a></td>';
|
||||
print '<td colspan="2">' . $description . '</td>';
|
||||
print '<td class="right">' . formatAmount($data['vat_amount']) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Add dropdown row for account details
|
||||
print '<tr id="details_' . $line . '" style="display: none;">';
|
||||
print '<td colspan="4">';
|
||||
print '<div class="account-details">';
|
||||
print '<div class="account-details-header">' . $langs->trans("AccountBreakdown") . ' - ' . $line . '</div>';
|
||||
print '<div class="account-details-content" id="content_' . $line . '">';
|
||||
print '<div class="loading">' . $langs->trans("Loading") . '...</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Show message if no data
|
||||
@ -320,6 +380,101 @@ print '<a href="declarationtvaindex.php" class="butAction">' . $langs->trans("Ba
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
// Add CSS for dropdown styling
|
||||
print '<style>
|
||||
.account-details {
|
||||
background-color: #f8f9fa;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 4px;
|
||||
margin: 10px 0;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.account-details-header {
|
||||
font-weight: bold;
|
||||
color: #495057;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
.account-details-content {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.account-details table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.account-details table th,
|
||||
.account-details table td {
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
border: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
.account-details table th {
|
||||
background-color: #e9ecef;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.account-details table tr:nth-child(even) {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
color: #6c757d;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>';
|
||||
|
||||
// Add JavaScript for dropdown functionality
|
||||
print '<script>
|
||||
var loadedDetails = {};
|
||||
|
||||
function toggleDetails(line) {
|
||||
var detailsRow = document.getElementById("details_" + line);
|
||||
var contentDiv = document.getElementById("content_" + line);
|
||||
|
||||
if (detailsRow.style.display === "none") {
|
||||
// Show the dropdown
|
||||
detailsRow.style.display = "";
|
||||
|
||||
// Load content if not already loaded
|
||||
if (!loadedDetails[line]) {
|
||||
loadLineDetails(line);
|
||||
}
|
||||
} else {
|
||||
// Hide the dropdown
|
||||
detailsRow.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function loadLineDetails(line) {
|
||||
var contentDiv = document.getElementById("content_" + line);
|
||||
var declarationId = ' . $declarationtva->rowid . ';
|
||||
|
||||
// Show loading
|
||||
contentDiv.innerHTML = "<div class=\"loading\">' . $langs->trans("Loading") . '...</div>";
|
||||
|
||||
// Make AJAX request to get line details
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "declarationtva_line_details_ajax.php?declaration_id=" + declarationId + "&ca3_line=" + line, true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
contentDiv.innerHTML = xhr.responseText;
|
||||
loadedDetails[line] = true;
|
||||
} else if (xhr.readyState === 4) {
|
||||
contentDiv.innerHTML = "<div class=\"error\">' . $langs->trans("ErrorLoadingDetails") . '</div>";
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
</script>';
|
||||
|
||||
// Print footer
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -457,3 +457,7 @@ Note = Note
|
||||
CalculatedLineNote = This line shows the detail of accounts used to calculate the CA-3 line. Amounts may differ slightly from the calculated total due to rounding.
|
||||
ErrorMissingParameters = Missing parameters
|
||||
NoDataFoundForLine = No data found for this line
|
||||
AccountBreakdown = Account Breakdown
|
||||
Loading = Loading...
|
||||
ErrorLoadingDetails = Error loading details
|
||||
Summary = Summary
|
||||
|
||||
@ -446,3 +446,7 @@ Note = Note
|
||||
CalculatedLineNote = Cette ligne montre le détail des comptes utilisés pour calculer la ligne CA-3. Les montants peuvent différer légèrement du total calculé en raison des arrondis.
|
||||
ErrorMissingParameters = Paramètres manquants
|
||||
NoDataFoundForLine = Aucune donnée trouvée pour cette ligne
|
||||
AccountBreakdown = Détail des comptes
|
||||
Loading = Chargement...
|
||||
ErrorLoadingDetails = Erreur lors du chargement des détails
|
||||
Summary = Résumé
|
||||
|
||||
Loading…
Reference in New Issue
Block a user