From a48950fca897b84e75746dae2a2d0c1f0f15ef5d Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 16 May 2005 09:49:32 +0000 Subject: [PATCH] Ajout duree moyenne --- .../script/graph-statistiques-destination.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/telephonie/script/graph-statistiques-destination.php b/htdocs/telephonie/script/graph-statistiques-destination.php index f5f6cd18e20..f63a8665216 100644 --- a/htdocs/telephonie/script/graph-statistiques-destination.php +++ b/htdocs/telephonie/script/graph-statistiques-destination.php @@ -33,7 +33,7 @@ if ($db->query($sql)) } -$sql = "SELECT dest, count(cout_vente), sum(cout_vente)"; +$sql = "SELECT dest, count(cout_vente), sum(cout_vente), sum(duree)"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; $sql .= " GROUP BY dest"; @@ -62,11 +62,16 @@ else for ($i = 0 ; $i < $num ; $i++) { + $dm = ($dest[$i][3]/$dest[$i][1]); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats_destination"; - $sql .= " ( destination, nbappels, ca)"; + $sql .= " ( destination, nbappels, ca, duree, duree_moy)"; $sql .= " VALUES ('".$dest[$i][0]."'"; $sql .= ",".$dest[$i][1]; - $sql .= ",".$dest[$i][2].")"; + $sql .= ",".$dest[$i][2]; + $sql .= ",".$dest[$i][3]; + $sql .= ",".ereg_replace(",",".",$dm).")"; $resql = $db->query($sql); }