Mise à jour du au nouveau script de graph

This commit is contained in:
Rodolphe Quiedeville 2005-10-18 10:37:57 +00:00
parent 55a571ca60
commit 1884320f18

View File

@ -32,6 +32,9 @@ $img_root = DOL_DATA_ROOT."/graph/telephonie/";
$nbval = 14; $nbval = 14;
/*
* Remplacé par ...statistiques-fournisseurs.php
*
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph = 'communications.duree'"; $sql .= " WHERE graph = 'communications.duree'";
@ -40,52 +43,9 @@ $resql = $db->query($sql);
$sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)"; $sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
$sql .= " GROUP BY date_format(date, '%Y%m') ASC"; $sql .= " GROUP BY date_format(date, '%Y%m') ASC";
$resql = $db->query($sql); $resql = $db->query($sql);
_deal($db, $resql, "communications.duree", $kilomindurees, $labels);
_deal($resql, $db, "communications.duree", $kilomindurees, $labels);
/*
if ($resql)
{
$durees = array();
$kilomindurees = array();
$durees_moyenne = array();
$nombres = array();
$labels = array();
$num = $db->num_rows($resql);
$lim = ($num - $nbval);
$i = 0;
$j = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
if ($i >= $lim )
{
$labels[$j] = $row[0];
$durees[$j] = $row[1];
$kilomindurees[$j] = ($row[1]/60000);
$durees_moyenne[$j] = ($row[1] / $row[2]);
$nombres[$j] = $row[2];
$sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";
$sqli .= " (graph, ord, legend, valeur) VALUES (";
$sqli .= "'communications.duree','".$j."','".$row[0]."','".($row[1]/60)."')";
if (!$resqli = $db->query($sqli))
{
print $db->error();
}
$j++;
}
$i++;
}
}
*/
$file = $img_root . "communications/duree.png"; $file = $img_root . "communications/duree.png";
$graphgain = new GraphBar ($db, $file); $graphgain = new GraphBar ($db, $file);
@ -94,6 +54,7 @@ $graphgain->width = 480 ;
$graphgain->titre = "Nb minutes (milliers)"; $graphgain->titre = "Nb minutes (milliers)";
print $graphgain->titre."\n"; print $graphgain->titre."\n";
$graphgain->GraphDraw($file, $kilomindurees, $labels); $graphgain->GraphDraw($file, $kilomindurees, $labels);
*/
/* /*
* *
@ -154,17 +115,12 @@ $graphgain->titre = "Nb minutes -> portables (milliers)";
print $graphgain->titre."\n"; print $graphgain->titre."\n";
$graphgain->GraphDraw($file, $kilomindurees_mob, $labels); $graphgain->GraphDraw($file, $kilomindurees_mob, $labels);
function _deal($db, $resql, $graph, &$data, &$labels) function _deal($db, $resql, $graph, &$data, &$labels)
{ {
global $nbval; global $nbval;
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$lim = ($num - $nbval); $lim = ($num - $nbval);
$i = 0; $i = 0;
@ -192,8 +148,5 @@ if ($resql)
$i++; $i++;
} }
} }
} }
?> ?>