Simplify main interface by removing redundant periods section
Main Interface Improvements: - Removed separate periods section as it was redundant - Each declaration already represents a specific period - Updated declarations table to include period dates directly - Added 'Create Declaration' button for better user experience - Simplified interface focuses on declarations with period context - Improved data query to join declarations with periods The interface is now cleaner and more focused on the actual declarations rather than having separate period management.
This commit is contained in:
parent
0d17cfff53
commit
1263eb82bb
@ -64,30 +64,31 @@ if ($action == 'create_declaration' && $period_id > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get data for display
|
// Get data for display
|
||||||
$periods = $period->getAllPeriods();
|
|
||||||
$declarations = array();
|
$declarations = array();
|
||||||
|
|
||||||
// Get declarations for each period
|
// Get all declarations
|
||||||
foreach ($periods as $p) {
|
$sql = "SELECT d.*, p.period_name, p.start_date, p.end_date
|
||||||
$sql = "SELECT * FROM " . MAIN_DB_PREFIX . "declarationtva_declarations
|
FROM " . MAIN_DB_PREFIX . "declarationtva_declarations d
|
||||||
WHERE period_id = " . $p['rowid'] . " AND entity = " . $conf->entity . "
|
LEFT JOIN " . MAIN_DB_PREFIX . "declarationtva_periods p ON d.period_id = p.rowid
|
||||||
ORDER BY created_date DESC";
|
WHERE d.entity = " . $conf->entity . "
|
||||||
|
ORDER BY d.created_date DESC";
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result) {
|
$result = $db->query($sql);
|
||||||
while ($obj = $db->fetch_object($result)) {
|
if ($result) {
|
||||||
$declarations[] = array(
|
while ($obj = $db->fetch_object($result)) {
|
||||||
'rowid' => $obj->rowid,
|
$declarations[] = array(
|
||||||
'declaration_number' => $obj->declaration_number,
|
'rowid' => $obj->rowid,
|
||||||
'status' => $obj->status,
|
'declaration_number' => $obj->declaration_number,
|
||||||
'total_vat_collected' => $obj->total_vat_collected,
|
'status' => $obj->status,
|
||||||
'total_vat_deductible' => $obj->total_vat_deductible,
|
'total_vat_collected' => $obj->total_vat_collected,
|
||||||
'net_vat_due' => $obj->net_vat_due,
|
'total_vat_deductible' => $obj->total_vat_deductible,
|
||||||
'vat_credit' => $obj->vat_credit,
|
'net_vat_due' => $obj->net_vat_due,
|
||||||
'created_date' => $obj->created_date,
|
'vat_credit' => $obj->vat_credit,
|
||||||
'period_name' => $p['period_name']
|
'created_date' => $obj->created_date,
|
||||||
);
|
'period_name' => $obj->period_name,
|
||||||
}
|
'start_date' => $obj->start_date,
|
||||||
|
'end_date' => $obj->end_date
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,52 +99,25 @@ llxHeader('', $title);
|
|||||||
// Print page header
|
// Print page header
|
||||||
print load_fiche_titre($title, '', 'title_accountancy');
|
print load_fiche_titre($title, '', 'title_accountancy');
|
||||||
|
|
||||||
// Print periods section
|
|
||||||
print '<div class="fiche">';
|
|
||||||
print '<div class="fichehalfleft">';
|
|
||||||
print '<div class="titre">' . $langs->trans("DeclarationTVAPeriods") . '</div>';
|
|
||||||
|
|
||||||
if (empty($periods)) {
|
|
||||||
print '<div class="info">' . $langs->trans("NoPeriodsFound") . '</div>';
|
|
||||||
} else {
|
|
||||||
print '<table class="noborder centpercent">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<th>' . $langs->trans("PeriodName") . '</th>';
|
|
||||||
print '<th>' . $langs->trans("StartDate") . '</th>';
|
|
||||||
print '<th>' . $langs->trans("EndDate") . '</th>';
|
|
||||||
print '<th>' . $langs->trans("Status") . '</th>';
|
|
||||||
print '<th>' . $langs->trans("Actions") . '</th>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
foreach ($periods as $p) {
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>' . $p['period_name'] . '</td>';
|
|
||||||
print '<td>' . dol_print_date($p['start_date'], 'day') . '</td>';
|
|
||||||
print '<td>' . dol_print_date($p['end_date'], 'day') . '</td>';
|
|
||||||
print '<td>' . $langs->trans("Status" . ucfirst($p['status'])) . '</td>';
|
|
||||||
print '<td>';
|
|
||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=create_declaration&period_id=' . $p['rowid'] . '" class="butAction">' . $langs->trans("CreateDeclaration") . '</a>';
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
print '</table>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
// Print declarations section
|
// Print declarations section
|
||||||
print '<div class="fiche">';
|
print '<div class="fiche">';
|
||||||
print '<div class="fichehalfright">';
|
|
||||||
print '<div class="titre">' . $langs->trans("DeclarationTVADeclarations") . '</div>';
|
print '<div class="titre">' . $langs->trans("DeclarationTVADeclarations") . '</div>';
|
||||||
|
|
||||||
if (empty($declarations)) {
|
if (empty($declarations)) {
|
||||||
print '<div class="info">' . $langs->trans("NoDeclarationsFound") . '</div>';
|
print '<div class="info">' . $langs->trans("NoDeclarationsFound") . '</div>';
|
||||||
|
print '<div class="info">';
|
||||||
|
print '<a href="declarationtva_create.php" class="butAction">' . $langs->trans("CreateDeclaration") . '</a>';
|
||||||
|
print '</div>';
|
||||||
} else {
|
} else {
|
||||||
|
print '<div class="info">';
|
||||||
|
print '<a href="declarationtva_create.php" class="butAction">' . $langs->trans("CreateDeclaration") . '</a>';
|
||||||
|
print '</div>';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>' . $langs->trans("DeclarationNumber") . '</th>';
|
print '<th>' . $langs->trans("DeclarationNumber") . '</th>';
|
||||||
print '<th>' . $langs->trans("Period") . '</th>';
|
print '<th>' . $langs->trans("Period") . '</th>';
|
||||||
|
print '<th>' . $langs->trans("StartDate") . '</th>';
|
||||||
|
print '<th>' . $langs->trans("EndDate") . '</th>';
|
||||||
print '<th>' . $langs->trans("Status") . '</th>';
|
print '<th>' . $langs->trans("Status") . '</th>';
|
||||||
print '<th>' . $langs->trans("NetVATDue") . '</th>';
|
print '<th>' . $langs->trans("NetVATDue") . '</th>';
|
||||||
print '<th>' . $langs->trans("Actions") . '</th>';
|
print '<th>' . $langs->trans("Actions") . '</th>';
|
||||||
@ -153,6 +127,8 @@ if (empty($declarations)) {
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $d['declaration_number'] . '</td>';
|
print '<td>' . $d['declaration_number'] . '</td>';
|
||||||
print '<td>' . $d['period_name'] . '</td>';
|
print '<td>' . $d['period_name'] . '</td>';
|
||||||
|
print '<td>' . dol_print_date($d['start_date'], 'day') . '</td>';
|
||||||
|
print '<td>' . dol_print_date($d['end_date'], 'day') . '</td>';
|
||||||
print '<td>' . $langs->trans("Status" . ucfirst($d['status'])) . '</td>';
|
print '<td>' . $langs->trans("Status" . ucfirst($d['status'])) . '</td>';
|
||||||
print '<td>' . price($d['net_vat_due']) . '</td>';
|
print '<td>' . price($d['net_vat_due']) . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -170,7 +146,6 @@ if (empty($declarations)) {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// Print configuration section
|
// Print configuration section
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user