';
-$sql = "SELECT nom, ca, gain";
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+$sortfield = $_GET["sortfield"];
+
+if ($sortorder == "") $sortorder="DESC";
+if ($sortfield == "") $sortfield="ca";
+
+$sql = "SELECT nom, ca, gain, cout, marge";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_stats";
$sql .= " , " .MAIN_DB_PREFIX."societe";
$sql .= " WHERE idp = fk_client_comm";
-$sql .= " GROUP BY gain DESC";
+$sql .= " ORDER BY $sortfield $sortorder ";
+$sql .= " LIMIT 30";
if ($db->query($sql))
{
@@ -61,10 +66,13 @@ if ($db->query($sql))
print '';
print '| Client | Chiffre d\'affaire | ';
print 'Gain | ';
+
+ print_liste_field_titre("Marge","gain.php","marge");
+
print " \n";
$var=True;
- while ($i < min($num,$conf->liste_limit))
+ while ($i < $num)
{
$row = $db->fetch_row($i);
$var=!$var;
@@ -73,6 +81,7 @@ if ($db->query($sql))
print "".$row[0]." | \n";
print ''.price($row[1])." HT | \n";
print ''.price($row[2])." HT | \n";
+ print ''.round($row[4])." % | \n";
print "\n";
$i++;
}
@@ -84,23 +93,11 @@ else
print $db->error() . ' ' . $sql;
}
-print '';
-
-print ' ';
-
+//print '
';
print ' | ';
-
-print '| ';
-
-
-
-print ' | ';
-
print ' ';
-
-
$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");
|