';
-
-
/* */
-print '';
-print '| Lignes suivies | ';
-print '| Nom | Nb Lignes | | ';
-
$sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " , ".MAIN_DB_PREFIX."user as c";
+$sql .= " LEFT JOIN llx_telephonie_distributeur_commerciaux as dc ON dc.fk_user = c.rowid";
+
$sql .= " WHERE c.rowid = l.fk_commercial_suiv";
$sql .= " AND l.statut <> 7";
+$sql .= " AND dc.fk_distributeur IS NULL";
$sql .= " GROUP BY c.name ORDER BY cc DESC";
+print '';
+print '| Lignes suivies | ';
+print '| Nom | Nb Lignes | | ';
+
$resql = $db->query($sql);
if ($resql)
{
@@ -74,7 +74,7 @@ if ($resql)
$i = 0;
$datas = array();
$legends = array();
-
+ $total = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
@@ -87,6 +87,7 @@ if ($resql)
print ''.$row[2]." ". $row[1].''.$row[0].' | ';
print 'Voir | ';
+ $total += $row[0];
$i++;
}
$db->free();
@@ -95,6 +96,10 @@ else
{
print $db->error() . ' ' . $sql;
}
+$var=!$var;
+print "";
+print '| Total | '.$total.' | ';
+print ' | ';
print ' ';
print '';
@@ -104,8 +109,10 @@ print '| Nom | query($sql);
@@ -115,7 +122,7 @@ if ($resql)
$i = 0;
$datas = array();
$legends = array();
-
+ $total= 0 ;
while ($i < $num)
{
$row = $db->fetch_row($i);
@@ -128,6 +135,7 @@ if ($resql)
print ''.$row[2]." ". $row[1].' | '.$row[0].' | ';
print 'Voir | ';
+ $total += $row[0];
$i++;
}
$db->free();
@@ -136,6 +144,10 @@ else
{
print $db->error() . ' ' . $sql;
}
+$var=!$var;
+print "";
+print '| Total | '.$total.' | ';
+print ' | ';
print ' ';
print '';
|