1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
function tab_out_planning($result,$couleur) {
$nombre=mysql_num_fields($result);
$lesheures = "<td>";
$lesheures .= "<img src='images/les_heures.gif'></img>";
$lesheures .= "</td>";
$sql8 = "SELECT Date_prevue FROM planning ";
echo "<table width=1000 border=0 align='center' cellpadding='2' cellspacing='1'>";
echo "<tr bgcolor=#FFEFBF>";
echo "<th>".mysql_field_name($result,0)."</th>";
//echo "<th>".$sql8."</th>";
echo "<tr>".$lesheures."</tr>";
echo "</tr>";
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<tr bgcolor='$couleur'>";
$j = 0; // ce $j permet de n'afficher que la première colone de la requête.
foreach ($row as $elem) {
if ($j == 0){
$tailleimg = $elem*1000/780;
$lesheures = floor($elem/60);
$lesmin = $elem-60*$lesheures;
$tps_hhmm = $lesheures."h:".$lesmin."min";
$sql1 = "SELECT Plaque FROM camion WHERE Id_camion = ".$row['Id_camion_FK'];
$res1 = mysql_db_query("compagnie de transport", $sql1);
$row1 = mysql_fetch_array($res1,MYSQL_ASSOC);
$sql2 = "SELECT Nom FROM CLIENT WHERE Id_client = ".$row['Id_client_FK'];
$res2 = mysql_db_query("compagnie de transport", $sql2);
$row2 = mysql_fetch_array($res2,MYSQL_ASSOC);
$camion = "Camion ".$row1['Plaque'];
$client = "Client ".$row2['Nom'];
$les_infos = $tps_hhmm.' / '.$camion.' / '.$client;
$tps_decal_deb = $row['Heure_deb']*1000/780;
$laligne = "<td>";
$laligne .= "<img src='images/carre_incolor.gif' width='$tps_decal_deb' height='1'></img>";
$laligne .= "<img src='images/carre_blanc_2.gif' alt='$les_infos' width='$tailleimg' height='10'></img>";
$laligne .= "</td>";
echo $laligne;
$j = 1;
}
}
echo "</tr>";
}
echo "</table>";
} |
Partager