<!DOCTYPE html PUCLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<?php
include("conex.php");
include("funciones.php");
?>
[B]<script type="text/javascript">
function aviso(ID_Reserva)
{
if (!confirm("ALERTA!! Va a proceder a eliminar esta reserva, si desea eliminarla haga click en ACEPTAR,\nde lo contrario haga click en CANCELAR.")) {
return false;
}
else {
document.location.href = "borradoReservas.php?ID_Reserva=" + ID_Reserva;
return true;
}
}
</script>[/B]
<script type="text/javascript">
function cargaDatos(ID_Reserva,ced_ide,nombre,apellido,fecha_inicio,fecha_fin,cantPersonas,numTelefono,correoElectronico,usuario,observaciones)
{
opener.document.fe.txtID_Reserva.value = ID_Reserva;
opener.document.fe.txtced_ide.value = ced_ide;
opener.document.fe.txtnombre.value = nombre;
opener.document.fe.txtapellido.value = apellido;
opener.document.fe.txtfecha_inicio.value = fecha_inicio;
opener.document.fe.txtfecha_fin.value = fecha_fin;
opener.document.fe.txtcantPersonas.value = cantPersonas;
opener.document.fe.txtnumTelefono.value = numTelefono;
opener.document.fe.txtcorreoElectronico.value = correoElectronico;
opener.document.fe.txtusuario.value = usuario;
opener.document.fe.txtobservaciones.value = observaciones;
window.close();
}
iz=(screen.width-document.body.clientWidth) / 2;
de=(screen.height-document.body.clientHeight) / 2;
moveTo(iz,de);
</script>
<form name="fe" action="" method="post">
<center><h2>Reservas</h2>
<table border="2">
<tr>
<td>Buscar por:
<p><INPUT TYPE="radio" NAME="buscar" VALUE="nombre" checked> Nombre </p>
<p><INPUT TYPE="radio" NAME="buscar" VALUE="apellido"> Apellido </p>
<p><INPUT TYPE="radio" NAME="buscar" VALUE="fecha_inicio"> Fecha de Entrada </p>
<font color="#808080" size="1" style= "margin-left: 16px"> Formato: aaaa-mm-dd</font>
</p>
<td></br><input type="text" name="txtbus"/></td>
<td></br><input type="submit" name="btn1" value="Buscar" /></td>
</tr></table>
<?php
$link=Conectarse();
$sql="SELECT * FROM reserva";
echo"<center>
<table border='3'>
<tr>
<th>ID</th>
<th>Documento</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Fecha de Entrada</th>
<th>Fecha de Salida</th>
<th>Habitacion</th>
<th>Cantidad de Personas</th>
<th>Telefono</th>
<th>Correo Electronico</th>
<th>Recepcionista</th>
<th>Observaciones</th>
<th>Editar</th>
<th>Eliminar</th>
<th>Registrar</th>
</tr>";
$ID_Reserva=$resul[0];
$ced_ide=$resul[1];
$nombre=$resul[2];
$apellido=$resul[3];
$fecha_inicio=$resul[4];
$fecha_fin=$resul[5];
$habitaciones="";
$sql1= "SELECT habitacion FROM detalle_reserva WHERE ID_Reserva = $resul[0]";
$habitaciones.="<option value='".$resul1[0]."'>Habitacion ".$resul1[0]."</option>";
}
$cantPersonas=$resul[6];
$numTelefono=$resul[7];
$correoElectronico=$resul[8];
$usuario=$resul[10];
$observaciones=$resul[9];
echo "<tr>
<td>$ID_Reserva</td>
<td>$ced_ide</td>
<td>$nombre</td>
<td>$apellido</td>
<td>$fecha_inicio</td>
<td>$fecha_fin</td>
<td>"?><select name="habitacion">
<?php echo $habitaciones; ?>
</select> <?php echo"</td>
<td>$cantPersonas</td>
<td>$numTelefono</td>
<td>$correoElectronico</td>
<td>$usuario</td>
<td>$observaciones</td>
"?>
<td><input type="submit" name="datos" value="Editar" onClick="cargaDatos('<?php echo $ID_Reserva;?>','<?php echo $ced_ide;?>','<?php echo $nombre;?>','<?php echo $apellido;?>','<?php echo $fecha_inicio;?>','<?php echo $fecha_fin;?>','<?php echo $cantPersonas;?>','<?php echo $numTelefono;?>','<?php echo $correoElectronico;?>','<?php echo $usuario;?>','<?php echo $observaciones;?>')"/></td>
[B]<td><input type="submit" name="dato" value="Eliminar" onClick="aviso('<?php echo $ID_Reserva;?>')"/></td>
[/B]<td><input type="submit" name="registrar" value="Registrar" onClick="window.open('crearRegistro.php?ci_cliente=<?php echo $ced_ide?>&fecha_inicio=<?php echo $fecha_inicio?>&fecha_fin=<?php echo $fecha_fin?>&cantPersonas=<?php echo $cantPersonas?>&observaciones=<?php echo $observaciones?>')"/></td>
<?php echo "</tr>";
}
echo "</table>
</center>";
?>
<?php
if(isset($_POST["btn1"])){ $btn=$_POST["btn1"];
$bus=$_POST["txtbus"];
$buscar= $_POST["buscar"];
?>
<input type="hidden" name="bus" value="<?php echo $bus; ?>">
<input type="hidden" name="buscar" value="<?php echo $buscar ?>" />
<?php
if($btn=="Buscar"){
$bus=$_POST["txtbus"];
$buscar= $_POST["buscar"];
$link=Conectarse();
$sql="select * from reserva where $buscar LIKE'%$bus%'";
echo"<center>
<table border='3'>
<tr>
<th>ID</th>
<th>Documento</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Fecha de Entrada</th>
<th>Fecha de Salida</th>
<th>Habitación</th>
<th>Cantidad de Personas</th>
<th>Telefono</th>
<th>Correo Electronico</th>
<th>Observaciones</th>
<th>Editar</th>
<th>Eliminar</th>
<th>Registrar</th>
</tr>";
$ID_Reserva=$resul[0];
$ced_ide=$resul[1];
$nombre=$resul[2];
$apellido=$resul[3];
$fecha_inicio=$resul[4];
$fecha_fin=$resul[5];
$habitaciones="";
$sql1= "SELECT habitacion FROM detalle_reserva WHERE ID_Reserva = $resul[0]";
$habitaciones.="<option value='".$resul1[0]."'>Habitación ".$resul1[0]."</option>";
}
$cantPersonas=$resul[6];
$numTelefono=$resul[7];
$correoElectronico=$resul[8];
$observaciones=$resul[9];
echo "<tr>
<td>$ID_Reserva</td>
<td>$ced_ide</td>
<td>$nombre</td>
<td>$apellido</td>
<td>$fecha_inicio</td>
<td>$fecha_fin</td>
<td>"?><select name="habitacion">
<?php echo $habitaciones; ?>
</select> <?php echo"</td>
<td>$cantPersonas</td>
<td>$numTelefono</td>
<td>$correoElectronico</td>
<td>$observaciones</td>
"?>
<td><input type="submit" name="datos" value="Editar" onClick="cargaDatos('<?php echo $ID_Reserva;?>','<?php echo $ced_ide;?>','<?php echo $nombre;?>','<?php echo $apellido;?>','<?php echo $fecha_inicio;?>','<?php echo $fecha_fin;?>','<?php echo $cantPersonas;?>','<?php echo $numTelefono;?>','<?php echo $correoElectronico;?>','<?php echo $usuario;?>','<?php echo $observaciones;?>')"/></td>
[B]<td><input type="submit" name="dato" value="Eliminar" onClick="aviso('<?php echo $ID_Reserva;?>')"/></td>
[/B]<td><input type="submit" name="registrar" value="Registrar" onClick="window.open('crearRegistro.php?ci_cliente=<?php echo $ced_ide?>&fecha_inicio=<?php echo $fecha_inicio?>&fecha_fin=<?php echo $fecha_fin?>&cantPersonas=<?php echo $cantPersonas?>&observaciones=<?php echo $observaciones?>')"/></td>
<?php echo "</tr>";
}
echo "</table>
</center>";
}
}
?>