<?require("conectar.php");
$compuesta=$_GET['fecha'];?>
<html>
<head>
  <title>Citas del dia <?echo $compuesta;?></title>
	     <style>
		      .cont-busc{position:relative;height:auto;min-height:400px !important;font-family:arial;color:#086A87;top:10px;overflow-x:hidden;margin:auto;}
			  .cont-busc .bar-busc{position:relative;height:90px;font-family:arial;color:#086A87;top:0px;margin:auto;}
			  .cont-res{position:relative;font-family:arial;color:#086A87;top:0px;margin:auto;}
			  .datos{border:0;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;-khtml-border-radius: 5px;border-collapse: collapse;color:#0d0d0d;font-family:arial;width:99%;}
			  .datos .tl{-moz-box-shadow:inset 0 0 20px #000000;-webkit-box-shadow: inset 0 0 20px #000000;box-shadow: inset 0 0 20px #000000;}
			  .datos .trs{min-height:30px !important;max-height:30px !important;height:30px !important;background:url(images/tcancion.jpg) repeat-x;color:#ffffff;font-size:12px;}
			  .datos .trs .link{-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;-khtml-border-radius: 5px;background:#86B404;padding:3px;text-decoration:none;float:left;}
			  .datos .trs .link:hover{background:#A5DF00;}
              .datos .trsb{min-height:15px !important;max-height:15px !important;height:15px !important;background:url(images/tcancion2.png);color:#58D3F7;font-size:12px;}
			  .datos .trsb td{border-left:solid 1px #6E6E6E;}
			  .datos .trsb td:first-child{border-left:none;}
			  .datos .tr{min-height:20px !important;max-height:20px !important;height:20px !important;background:#ffffff;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:10px;}
			  .datos .trb{min-height:20px !important;max-height:20px !important;height:20px !important;background:#ffffff;border-top:solid 1px #D8D8D8; color:#0D0D0D;font-size:9px;}
			  .datos .trb td{border-left:solid 1px #D8D8D8;padding-left:10px;}
			  .datos .trb td:first-child{border-left:none;}
			  .datos .trb .tds{background:#A4A4A4;}
			  .datos .trssb{min-height:15px !important;max-height:15px !important;height:15px !important;background:url(images/tcancion2.png);color:#848484;}	
			  .datos .tr td{border-left:solid 1px #D8D8D8;padding-left:10px;}
			  .datos .tr td:first-child{border-left:none;}
	          .datos .tr:hover{background:#01A9DB;color:#ffffff;}	
	          .datos .tr:hover a{color:#ffffff;}
              .datos .tr1{min-height:20px !important;max-height:20px !important;height:20px !important;background:#E0F8F7;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:13px;}	
              .datos .tr1 td{border-left:solid 1px #D8D8D8;padding-left:10px;}
			  .datos .tr1 td:first-child{border-left:none;}
	          .datos .tr1:hover{background:#01A9DB;color:#ffffff;}	
	          .datos .tr1:hover a{color:#ffffff;}	
			  .datos .activo{min-height:20px !important;max-height:20px !important;height:20px !important;background:#F3E2A9;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:13px;}
			  .ipt{border:none;background:none;color:#ffffff;font-weight:bold;text-align:right;}
			  .loading{position:fixed;left:50%;top:50%;width:250px;height:70px;margin-left:-125px;margin-top:-35px;display:none;background:url(images/bkloading.png);background-repeat:no-repeat;color:#ffffff;padding-top:25px;text-align:center;font-family:arial;font-size:12px;}
               .rentas{position:absolute;top:40px;width:800px;left:50%;margin-left:-421px;border:solid 1px  #D8D8D8; background:#FFFFFF; display:none;padding:20px;-Moz-box-shadow: 0 0 85px #000;-webkit-box-shadow: 0 0 85px #000; box-shadow: 0 0 85px #000;}
               .rentatab{border-collapse:collapse;color:#0d0d0d;font-family:arial;font-size:12px;}
               .rentatab .filatit{min-height:20px !important;max-height:20px !important;height:20px !important;background:#D8D8D8;border-top:solid 1px #D8D8D8;font-size:13px;}			   
               .rentatab .fila{min-height:20px !important;max-height:20px !important;height:20px !important;background:#ffffff;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:12px;}
               .rentatab .fila td{border-left:solid 1px #D8D8D8;padding-left:5px;}
               .rentatab .fila td:first-child{border-left:none;}
               .cerrar{float:right;margin-top:-20px;margin-right:-20px;}
	     </style>
</head>
<body onload="window.print();">
<table class="datos">
		     <tr align="center" class="trb">
			     <td colspan='10' align="center" class="tds">
				    CITAS DEL DIA <?echo $compuesta;?> 
			     </td>
			 </tr>
				 <tr class="trb">
				     <td align="center"><b>Cliente</b></td>
					 <td align="center"><b>Fecha de Cita</b></td>
					 <td align="center"><b>Hora de Cita</b></td>
					 <td align="center"><b>Ejecutivo</b></td>
					 <td align="center"><b>Gerente</b></td>
					 <td align="center"><b>Observaciones</b></td>
					 <td align="center"><b>Presupuesto</b></td>
					 <td align="center"><b>No de Adultos</b></td>
					 <td align="center"><b>No de Niños</b></td>
					 <td align="center"><b>Telefono</b></td>
				 </tr>
<tr class="trb"><td colspan='10' align="center" class="tds">MATUTINO</td></tr>				 
<?
$sqlevent="select c.id_renta as id_renta,c.id_cliente as id_cliente,c.fecha as fecha, c.hora as hora, c.observacion as observacion, cl.nombre as nombre, cl.a_pat as apat, cl.a_mat as amat,concat(SUBSTRING(e.nombre, 1, 1),SUBSTRING(e.a_pat, 1, 1),SUBSTRING(e.a_mat, 1, 1)) as ejecutivo, e.coordinador,r.presupuesto,r.no_adultos,r.no_ninios,cl.num1 from citas as c  INNER JOIN renta as r ON c.id_renta=r.id_renta $cond1 INNER JOIN clientes as cl ON c.id_cliente=cl.id_cliente INNER JOIN empleados as e ON c.id_emp=e.id_empleado WHERE c.fecha='".$compuesta."' and hora between '07:00:00' and '13:00:00'";
mysql_select_db($dbname);
$revent=mysql_query($sqlevent);
	  while($reg=mysql_fetch_array($revent)){
             $coordin=$reg['coordinador'];
			 $coordina=mysql_query("SELECT concat(SUBSTRING(nombre, 1, 1),SUBSTRING(a_pat, 1, 1),SUBSTRING(a_mat, 1, 1)) as coordinado FROM empleados WHERE id_empleado='$coordin'");
			 $coordinad=mysql_fetch_array($coordina);
			 $coordinador=$coordinad['coordinado'];
	?>  
	     <tr class="trb">
            <td><?echo htmlentities($reg['nombre'])." ".htmlentities($reg['apat'])." ".htmlentities($reg['amat']);?></td>
			<td><?echo $reg['fecha'];?></td>
			<td><?echo $reg['hora'];?></td>
			<td><?echo $reg['ejecutivo'];?></td>
			<td><?echo $coordinador;?></td>
			<td><?echo $reg['observacion'];?></td>
			<td><?echo $reg['presupuesto'];?></td>
			<td><?echo $reg['no_adultos'];?></td>
			<td><?echo $reg['no_ninios'];?></td>
			<td><?echo $reg['num1'];?></td>
         </tr>		 
	  <?}?>
<tr class="trb"><td colspan='10' align="center" class="tds">VESPERTINO</td></tr>
<?
$sqlevent="select c.id_renta as id_renta,c.id_cliente as id_cliente,c.fecha as fecha, c.hora as hora, c.observacion as observacion, cl.nombre as nombre, cl.a_pat as apat, cl.a_mat as amat,concat(SUBSTRING(e.nombre, 1, 1),SUBSTRING(e.a_pat, 1, 1),SUBSTRING(e.a_mat, 1, 1)) as ejecutivo, e.coordinador,r.presupuesto,r.no_adultos,r.no_ninios,cl.num1 from citas as c  INNER JOIN renta as r ON c.id_renta=r.id_renta $cond1 INNER JOIN clientes as cl ON c.id_cliente=cl.id_cliente INNER JOIN empleados as e ON c.id_emp=e.id_empleado WHERE c.fecha='".$compuesta."' and hora between '13:01:00' and '18:00:00'";
mysql_select_db($dbname);
$revent=mysql_query($sqlevent);
	  while($reg=mysql_fetch_array($revent)){
             $coordin=$reg['coordinador'];
			 $coordina=mysql_query("SELECT concat(SUBSTRING(nombre, 1, 1),SUBSTRING(a_pat, 1, 1),SUBSTRING(a_mat, 1, 1)) as coordinado FROM empleados WHERE id_empleado='$coordin'");
			 $coordinad=mysql_fetch_array($coordina);
			 $coordinador=$coordinad['coordinado'];
	?>  
	     <tr class="trb">
            <td><?echo htmlentities($reg['nombre'])." ".htmlentities($reg['apat'])." ".htmlentities($reg['amat']);?></td>
			<td><?echo $reg['fecha'];?></td>
			<td><?echo $reg['hora'];?></td>
			<td><?echo $reg['ejecutivo'];?></td>
			<td><?echo $coordinador;?></td>
			<td><?echo $reg['observacion'];?></td>
			<td><?echo $reg['presupuesto'];?></td>
			<td><?echo $reg['no_adultos'];?></td>
			<td><?echo $reg['no_ninios'];?></td>
			<td><?echo $reg['num1'];?></td>
         </tr>		 
	  <?}?>	  
<tr class="trb"><td colspan='10' align="center" class="tds">NOCTURNO</td></tr>
<?
$sqlevent="select c.id_renta as id_renta,c.id_cliente as id_cliente,c.fecha as fecha, c.hora as hora, c.observacion as observacion, cl.nombre as nombre, cl.a_pat as apat, cl.a_mat as amat,concat(SUBSTRING(e.nombre, 1, 1),SUBSTRING(e.a_pat, 1, 1),SUBSTRING(e.a_mat, 1, 1)) as ejecutivo, e.coordinador,r.presupuesto,r.no_adultos,r.no_ninios,cl.num1 from citas as c  INNER JOIN renta as r ON c.id_renta=r.id_renta $cond1 INNER JOIN clientes as cl ON c.id_cliente=cl.id_cliente INNER JOIN empleados as e ON c.id_emp=e.id_empleado WHERE c.fecha='".$compuesta."' and hora between '18:01:00' and '24:00:00'";
mysql_select_db($dbname);
$revent=mysql_query($sqlevent);
	  while($reg=mysql_fetch_array($revent)){
             $coordin=$reg['coordinador'];
			 $coordina=mysql_query("SELECT concat(SUBSTRING(nombre, 1, 1),SUBSTRING(a_pat, 1, 1),SUBSTRING(a_mat, 1, 1)) as coordinado FROM empleados WHERE id_empleado='$coordin'");
			 $coordinad=mysql_fetch_array($coordina);
			 $coordinador=$coordinad['coordinado'];
	?>  
	     <tr class="trb">
            <td><?echo htmlentities($reg['nombre'])." ".htmlentities($reg['apat'])." ".htmlentities($reg['amat']);?></td>
			<td><?echo $reg['fecha'];?></td>
			<td><?echo $reg['hora'];?></td>
			<td><?echo $reg['ejecutivo'];?></td>
			<td><?echo $coordinador;?></td>
			<td><?echo $reg['observacion'];?></td>
			<td><?echo $reg['presupuesto'];?></td>
			<td><?echo $reg['no_adultos'];?></td>
			<td><?echo $reg['no_ninios'];?></td>
			<td><?echo $reg['num1'];?></td>
         </tr>		 
	  <?}?>	 
</table>			 
</body>
</html>