include ("../common/public.php") ;
$grafico = array() ;
$fileToOpen = "./grafico_mese_$mese.php" ;
/*************************************************************************
* mi recupero gli agenti
************************************************************************/
if ($profilo = 3)
$wagente = " A.idagenti != 4 and A.idagenti != 5 and A.idagenti != 9 and A.idagenti != 10" ;
else
$wagente = " 1=1" ;
$qa = "
select
A.idagenti,
A.nome
from
agenti A
where
$wagente
order by
A.nome
" ;
list($na, $da) = $db->RecuperaDati($qa) ;
for ($i=0; $i<$na; $i++)
$arrAgenti[$da['idagenti'][$i]] = $da['nome'][$i] ;
$qtot = "
select
A.idagenti,
A.nome,
count(O.idordini) as tot
from
agenti A
left join ordini O on O.idagente = A.idagenti and
O.Anno = $anno
where
month(O.dataordine) = $mese + 1 and
$wagente
group by
A.idagenti,
A.nome
order by
A.nome
" ;
list($ntot, $dtot) = $db->RecuperaDati($qtot) ;
$grafico['setXAxis'] = "Agenti" ;
$grafico['setYAxis'] = "Ordini" ;
$grafico['titolo1'] = "TOTALE MESE - " . $arrMesi[$mese] . " $anno" ;
$grafico['num_agenti'] = count($arrAgenti) ;
foreach($arrAgenti as $id => $nome)
// while(list($id, $nome) = each($arrAgenti))
{
$grafico['labels'][] = $nome ;
// $grafico['agenti'][] = $nome ;
if (($index = array_search($id, $dtot['idagenti'])) === false)
{
$grafico['data'][] = 0 ;
}
else
{
$grafico['data'][] = $dtot['tot'][$index] ;
$grafico['totale'] += $dtot['tot'][$index] ;
}
}
$_SESSION['grafico'] = $grafico ;
?>
New Document
| |
Ordini per Agente per Mese |
Grafici - Totale Generale |
Grafici - Distribuzione per Mese |
|
| |
for ($i=0; $i<12; $i++)
{
if ($i == $mese)
printf("%s | \n", "7%", $arrMesi[$i]) ;
else
printf("%s | \n", "7%", $arrMesi[$i]) ;
}
?>
|