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 59 60 61 62 63 64 65 66 67 68
| echo "<table width='100%'>";
/*****************************************************************************************************************/
/********************************EN-TETE DE COLONNE : DATE********************************************************/
foreach($tab_dates as $an){
if($an=$anneedatedebut){
foreach($tab_dates as $mois){
if($mois=$moisdatedebut){
$stop=0;
if(isset($tab_dates))
echo"<tr>";
echo"<th>Mois</th>";
while($anneedatedebut<=$anneedatefin && $stop==0){
if($moisdatedebut>12){
$moisdatedebut=1;
$anneedatedebut++;
}
echo "<th>".$moisdatedebut."/".$anneedatedebut."</th>";
if($moisdatedebut==$moisdatefin && $anneedatedebut==$anneedatefin) $stop++;
$moisdatedebut++;
}
echo "</tr>";
/****************************************************************************************************************/
/********************************************REQUETE*************************************************************/
$j=0;
$reqAffich1 = "SELECT count(".$tab_donnees[$j][5].") as nombredefnc, month(".$tab_donnees[$j][4].") ,year(".$tab_donnees[$j][4].") from ".$tab_donnees[$j][2]." where ".$tab_donnees[$j][3]."=$idfou group by year(".$tab_donnees[$j][4]."),month(".$tab_donnees[$j][4].")";
// echo $reqAffich1;
$result1=mysqli_query($cnx,$reqAffich1) or die ("Erreur de la requête 1");
$j=1;
$reqAffich2="SELECT sum(".$tab_donnees[$j][5].") as cout, month(".$tab_donnees[$j][4].") ,year(".$tab_donnees[$j][4].") from ".$tab_donnees[$j][2]." where ".$tab_donnees[$j][3]."=$idfou group by year(".$tab_donnees[$j][4]."),month(".$tab_donnees[$j][4].")";
// echo $reqAffich2;
$result2= mysqli_query($cnx, $reqAffich2) or die ("Erreur de la requête 2");
$j=2;
$reqAffich3="SELECT sum(".$tab_donnees[$j][5].") as heure, month(".$tab_donnees[$j][4].") ,year(".$tab_donnees[$j][4].") from ".$tab_donnees[$j][2]." where ".$tab_donnees[$j][3]."=$idfou group by year(".$tab_donnees[$j][4]."),month(".$tab_donnees[$j][4].")";
// echo $reqAffich3;
$result3= mysqli_query($cnx, $reqAffich3) or die ("Erreur de la requête 3");
/****************************************************************************************************************/
$j=0;
/*****************************EN TETE DE LIGNE ET DONNEES********************************************************/
while(isset($tab_donnees[$j])){
echo "<tr>";
echo "<th>".$tab_donnees[$j][1]."</th>";
while($row1 = mysqli_fetch_array($result1)){
echo "<td><center>".$row1['nombredefnc']."</center></td>";
}
$j++;
echo "</tr><tr><th>".$tab_donnees[$j][1]."</th>";
while($row2= mysqli_fetch_array($result2)){
echo "<td><center>".$row2['cout']."</center></td>";
}
$j++;
echo "</tr><tr><th>".$tab_donnees[$j][1]."</th>";
while($row3= mysqli_fetch_array($result3)){
echo "<td><center>".$row3['heure']."</center></td>";
}
$j++;
}
}
}
}
}
echo "</tr>";
echo "</table>"; |
Partager