added prefernce business overview

This commit is contained in:
2026-10-22 13:48:48 +02:00
parent 33c81e2ad1
commit c4a3e48dd2
12 changed files with 3777 additions and 206 deletions
+14 -7
View File
@@ -404,7 +404,8 @@ if ($action === 'data') {
SUM(CASE WHEN x.order_date > CURDATE() - INTERVAL 30 DAY THEN x.taxable_amount ELSE 0 END) AS v30,
SUM(x.order_date <= CURDATE() - INTERVAL 30 DAY AND x.order_date > CURDATE() - INTERVAL 60 DAY) AS n30p,
SUM(CASE WHEN x.order_date <= CURDATE() - INTERVAL 30 DAY AND x.order_date > CURDATE() - INTERVAL 60 DAY THEN x.taxable_amount ELSE 0 END) AS v30p,
COUNT(DISTINCT CASE WHEN x.order_date > CURDATE() - INTERVAL 30 DAY THEN x.customer END) AS c30
COUNT(DISTINCT CASE WHEN x.order_date > CURDATE() - INTERVAL 30 DAY THEN x.customer END) AS c30,
CURDATE() AS d0, CURDATE() - INTERVAL 6 DAY AS d7, CURDATE() - INTERVAL 29 DAY AS d30
FROM $from
WHERE x.status <> 'annullato' AND x.order_date > CURDATE() - INTERVAL 60 DAY AND x.order_date <= CURDATE()
", [])[0];
@@ -416,7 +417,9 @@ if ($action === 'data') {
'v' => (float)$fl['v0'],
'np' => (int)$fl['n0p'],
'vp' => (float)$fl['v0p'],
'vs' => 'stesso giorno della settimana scorsa'
'vs' => 'stesso giorno della settimana scorsa',
'from' => (string)$fl['d0'],
'to' => (string)$fl['d0']
],
[
'key' => 'week',
@@ -425,7 +428,9 @@ if ($action === 'data') {
'v' => (float)$fl['v7'],
'np' => (int)$fl['n7p'],
'vp' => (float)$fl['v7p'],
'vs' => '7 giorni precedenti'
'vs' => '7 giorni precedenti',
'from' => (string)$fl['d7'],
'to' => (string)$fl['d0']
],
[
'key' => 'month',
@@ -435,7 +440,9 @@ if ($action === 'data') {
'np' => (int)$fl['n30p'],
'vp' => (float)$fl['v30p'],
'vs' => '30 giorni precedenti',
'customers' => (int)$fl['c30']
'customers' => (int)$fl['c30'],
'from' => (string)$fl['d30'],
'to' => (string)$fl['d0']
],
];
@@ -1868,7 +1875,7 @@ if ($action === 'data') {
<div class="legend-strip">
<span><span class="dot green"></span> Bene</span>
<span><span class="dot yellow"></span> Così così: da tenere d'occhio</span>
<span><span class="dot red"></span> Da Migliorare: serve un intervento</span>
<span><span class="dot red"></span> Male: serve un intervento</span>
<span><span class="dot grey"></span> Dato non disponibile</span>
<span class="ms-auto">Clicca una tessera per i dettagli · ⓘ per la spiegazione</span>
</div>
@@ -1902,7 +1909,7 @@ if ($action === 'data') {
const LIGHT_LABEL = {
green: 'Bene',
yellow: 'Così così',
red: 'Da Migliorare',
red: 'Male',
grey: 'n.d.'
};
const LIGHT_ICON = {
@@ -2025,7 +2032,7 @@ if ($action === 'data') {
month: 'fa-calendar'
};
$('#flow').html((d.flow || []).map(f => `
<a class="fl-card" href="sales_orders_stats.php" title="Apri Andamento ordini">
<a class="fl-card" href="sales_orders_stats.php?from=${encodeURIComponent(f.from || '')}&to=${encodeURIComponent(f.to || '')}&st=aperto,evaso,bloccato" title="Apri questi ordini in Andamento ordini">
<div class="fl-top"><span class="fl-t"><i class="fa-solid ${icons[f.key]} me-1"></i>${esc(f.title)}</span></div>
<div class="fl-row">
<div>