if ($tbl_km["consommationtype"] == 1) { $sql = "select * from " . __racinebd__ . "type_compte where compte_id=" . $_SESSION["compte_id"] . " and type_compte_id=" . $tbl_km["type_compte_id"]; $link2 = query($sql); $tbl2 = fetch($link2); $tbl_km["consotheorique"] = $tbl2["consommation"]; } else { $tbl_km["consotheorique"] = $tbl_km["consommation"]; } /* print $tbl["mintime"]."<br>"; print $tbl["maxtime"]; */ //recherche du km $_POST["vehicule"] = $tbl_km["phantom_device_id"]; require "rapport-gen2.php"; $tbl_km["datediff"] = secondsToTime2($totalconduite * 60); //$tbl_km["datediff"]=$totalconduite; $tbl_km["km"] = round($totaldistance, 2); $totalalldistance += $totaldistance; $tbl_km["conso"] = $tbl_km["consotheorique"] * (int) $tbl_km["km"] / 100; $totalallconso += $tbl_km["conso"]; $tbl_km["vitesse"] = vitessekmh($vitessemaxvehicule); $tbl_km["mintime"] = $trajet[0]["debut"]; //print $trajet[0]["debut"]; $tbl_km["maxtime"] = $trajet[count($trajet) - 1]["fin"]; $tbl_km["amplitude"] = dateDifference($tbl_km["mintime"], $tbl_km["maxtime"], '%d Jours %h H %i Min'); /* print strtotime($tbl_km["maxtime"])."<br>"; print strtotime($tbl_km["mintime"])."<br>"; */ $tbl_km["maxtime"] = $tbl_km["maxtime"] == "" ? $tbl_km["mintime"] : $tbl_km["maxtime"];
//mise a jour des moyennnes, transformation des vitesses, maj des coordonnés for ($j = 0; $j < count($tmptrajet); $j++) { if (strtotime($tmptrajet[$j]["fin"]) - strtotime($tmptrajet[$j]["debut"]) != 0) { $tmptrajet[$j]["moy"] = $tmptrajet[$j]["km"] / ((strtotime($tmptrajet[$j]["fin"]) - strtotime($tmptrajet[$j]["debut"])) / 3600); } else { $tmptrajet[$j]["moy"] = 0; } $tmptrajet[$j]["moy"] = $tmptrajet[$j]["moy"] > vitessekmh($tmptrajet[$j]["max"]) ? vitessekmh($tmptrajet[$j]["max"]) : $tmptrajet[$j]["moy"]; $tmptrajet[$j]["moy"] = (int) $tmptrajet[$j]["moy"]; $tmptrajet[$j]["max"] = vitessekmh($tmptrajet[$j]["max"]); $tmptrajet[$j]["coordonnees"] = "tablist[" . $j . "]= new Array();" . str_replace("tablist[]", "tablist[" . $j . "]", $tmptrajet[$j]["coordonnees"]); $tmptrajet[$j]["coordonnees2"] = $tmptrajet[$j]["coordonnees2"]; $contenttabcoordonnee .= $tmptrajet[$j]["coordonnees"]; $contenttabcoordonnee2 .= $tmptrajet[$j]["coordonnees2"]; if ($tmptrajet[$j + 1]["debut"] != "") { $tmptrajet[$j]["arret"] = secondsToTime2((int) (strtotime($tmptrajet[$j + 1]["debut"]) - strtotime($tmptrajet[$j]["fin"]))); $tmptrajet[$j]["arretintime"] = (int) (strtotime($tmptrajet[$j + 1]["debut"]) - strtotime($tmptrajet[$j]["fin"])); } else { $tmptrajet[$j]["arret"] = ""; } //debuttxt //$tbl_info=adressegps($tmptrajet[$j]["lat1"],$tmptrajet[$j]["lon1"]); if ($j == 0) { $tbl_info = adressegps($tmptrajet[$j]["lat1"], $tmptrajet[$j]["lon1"]); } else { $tbl_info = adressegps($tmptrajet[$j - 1]["lat2"], $tmptrajet[$j - 1]["lon2"]); } if (is_array($tbl_info)) { $debut = $tbl_info["adresse"] . "<br><img src=\"" . __racineweb__ . "/tpl/img/lieux/" . $tbl_info["icon"] . "\"> <span>" . $tbl_info["libelle"] . "</span>"; } else { $debut = $tbl_info;