1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-11 07:05:22 +01:00
This commit is contained in:
Loviuz 2017-12-05 01:19:40 +01:00
parent 8b464c8c85
commit 62303ae3e0

View File

@ -72,7 +72,7 @@ echo '
</button>
</div>
</div>
<canvas class="box-body collapse in" id="fatturato"></canvas>
<canvas class="box-body collapse in" id="fatturato" height="100"></canvas>
</div>';
// Script per il grafico del fatturato
@ -204,12 +204,12 @@ echo '
</div>
</div>';
// Interventi per stato
$stati = $dbo->fetchArray('SELECT * FROM `in_statiintervento`');
// Interventi per tipologia
$tipi = $dbo->fetchArray('SELECT * FROM `in_tipiintervento`');
$dataset = '';
foreach ($stati as $stato) {
$interventi = $dbo->fetchArray('SELECT COUNT(*) AS totale, YEAR(in_interventi.data_richiesta) AS year, MONTH(in_interventi.data_richiesta) AS month FROM in_interventi WHERE in_interventi.idstatointervento = '.prepare($stato['idstatointervento']).' AND in_interventi.data_richiesta BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY YEAR(in_interventi.data_richiesta), MONTH(in_interventi.data_richiesta) ORDER BY YEAR(in_interventi.data_richiesta) ASC, MONTH(in_interventi.data_richiesta) ASC');
foreach ($tipi as $tipo) {
$interventi = $dbo->fetchArray('SELECT COUNT(*) AS totale, YEAR(in_interventi.data_richiesta) AS year, MONTH(in_interventi.data_richiesta) AS month FROM in_interventi WHERE in_interventi.idtipointervento = '.prepare($tipo['idtipointervento']).' AND in_interventi.data_richiesta BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY YEAR(in_interventi.data_richiesta), MONTH(in_interventi.data_richiesta) ORDER BY YEAR(in_interventi.data_richiesta) ASC, MONTH(in_interventi.data_richiesta) ASC');
$month = intval($d1->format('m')) - 1;
for ($i = 0; $i < $count; ++$i) {
@ -224,9 +224,12 @@ foreach ($stati as $stato) {
++$month;
}
//Random color
$background = '#' . dechex(rand(256,16777215));
$dataset .= '{
label: "'.$stato['descrizione'].'",
backgroundColor: "'.$stato['colore'].'",
label: "'.$tipo['descrizione'].'",
backgroundColor: "'.$background.'",
data: [
'.implode(',', array_column($interventi, 'totale')).'
]
@ -236,7 +239,7 @@ foreach ($stati as $stato) {
echo '
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">'.tr('Interventi per stato').'</h3>
<h3 class="box-title">'.tr('Interventi per tipologia').'</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
@ -244,7 +247,7 @@ echo '
</button>
</div>
</div>
<canvas class="box-body collapse in" id="interventi"></canvas>
<canvas class="box-body collapse in" id="interventi" height="100"></canvas>
</div>';
// Script per il grafico del fatturato