*/ session_name('LetterBox2'); session_start(); 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(); $db = new dbquery(); $db->connect(); $db2 = new dbquery(); $db2->connect(); $graphi = new graphics(); $table = 'res_x'; $_SESSION['labels1'] = array(); $_SESSION['labels2'] = array(); $year = date('Y'); $label_month = ''; ?> <?php echo $_SESSION['config']['applicationname']; ?> "") { $my_year = $_SESSION['year']; $the_date = " year(CREATION_DATE) = '".$my_year."'"; $title = _TITLE_STATS_ONE." (".date("Y").")"; } elseif ($_SESSION['month'] <> "") { $my_month = $_SESSION['month']; $the_date = " year(CREATION_DATE) = '".date("Y")."' and month(CREATION_DATE) = '".$my_month."'"; $title = _TITLE_STATS_ONE." (".$db->get_month_name($my_month)." ".date("Y").")"; } $val_an = array(); $has_data = false; if ($_SESSION['year'] <> "") { for($i=1; $i<= 12; $i++) { $db->query("SELECT datediff( custom_d3, creation_date ) AS DELAI FROM ".$table." WHERE month( creation_date ) = ".$i." and YEAR(creation_date) = ".$my_year." AND STATUS = 'END' AND IS_FOLDER = 'Y'"); if( $db->nb_result() > 0) { $tmp = 0; while($res = $db->fetch_object()) { $tmp = $tmp + $res->DELAI; } array_push($val_an, (string)$tmp / $db->nb_result()); if($tmp / $db->nb_result() > 0) { $has_data = true; } } else { array_push($val_an, 0); } } $_SESSION['labels1'] = array("Jan", "Fev", "Mar", "Avr", "Mai", "Jun", "Jui", "Aou", "Sep", "Oct", "Nov", "Dec"); $title1 = _TITLE_STATS_ONE." (".$my_year.")"; $src1 = "graphs.php?type=histo&largeur=650&hauteur=400&titre=".$title1."&labelX=MOIS&labelY="._N_DAYS; for($i=0;$i "") { $val_mois = array(); for($i=1; $i<= 31; $i++) { array_push( $_SESSION['labels2'],(string) $i); $db->query("SELECT datediff( custom_d3, creation_date ) AS DELAI FROM ".$table." WHERE month( creation_date ) = ".$my_month." and YEAR(creation_date) = ".date("Y")." and day(CREATION_DATE) = ".$i." AND STATUS = 'END' AND IS_FOLDER = 'Y'"); if( $db->nb_result() > 0) { $tmp = 0; while($res = $db->fetch_object()) { $tmp = $tmp + $res->DELAI; } array_push($val_mois, $tmp / $db->nb_result()); $has_data = true; } else { array_push($val_mois, 0); } } $title2 = _TITLE_STATS_ONE;": ".date("M"); $src2 = "graphs.php?type=courbe&id=an&largeur=670&hauteur=400&titre=".$title."&labelX="._DAYS."&labelY="._N_DAYS; for($i=0;$i "" && $has_data) { ?> <? echo $title1;?> "" && $has_data) {?> <? echo $title;?>
'._NO_DATA_MESSAGE.'
'; } } elseif($_GET['type'] == "barre") { if($_GET['id'] == "delai_type") { $db->query("select distinct TYPE_ID from ".$_SESSION['tablename']['doctypes']." where RES_TABLE = 'res_x' "); $types = array(); $etiq = array(); $has_data = false; while( $line = $db->fetch_object() ) { array_push($etiq, $line->TYPE_ID); if(isset($_SESSION['year']) && !empty($_SESSION['year'])) { $query = "SELECT datediff( custom_d3, creation_date ) AS DELAI FROM ".$table." WHERE TYPE_ID = '".$line->TYPE_ID."' AND STATUS = 'END' AND IS_FOLDER = 'Y' and YEAR(creation_date) = ".$_SESSION['year']; $year = $_SESSION['year']; } elseif(isset($_SESSION['month']) && !empty($_SESSION['month'])) { $query = "SELECT datediff( custom_d3, creation_date ) AS DELAI FROM ".$table." WHERE TYPE_ID = '".$line->TYPE_ID."' AND STATUS = 'END' AND IS_FOLDER = 'Y' and YEAR(creation_date) = ".$year." and MONTH(creation_date) = ".$_SESSION['month']; $label_month = $db->get_month_name($_SESSION['month']); } else { $query = "SELECT datediff( custom_d3, creation_date ) AS DELAI FROM ".$table." WHERE TYPE_ID = '".$line->TYPE_ID."' AND STATUS = 'END' AND IS_FOLDER = 'Y' and YEAR(creation_date) = ".$year; } $db2->query($query); //$db2->show(); if( $db2->nb_result() > 0) { $tmp = 0; while($res = $db2->fetch_object()) { $tmp = $tmp + $res->DELAI; } array_push($types,(string) $tmp / $db2->nb_result()); if( $tmp / $db2->nb_result() > 0) { $has_data = true; } } else { array_push($types, 0); } } $title = _TITLE_STATS_TWO." (".$label_month." ".$year." )"; $src = "graphs.php?type=histo&largeur=790&hauteur=550&titre=".$title."&marge_bas=150&labelY="._STATS_LABEL01; for($i=0;$i <? echo $title; ?>
'._NO_DATA_MESSAGE.'
'; } } /*elseif($_GET['id'] == "vol_quartier") { $vol_quart = array(); for($i=0; $i < count($_SESSION['quartiers']); $i++) { $db->query("select count(*) as TOTAL from ".$table." where CUSTOM_T14 = '".$_SESSION['quartiers'][$i]."' and STATUS <> 'REP' and YEAR(creation_date) =".year." "); //$db->show(); $res = $db->fetch_object(); array_push($vol_quart, $res->TOTAL); } $title = _TITLE_STATS_THREE." ".date('Y')." : "; $src = "graphs.php?type=histo&largeur=400&hauteur=500&titre=".$title."&marge_bas=140&labelY="._STATS_LABEL02."&labelX="._STATS_LABEL03; for($i=0;$i
<? echo $title; ?>
"") { $my_year = $_SESSION['year']; $the_date = " year(CREATION_DATE) = '".$my_year."'"; $title =_TITLE_STATS_FOUR." (".$my_year.") "; } elseif ($_SESSION['statspol_datestart'] <> "" && $_SESSION['statspol_datefin'] <> "") { $my_datestart= $_SESSION['statspol_datestart']; $my_datefin = $_SESSION['statspol_datefin']; $title = _TITLE_STATS_FOUR." (".$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 ($_SESSION['month'] <> "") { $my_month = $_SESSION['month']; $the_date = " year(CREATION_DATE) = '".date("Y")."' and month(CREATION_DATE) = '".$my_month."'"; $title = _TITLE_STATS_FOUR." (".$db->get_month_name($my_month)." ".date("Y")." : "; } $db->query("select ID, SERVICE from ".$_SESSION['tablename']['services']." where ENABLED = 'Y' order by ID"); $services = array(); $vol_serv = array(); while($line = $db->fetch_object()) { array_push($services, $line->ID); $db2->query("select count(*) as TOTAL from ".$table." where DESTINATION = '".$line->ID."' and ".$the_date); $res = $db2->fetch_object(); array_push($vol_serv, $res->TOTAL); if($res->TOTAL > 0) { $has_data = true; } } $src = "graphs.php?type=histo&largeur=780&hauteur=500&titre=".$title."&marge_bas=100&labelY="._STATS_LABEL04."&labelX="._STATS_LABEL05; for($i=0;$i
<? echo $title; ?>

'._NO_DATA_MESSAGE.'
'; } } elseif($_GET['id'] == "vol_retard_service") { $has_data = false; $db->query("select ID, SERVICE from ".$_SESSION['tablename']['services']." where ENABLED = 'Y' order by ID"); $services = array(); $vol = array(); while($line = $db->fetch_object()) { array_push($services, $line->ID); $db2->query("select count(*) as TOTAL from ".$table." where DESTINATION = '".$line->ID."' and (STATUS = 'NEW' or STATUS = 'COU') AND IS_FOLDER = 'Y' and datediff(curdate(), CUSTOM_D5) >= 0 "); //$db2->show(); $res = $db2->fetch_object(); array_push($vol, $res->TOTAL); if($res->TOTAL > 0) { echo $res->TOTAL."
"; $has_data = true; } } $title = _TITLE_STATS_FIVE." "; $src = "graphs.php?type=histo&largeur=780&hauteur=500&titre=".$title."&marge_bas=100&labelY="._STATS_LABEL06."&labelX="._STATS_LABEL07; for($i=0;$i
<? echo $title; ?>

'._NO_DATA_MESSAGE.'
'; } } } elseif($_GET['type'] == "camembert") { if($_GET['id'] == "typo_service") { if ($_SESSION['year'] <> "") { $my_year = $_SESSION['year']; $the_date = " year(CREATION_DATE) = '".$my_year."'"; } elseif ($_SESSION['statspol_datestart'] <> "" && $_SESSION['statspol_datefin'] <> "") { $my_datestart= $_SESSION['statspol_datestart']; $my_datefin = $_SESSION['statspol_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 ($_SESSION['month'] <> "") { $my_month = $_SESSION['month']; $the_date = " year(CREATION_DATE) = '".date("Y")."' and month(CREATION_DATE) = '".$my_month."'"; } $services = array(); $db->query("select distinct DESTINATION from ".$table." where ".$the_date." and STATUS <> 'REP' and IS_FOLDER = 'Y'"); //$db->show(); while($line = $db->fetch_object()) { $db2->query("select ID, SERVICE from ".$_SESSION['tablename']['services']." where ID = '".$line->DESTINATION."'"); $res = $db2->fetch_object(); array_push($services, array('ID' => $res->ID, "SERVICE" => $res->SERVICE)); } ?>

:

"") { $my_year = $_SESSION['year']; $the_date = " year(CREATION_DATE) = '".$my_year."'"; $title = _TITLE_STATS_SEVEN." (".date("Y").")"; } elseif ($_SESSION['statspol_datestart'] <> "" && $_SESSION['statspol_datefin'] <> "") { $my_datestart= $_SESSION['statspol_datestart']; $my_datefin = $_SESSION['statspol_datefin']; $title = _TITLE_STATS_SEVEN." (".$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 ($_SESSION['month'] <> "") { $my_month = $_SESSION['month']; $the_date = " year(CREATION_DATE) = '".date("Y")."' and month(CREATION_DATE) = '".$my_month."'"; $label_month = $db->get_month_name($my_month); $title = _TITLE_STATS_SEVEN." (".$label_month." ".date("Y").")"; } $db->query("select distinct TYPE_ID from ".$table." where STATUS <> 'REP' and ".$the_date); $vol_an = array(); $vol_mois = array(); while($line = $db->fetch_object()) { $tmp = addslashes($line->TYPE_ID); array_push($_SESSION['labels1'], (string) $line->TYPE_ID); $db2->query("select count(*) as TOTAL from ".$table." where STATUS <> 'REP' AND IS_FOLDER = 'Y' and ".$the_date." and TYPE_ID = '".$tmp."'"); //$db2->show(); $res = $db2->fetch_object(); array_push($vol_an, $res->TOTAL); if($res->TOTAL > 0) { $has_data = true; } } $src1 = "graphs.php?type=pie&largeur=750&hauteur=280&titre=".$title; for($i=0;$i <? echo $title1;?>


'._NO_DATA_MESSAGE.'
'; } } } ?>