<?php
session_start();
if(!isset($_SESSION['rol'])){
header('location: ventana.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="js/superfish.js"></script>
<script src="js/jquery.easing.1.3.js"></script>
<script src="js/tms-0.4.1.js"></script>
<script src="js/slider.js"></script>
</head>
<body>
<center><h1>TU LISTADO</h1> </center>
<?php
require_once('conexion.php');
include ('funciones.php');
$listado= mysql_query("SELECT tbldependencia.nombre,tblsubdependencia.nombre,tbldependencia.consecutivo,tblsubdependencia.consecutivo from tblsubdependencia inner join tbldependencia on tbldependencia.consecutivo= tblsubdependencia.cons_dependencia where tbldependencia.consecutivo=$_SESSION[cons_dependencia] ");
?>
<!--<script type="text/javascript" language="javascript" src="js/jslistadisponibilidad.js"></script>-->
<form action="registra.php" name="habilita" method="post">
<center><table cellpadding="0" cellspacing="0" border="2" class="display" id="habilitados">
<thead>
<tr>
<th>DEPENDENCIA</th><!--Estado-->
<th>SUBDEPENDENCIA</th>
<th>NOMBRE</th><!--Estado-->
<th>TELEFONO</th>
<th>FECHA_INICIO</th>
<th>FECHA_FIN</th>
<th hidden >CONSECUTIVO</th>
<th hidden >CONSECUTIVO2</th>
<th hidden > DISPONIBLE</th>
</tr>
</thead>
<?php
$num_fila = 0;
while($reg= mysql_fetch_array($listado)) {
$usu=$reg['3'] ;
?>
<?php
$sql=mysql_query("SELECT tblusuario.nombre,tblusuario.telefono,tbldisponibles.cons_usuario,tbldisponibles.consecutivo, tbldisponibles.fecha_registro from tblusuario inner join tbldisponibles on tbldisponibles.cons_usuario=tblusuario.consecutivo where
tbldisponibles.cons_subdependencia=$usu");
while($lis= mysql_fetch_array($sql) ) {
$dis=$lis['2'];
$conse=$lis['3'];
$fecha_registro=$lis['4'];
$hoy=date('Y-m-d ');
?>
<tr>
<td><?php echo $reg['0']; ?></td>
<td><?php echo $reg['1']; ?></td>
<?php
if ($hoy >= $fecha_registro.date("Y-m-d",strtotime("+5 day")) ){
?>
<td> <input type="text" name="nombre" size="35" id="nombre_<?php echo $num_fila; ?>" onClick="ventana_habilitar(<?php echo $num_fila; ?>)" readonly value="<?php echo $lis['0']; ?>"></td>
<td> <input type="text" name="telefono" id="telefono_<?php echo $num_fila; ?>" size="35" readonly value="<?php echo $lis['1']; ?>"> </td>
<td> <input type="date" name="fecha_inicio" id="fecha_inicio" value=""></td>
<td> <input type="date" name="fecha_fin" id="fecha_fin" value=""></td>
<?php
}
else {
?>
<td><?php echo $lis['0']; ?></td>
<td><?php echo $lis['1']; ?></td>
<td> </td>
<td> </td>
<?php
}
?>
<input type="hidden" name="cons_disp" id="cons_disp_<?php echo $num_fila; ?>" value="<?php echo $dis; ?>">
<input type="hidden" name="consecutivo" value="<?php echo $conse; ?>">
<td> </td>
<td> </td>
<td> <input type="hidden" name="consecutivo2" value="<?php echo $usu; ?>"></td>
</tr>
<?php
$num_fila = $num_fila + 1;
} ?>
<?php } ?>
</tbody>
</table> </center>
<br>
<center><input type="submit" name="registrar" value="Registrar" style='width:160px; height:50px' > </center>
<label></label>
</form>
</body>
</html>