This commit is contained in:
Rodolphe Quiedeville 2005-06-15 14:04:51 +00:00
parent 527fb4e47c
commit 3c04ef681a
2 changed files with 164 additions and 0 deletions

View File

@ -249,6 +249,11 @@ class CommandeMethodeTableur extends CommandeMethode
$worksheet->write($j, 5, "Ajouter", $formatccb);
$worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc);
}
elseif ($obj->statut == 8)
{
$worksheet->write($j, 5, "Ajouter", $formatccb);
$worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc);
}
elseif($obj->statut == 4)
{
$worksheet->write($j, 5, "A Résilier", $formatccbr);

View File

@ -0,0 +1,159 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*
* Generation des graphiques
*
*
*
*/
require ("../../master.inc.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php");
$img_root = DOL_DATA_ROOT."/graph/telephonie/";
$nbval = 14;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph = 'communications.duree'";
$resql = $db->query($sql);
$sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
$sql .= " GROUP BY date_format(date, '%Y%m') ASC";
$resql = $db->query($sql);
_deal($db, $resql, "communications.duree", $kilomindurees, $labels);
$file = $img_root . "communications/duree.png";
$graphgain = new GraphBar ($db, $file);
$graphgain->show_console = 0 ;
$graphgain->width = 480 ;
$graphgain->titre = "Nb minutes (milliers)";
print $graphgain->titre."\n";
$graphgain->GraphDraw($file, $kilomindurees, $labels);
/*
*
*
*/
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph = 'communications.duree_mobiles'";
$resql = $db->query($sql);
$sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
$sql .= " WHERE numero like '06%'";
$sql .= " GROUP BY date_format(date, '%Y%m') ASC";
$resql = $db->query($sql);
if ($resql)
{
$durees = array();
$kilomindurees = 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_mob[$j] = ($row[1]/60000);
$sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";
$sqli .= " (graph, ord, legend, valeur) VALUES (";
$sqli .= "'communications.duree_mobiles','".$j."','".$row[0]."','".($row[1]/60)."')";
if (!$resqli = $db->query($sqli))
{
print $db->error();
}
$j++;
}
$i++;
}
}
$file = $img_root . "communications/duree_mob.png";
$graphgain = new GraphBar ($db, $file);
$graphgain->show_console = 0 ;
$graphgain->width = 480 ;
$graphgain->titre = "Nb minutes -> portables (milliers)";
print $graphgain->titre."\n";
$graphgain->GraphDraw($file, $kilomindurees_mob, $labels);
function _deal($db, $resql, $graph, &$data, &$labels)
{
global $nbval;
if ($resql)
{
$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];
$data[$j] = ($row[1]/60000);
$sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";
$sqli .= " (graph, ord, legend, valeur) VALUES (";
$sqli .= "'".$graph."','".$j."','".$row[0]."','".($row[1]/60)."')";
if (!$resqli = $db->query($sqli))
{
print $db->error();
}
$j++;
}
$i++;
}
}
}
?>