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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
| $sql = "SELECT DATE_DEBUT, DATE_FIN FROM BASE_INFO";
$req = odbc_exec($conn,$sql) or die('Erreur SQL : <br />'.$sql);
//--------------- Tableau des informations ouverture et cadence de la période actuelle ---------------//
while (odbc_fetch_row($req))
{
$datedeb=odbc_result($req,"DATE_DEBUT");
$datefin=odbc_result($req,"DATE_FIN");
list($daystart, $hh)=explode(" ",$datedeb);
list($dayend, $hh)=explode(" ",$datefin);
list($year, $month, $day)=explode("-",$daystart);
list($yearfin, $monthfin, $dayfin)=explode("-",$dayend);
$daystart = $day."-".$month."-".$year;
$dayend = $dayfin."-".$monthfin."-".$yearfin;
echo "<br>";
//--------------- Tableau ---------------//
//--------------- En tete de colonne ---------------//
$jour = array (Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi);
//--------------- OUVERTURE ---------------//
$sql1 = " SELECT JOUR.JOUR, JOUR.CADENCE, JOUR.OUVERTURE
FROM JOUR, BASE_INFO
WHERE JOUR.DATE_DEBUT=BASE_INFO.DATE_DEBUT";
$req = odbc_exec($conn,$sql1) or die('Erreur SQL : <br />'.$sql1);
while (odbc_fetch_row($req))
{
$tab_res[odbc_result($req,"JOUR")]['OUVERTURE']=odbc_result($req,"OUVERTURE");
$tab_res[odbc_result($req,"JOUR")]['CADENCE']=odbc_result($req,"CADENCE");
}
//------------------ Bouttons ------------------//
echo "<div style=\"text-align: center;\">";
echo "<input name=\"periode\" value=\"Période prévue\" onclick=\"window.open('Periode_prevue.php', 'utilisateur', config='width=600, height=600, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes');\" type=\"button\">";
echo "     ";
echo "<input name=\"periode\" value=\"Mettre a jour une période\" onclick=\"window.open('Formulaire_maj_periode.php', 'utilisateur', config='width=600, height=600, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no');\" type=\"button\">";
echo "<br><br>";
$i = 0;
while (odbc_fetch_row($req))
{
$tab_res[$i]['JOUR'] = odbc_result($req,"JOUR");
$tab_res[$i]['OUVERTURE']=odbc_result($req,"OUVERTURE");
$tab_res[$i++]['CADENCE']=odbc_result($req,"CADENCE");
}
//--------------- Tableau des informations ouverture et cadence de la période actuelle ---------------//
echo "<table border='0' cellpadding='0' cellspacing='0' width='500'>";
echo "<tbody>";
echo "<table style='width: 500px; height: 90px;' border='5' cellpadding='2' cellspacing='1'>";
echo "<tr>";
echo "<td class='table-titre' colspan='13'> Ouverture et Cadence pour la période du $daystart au $dayend</td>";
echo "</tr>";
//--------------- En tete de colonne ---------------//
echo "<tr>";
echo "<td class='table-entete' width='1'> </td>";
echo "<td class='table-entete' width='1'>$jour[0] </td>";
echo "<td class='table-entete-centre' width='20'>$jour[1] </td>";
echo "<td class='table-entete-centre' width='20'>$jour[2]</td>";
echo "<td class='table-entete-centre' width='20'>$jour[3] </td>";
echo "<td class='table-entete-centre' width='20'>$jour[4] </td>";
echo "<td class='table-entete-centre' width='20'>$jour[5] </td>";
echo "</tr>";
echo "<td class='table-ligne1-centre' width='100'> Ouverture </td>";
foreach($tab_res as $ligne)
{
echo '<td class=\'table-ligne1-centre\' width=\'100\'>'.$ligne['OUVERTURE'].'</td>';
}
echo "</tr>";
echo "<tr>";
echo "<td class='table-ligne1-centre' width='100'> Cadence </td>";
foreach($tab_res as $ligne)
{
echo '<td class=\'table-ligne1-centre\' width=\'100\'>'.$ligne['CADENCE'].'</td>';
}
echo "</tr>";
echo "<tr>";
echo "<td class='table-ligne1-centre' width='100'> Takt Time </td>";
foreach($tab_res as $ligne)
{
$taktime = round($ligne['OUVERTURE']/$ligne['CADENCE'], 2);
list($mm, $ss)=explode(".",$taktime);
$ss = $taktime - $mm;
$hhtaktime = "00";
$sstaktime = $ss*0.6;
$total = $mm+$sstaktime;
$total = round($total, 2);
list($mm, $ss)=explode(".",$total);
$total = $hhtaktime.":0".$mm.":".$ss;
echo "<td class='table-ligne1-centre' width='100'>$taktime ($total)</td>";
}
echo "</tr>";
echo '</table>';
echo "</div>";
}
//--------------- Fin du tableau ---------------//
echo "<br><br><br>"; |
Partager