This commit is contained in:
FabioL 2024-05-17 17:27:14 +02:00
commit 2179e9f30f
2 changed files with 92 additions and 77 deletions

View File

@ -33,8 +33,20 @@ echo '
$start = $_SESSION['period_start']; $start = $_SESSION['period_start'];
$end = $_SESSION['period_end']; $end = $_SESSION['period_end'];
// Fatturato
echo ' echo '
<div class="card card-warning"> <div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Vendite e acquisti').'</h4>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<div class="card card-warning collapsed-card">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">'.tr('Periodi temporali').'</h4> <h4 class="card-title">'.tr('Periodi temporali').'</h4>
<div class="card-tools"> <div class="card-tools">
@ -42,7 +54,7 @@ echo '
<i class="fa fa-plus"></i> '.tr('Aggiungi periodo').' <i class="fa fa-plus"></i> '.tr('Aggiungi periodo').'
</button> </button>
<button type="button" class="btn btn-tool" data-card-widget="collapse"> <button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i> <i class="fa fa-plus"></i>
</button> </button>
</div> </div>
</div> </div>
@ -50,21 +62,11 @@ echo '
<div class="card-body" id="calendars"> <div class="card-body" id="calendars">
</div> </div>
</div>
<canvas id="fatturato" height="50"></canvas>
</div>
</div>'; </div>';
// Fatturato
echo '
<div class="card card-success">
<div class="card-header">
<h4 class="card-title">'.tr('Vendite e acquisti').'</h4>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<canvas class="card-body" id="fatturato" height="500"></canvas>
</div>';
// Script per il grafico del fatturato // Script per il grafico del fatturato
echo ' echo '
<script> <script>
@ -219,7 +221,7 @@ $totale = $dbo->fetchArray('SELECT
echo ' echo '
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="card card-warning"> <div class="card card-info">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">'.tr('I 20 clienti TOP per il periodo').': '.Translator::dateToLocale($start).' - '.Translator::dateToLocale($end).'</h4> <h4 class="card-title">'.tr('I 20 clienti TOP per il periodo').': '.Translator::dateToLocale($start).' - '.Translator::dateToLocale($end).'</h4>
@ -306,7 +308,7 @@ $totale = $dbo->fetchArray('SELECT
echo ' echo '
<div class="col-md-6"> <div class="col-md-6">
<div class="card card-danger"> <div class="card card-info">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">'.tr('I 20 articoli più venduti per il periodo').': '.Translator::dateToLocale($start).' - '.Translator::dateToLocale($end).'</h4> <h4 class="card-title">'.tr('I 20 articoli più venduti per il periodo').': '.Translator::dateToLocale($start).' - '.Translator::dateToLocale($end).'</h4>
@ -388,6 +390,8 @@ foreach ($tipi as $tipo) {
} }
echo ' echo '
<div class="row">
<div class="col-md-6">
<div class="card card-info"> <div class="card card-info">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">'.tr('Numero interventi per tipologia').'</h4> <h4 class="card-title">'.tr('Numero interventi per tipologia').'</h4>
@ -399,7 +403,8 @@ echo '
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<canvas id="interventi_n_tipologia" height="100"></canvas> <canvas id="interventi_n_tipologia"></canvas>
</div>
</div> </div>
</div>'; </div>';
@ -445,6 +450,7 @@ foreach ($tipi as $tipo) {
} }
echo ' echo '
<div class="col-md-6">
<div class="card card-info"> <div class="card card-info">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">'.tr('Ore interventi per tipologia').'</h4> <h4 class="card-title">'.tr('Ore interventi per tipologia').'</h4>
@ -456,7 +462,9 @@ echo '
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<canvas id="interventi_ore_tipologia" height="100"></canvas> <canvas id="interventi_ore_tipologia"></canvas>
</div>
</div>
</div> </div>
</div>'; </div>';
@ -528,6 +536,8 @@ foreach ($tecnici as $tecnico) {
} }
echo ' echo '
<div class="row">
<div class="col-md-6">
<div class="card card-info"> <div class="card card-info">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">'.tr('Ore di lavoro per tecnico').'</h4> <h4 class="card-title">'.tr('Ore di lavoro per tecnico').'</h4>
@ -549,7 +559,8 @@ echo '
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<canvas id="sessioni" height="100"></canvas> <canvas id="sessioni"></canvas>
</div>
</div> </div>
</div>'; </div>';
@ -703,6 +714,8 @@ $dataset .= '{
] ]
},'; },';
echo ' echo '
<div class="col-md-6">
<div class="card card-info"> <div class="card card-info">
<div class="card-header"> <div class="card-header">
<h4 class="card-title">'.tr('Nuove anagrafiche').'</h4> <h4 class="card-title">'.tr('Nuove anagrafiche').'</h4>
@ -714,7 +727,9 @@ echo '
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<canvas id="n_anagrafiche" height="100"></canvas> <canvas id="n_anagrafiche"></canvas>
</div>
</div>
</div> </div>
</div>'; </div>';

View File

@ -44,8 +44,8 @@ class LineChart extends Stat {
labels.push(date.format("MMMM YYYY")); labels.push(date.format("MMMM YYYY"));
}); });
while (chart.data.badges.length < data.results.length) { while (chart.data.labels.length < data.results.length) {
chart.data.badges.push(""); chart.data.labels.push("");
} }
chart.data.datasets.push({ chart.data.datasets.push({
@ -100,11 +100,11 @@ class LineChart extends Stat {
color = color.substr(0, 7); color = color.substr(0, 7);
chart.data.datasets.splice(dataset_index, 1); chart.data.datasets.splice(dataset_index, 1);
chart.data.badges.splice(dataset_index, 1); chart.data.labels.splice(dataset_index, 1);
} }
while (chart.data.badges.length > max_length) { while (chart.data.labels.length > max_length) {
chart.data.badges.pop(""); chart.data.labels.pop("");
} }
chart.update(); chart.update();