Indsæt i ugekalender
Hej EksperterJeg sidder og leget med et funktion der kan sætte mine arbejdstimer ind i en tabel der indeholder alle ugens dage fordelt på en linje med ugenummer. Samt den laver en total for alle ugerne.
Se mere her på min prøve side: http://f1e6692391587cd350b90e29171a85046e085aba.web6.temporaryurl.org/
Min kode er følgende:
<?php
$case = $mysqli->query("SELECT WEEKOFYEAR(caseDate) AS Uge,WEEKDAY(caseDate) AS Dag,caseNumber AS Beskrivelse,caseHours AS Timer FROM worksheet ORDER BY caseDate,Uge,Dag ASC") OR DIE($mysqli->error);
echo "<style>.week{background-color:rgb(0,190,130);}.weekend{background-color:rgb(231,231,231);} .f td {padding-top:10px;}</style>";
echo "<table cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"1\">\n";
echo "<tr> <td class=\"week\"> </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class=\"weekend\"></td> <td class=\"weekend\"></td> </tr>\n";
echo "<thead><tr> <th class=\"week\">Uge:</th> <th>Mandag (0)</th> <th>Tirsdag (1)</th> <th>Onsdag (2)</th> <th>Torsdag (3)</th> <th>Fredag (4)</th> <th class=\"weekend\">Lørdag (5)</th> <th class=\"weekend\">Søndag (6)</th> </tr></thead>\n";
echo "<tfoot class=\"f\"><tr> <td>Total:</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class=\"weekend\"></td> <td class=\"weekend\"></td> </tr></tfoot>\n";
echo "<caption style=\"font-size:18px;\"><strong>Arbejdsuge</strong></caption>\n";
echo "</table>\n";
echo "\n<h2>MySQL Data</h2>\n";
while($view = $case->fetch_array(MYSQLI_ASSOC))
{
foreach($view AS $key => $value)
{
echo $key." → ".str_replace(array(".50",".00"),array("½",""),$value)."; ";
}
echo "<br />\n";
}
?>
