You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.0 KiB
80 lines
2.0 KiB
<?php
|
|
session_start();
|
|
|
|
@include '../cgi-bin/conn.conn';
|
|
|
|
$dbConn=mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb);
|
|
|
|
// nome del file che creeremo
|
|
$filename="Report_".$_GET['data']."_".$_GET['ora'].".xls";
|
|
|
|
header ("Content-Type: application/vnd.ms-excel");
|
|
|
|
header ("Content-Disposition: inline; filename=$filename");
|
|
|
|
|
|
?>
|
|
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html lang=it><head>
|
|
<title>Report</title></head>
|
|
<body>
|
|
<table>
|
|
|
|
<?php
|
|
|
|
$data=$_GET['data'];
|
|
$orastart=$_GET['ora'];
|
|
$ora=$orastart;
|
|
|
|
$q3=mysqli_query($dbConn, "SELECT giorno FROM turni WHERE data='$data'");
|
|
while($r3=mysqli_fetch_row($q3)){$array3[]=$r3[0];}
|
|
|
|
$q2=mysqli_query($dbConn, "SELECT comuni.id, comuni.comune, ambiti.descrizione AS ambito FROM comuni,ambiti WHERE comuni.ambito=ambiti.id");
|
|
while($r2=mysqli_fetch_row($q2)){$array2[$r2[0]]=array($r2[1],$r2[2]);}
|
|
|
|
$q=mysqli_query($dbConn, "SELECT giorni.*,farmacie.nome AS F_nome, farmacie.comune AS F_comune
|
|
FROM giorni,farmacie WHERE giorni.farmacia=farmacie.id AND giorni.id IN(".implode(",",$array3).") ORDER BY F_comune");
|
|
|
|
if(mysqli_num_rows($q)){
|
|
|
|
echo "<tr><td bgcolor=\"#dddddd\" width=\"200\"><b>Comune</b></td><td bgcolor=\"#dddddd\" width=\"200\"><b>Farmacia</b></td><td bgcolor=\"#dddddd\" width=\"200\"><b>Ambito</b></td></tr>\n";
|
|
|
|
|
|
$rcount=0;
|
|
while($r=mysqli_fetch_array($q)){
|
|
|
|
|
|
switch($ora){
|
|
case ($ora<$r['mattina_from']): $return="notte";
|
|
break;
|
|
|
|
case ($ora>$r['mattina_from'] && $ora<=$r['mattina_to']): $return="mattina_stato";
|
|
break;
|
|
|
|
case ($ora>$r['mattina_to'] && $ora<=$r['pomeriggio_from']): $return="pranzo";
|
|
break;
|
|
|
|
case ($ora>$r['pomeriggio_from'] && $ora<=$r['pomeriggio_to']): $return="pomeriggio_stato";
|
|
break;
|
|
|
|
case ($ora>$r['pomeriggio_to']): $return="sera";
|
|
break;
|
|
|
|
}
|
|
|
|
if($r[$return]=="Aperto"){
|
|
$rcount++;
|
|
if($rcount%2){$bgcolor="#eeeeee";}else{$bgcolor="#f9f9f9";}
|
|
echo "<tr><td>".$array2[$r['F_comune']][0]."</td><td>".$r['F_nome']."</td><td>".$array2[$r['F_comune']][1]."</td></tr>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
?>
|
|
|
|
</table>
|
|
</body></html>
|