<?php
include("../bd/sql_variables.php");
$con= mysqli_connect("$sql_host", "$sql_usuario", "$sql_pass","$sql_db") or die(header ("No Disponible Servidor de Base de Datos"));


$idj=$_GET['idj'];
$ids=$_GET['ids'];
//$idtp=$_GET['idtp'];
$idga=$_GET['idga'];
$ida=$_GET['ida'];

//nombre de grupo area
$sqlserv = "SELECT (select o_idturn from tb_ordena where o_turn=b.h_horaturn)as tt, date_format(b.h_horaini,'%k:%i %p') as hini, date_format(b.h_horafin,'%k:%i %p') as hfin, b.h_horaturn as hturn, b.h_horanum as hnum FROM areahora a inner join tb_horario b on a.h_id=b.h_id ";
$sqlserv = $sqlserv." where a.s_id='$ids' and a.j_id='$idj' and a.a_id='$ida' and a.ga_id='$idga' order by tt";

//echo $sqlserv;
$resultserv = mysqli_query($con,$sqlserv);
//if()
$cadenahora="<table align='center'>";
$cadenahora=$cadenahora."<tr><td align='center' colspan='4' class ='FacetDataTextC'><b>HORARIOS CREADOS</b></td></tr>";
$cadenahora=$cadenahora."<tr><td align='center' class ='FacetDataTextC' width='100'>HORA INICIAL</td><td align='center' class ='FacetDataTextC' width='100'>HORA FIN</td><td align='center' class ='FacetDataTextC' width='100'>NRO HORAS</td><td align='center' class ='FacetDataTextC' width='100'>TURNO</td></tr>";
while ($rows= mysqli_fetch_array($resultserv)){
$cadenahora=$cadenahora."<tr><td align='center' class ='FacetDataTextC'>".$rows['hini']."</td><td align='center' class ='FacetDataTextC'>".$rows['hfin']."</td><td align='center' class ='FacetDataTextC'>".$rows['hnum']."</td><td align='center' class ='FacetDataTextC'>".$rows['hturn']."</td></tr>";
}
$cadenahora=$cadenahora."</table>";

echo $cadenahora;
?>