*/ include("session.php"); require_once("class_functions.php"); require_once("class_db.php"); require_once("class_graphics.php"); if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } else { $_SESSION['error'] = "Language file missing...
"; } $func = new functions(); $graphi = new graphics(); if ($_SESSION['year'] <> "") { $my_year = $_SESSION['year']; $the_date = " year(CREATION_DATE) = '".$my_year."'"; $screen_date = $my_year; } elseif ($_SESSION['statspol_datestart'] <> "" && $_SESSION['statspol_datefin'] <> "") { $my_datestart= $_SESSION['statspol_datestart']; $my_datefin = $_SESSION['statspol_datefin']; $screen_date = " (".$my_datestart." "._UNTIL." ".$my_datefin.")"; $my_datestart = $func->inverse_date($_SESSION['statspol_datestart'], "no", _RECIPIENT , "no"); $my_datefin = $func->inverse_date($_SESSION['statspol_datefin'], "no", _RECIPIENT , "no"); $the_date = " date(CREATION_DATE) >= '".$my_datestart."' and date(CREATION_DATE) <='".$my_datefin."' "; } elseif (isset($_SESSION['month'])&& !empty($_SESSION['month'])) { $my_month = $_SESSION['month']; $the_date = " year(CREATION_DATE) = '".date("Y")."' and month(CREATION_DATE) = '".$my_month."'"; $screen_date = $func->get_month_name($my_month)." ".date("Y"); } $table = "res_x"; $_SESSION['labels1'] = array(); $db = new dbquery(); $db->connect(); $db2 = new dbquery(); $db2->connect(); $typo = array(); if(isset($_GET['id']) && !empty($_GET['id'])) { $id = $_GET['id']; $db->query("select distinct TYPE_ID from ".$table." where STATUS <> 'REP' and ".$the_date." and DESTINATION = '".$id."'"); //$db-> show(); while($line = $db->fetch_object()) { array_push($_SESSION['labels1'], (string) $line->TYPE_ID); $tmp = $line->TYPE_ID; $tmp = str_replace("'", "\'", $tmp); $db2->query("select count(*) as TOTAL from ".$table." where STATUS <> 'REP' and ".$the_date." and TYPE_ID = '".$tmp."' and DESTINATION = '".$id."'"); //$db2->show(); $res = $db2->fetch_object(); array_push($typo, $res->TOTAL); } if($_SESSION['statspol_datestart'] <> "" && $_SESSION['statspol_datefin'] <> "") { $title = _DEPARTMENT." ".$_GET['service']." \n".$screen_date; } else { $title = _DEPARTMENT." ".$_GET['service']." (".$screen_date.")"; } $graphi->camembert(560,300, $typo,$title, $_SESSION['labels1']); } ?>