} else { $width = 700; } if (is_numeric($_GET['height'])) { $height = $_GET['height']; } else { $height = 300; } if (is_numeric($_GET['nb_months'])) { $nb_months = $_GET['nb_months']; } else { $nb_months = 12; } if (preg_match("!^[0-9]+(|,[0-9]+)\$!", $_GET['limit_clients'])) { // Matches 5 and 10,5 and nothing else $limit_clients = "LIMIT " . $_GET['limit_clients']; } else { $limit_clients = ""; } global $User; $bar = new barGraph($width, $height, $User->prefs->graphgrid); $bar->setFont($GLOBALS['_SERVER']['DOCUMENT_ROOT'] . "/css/themes/" . $User->prefs->theme . "/buttonfont.ttf"); $bar->setBarColor(103, 133, 195); # NBI blue $result = mysql_query("SELECT sum(fl.prix_ht*fl.qtt) as total, count(f.id_facture) as nb_factures, c.nom\n FROM webfinance_invoices as f, webfinance_invoice_rows as fl, webfinance_clients as c\n WHERE fl.id_facture=f.id_facture\n AND f.type_doc = 'facture'\n AND f.id_client = c.id_client\n AND f.date_facture>=DATE_SUB(now(), INTERVAL {$nb_months} MONTH)\n GROUP BY c.id_client\n ORDER BY total DESC\n {$limit_clients}") or wf_mysqldie(); $count = mysql_num_rows($result); while ($billed = mysql_fetch_object($result)) { $billed->total = sprintf("%d", $billed->total); $bar->addValue($billed->total, $count--, $billed->nom . "\n" . preg_replace("/\\./", ",", sprintf("%.1f", $billed->total / 1000)) . "K€", preg_replace("/\\./", ",", sprintf("%.1f", $billed->total / 1000)) . "K€"); } $bar->realise();
// $Id: clients_debpt.php 531 2007-06-13 12:32:31Z thierry $ #header("Content-type: text/plain"); require "../inc/main.php"; require "../inc/barGraph.php"; must_login(); if (is_numeric($_GET['width'])) { $width = $_GET['width']; } else { $width = 700; } if (is_numeric($_GET['height'])) { $height = $_GET['height']; } else { $height = 300; } if (is_numeric($_GET['nb_months'])) { $nb_months = $_GET['nb_months']; } else { $nb_months = 12; } global $User; $bar = new barGraph($width, $height, $User->prefs->graphgrid); $bar->setFont($GLOBALS['_SERVER']['DOCUMENT_ROOT'] . "/css/themes/" . $User->prefs->theme . "/buttonfont.ttf"); $bar->setBarColor(255, 92, 92); $result = mysql_query("SELECT sum(fl.prix_ht*fl.qtt) as total, count(f.id_facture) as nb_factures, c.nom\n FROM webfinance_invoices as f, webfinance_invoice_rows as fl, webfinance_clients as c\n WHERE fl.id_facture=f.id_facture\n AND f.type_doc = 'facture'\n AND f.is_paye=0\n AND f.id_client = c.id_client\n AND f.date_facture>=DATE_SUB(now(), INTERVAL {$nb_months} MONTH)\n GROUP BY c.id_client\n ORDER BY total") or wf_mysqldie(); $count = mysql_num_rows($result); while ($billed = mysql_fetch_object($result)) { $billed->total = sprintf("%d", $billed->total); $bar->addValue($billed->total, $count--, $billed->nom . "\n" . preg_replace("/\\./", ",", sprintf("%.1f", $billed->total / 1000)) . "K€", preg_replace("/\\./", ",", sprintf("%.1f", $billed->total / 1000)) . "K€"); } $bar->realise();