Sie sind auf Seite 1von 46

VENTANA DE ACCESO

En esta ventana el usuario debe ingresar su nombre de usuario y su contrasea


respectiva, luego har click para acceder al sistema; tendr libre acceso a la
informacin que se encuentra alojada en la base de datos del programa.

Click para acceder al


sistema

MENU

BARRA DE MANTENIMIENTO

Cmo hacer mantenimiento a un Huesped?


Seleccionar la opcin husped.

CODIGO:
<html>
<body background="Imagenes/fondo1.jpg">
<HEAD>
<LINK HREF="../Sistema_Hotel/comun/style.css" REL="stylesheet"
TYPE="text/css">
</HEAD>
</body>
<center><img src="Imagenes/huesped.gif"></center>
<?
$link = mysql_connect("localhost","root");
mysql_select_db("hotel", $link);
$rs=mysql_query("select * from huesped");
echo "<table border=1 align=center>";
echo"<tr><td><a href=AgregarCliente.php>AGREGAR</a></td>";
echo
"<tr><td>CODIGO</td><td>NOMBRE</td><td>APELLIDO</Td><td>DNI</td><
td>DIRECCION</Td><td>TELEFONO</td><td>SEXO</td><td>HABITACION</
td>
<td>FOTO</td><Td>Eliminar</Td><Td>Actualizar</Td></tr>";

while($row=mysql_fetch_array($rs)){
$cod=$row["idhuesped"];
echo"<tr><td>";
echo $cod ."</td><td>";
echo $row["nombre_hue"] ."</td><td>";
echo $row["apellido_hue"] ."</td><td>";
echo $row["dni_hue"] ."</td><td>";
echo $row["direccion_hue"] ."</td><td>";
echo $row["telefono_hue"] ."</td><td>";
echo $row["sexo"] ."</td><td>";
echo $row["idhabitacion"] ."</td><td>";
$foto= $row["foto"];
echo "<Img src=../Sistema_Hotel/Imagenes/$foto width=40
height=20></Td><Td>";
echo "<A href=EliminarCliente.php?codigo=$cod>Eliminar</a>";
echo "</Td><Td>";
echo "<A href=ActualizarCliente.php?codigo=$cod>Actualizar</a>";
echo "</td></tr>";
}
echo "</table>";
mysql_close($link);
?>
</body>
</html>

MANTENIMIENTO DE HUESPED
TABLA:

CODIGO:
AGREGAR HUESPED
<Html>
<body background="Imagenes/fondito.jpg"
<LINK HREF="../Sistema_Hotel/Comun/style.css" REL="stylesheet" TYPE="text/css">
<Form name="Frm" action="AgregarCliente1.php" method="post"
enctype="multipart/form-data">
<hr><hr><hr><br><br>
<Table border=1 align=center width=50%>
<Tr align=center>
<Td colspan=2><b><H2>AGREGAR HUESPED</H2></b></Td>

</Tr>
<Tr>
<Td>CODIGO</Td>
<Td><input type=text name=T1 size=3 maxlength=4 /></Td>
</Tr>
<Tr>
<Td>NOMBRE</Td>
<Td><Input type=text name=T2 size=30 maxlength=25></Td>
</Tr>
<Tr>
<Td>APELLIDO</Td>
<Td><Input type=text name=T3 size=30 maxlength=30></Td>
</Tr>
<Tr>
<Td>DNI</Td>
<Td><Input type=text name=T4 size=8 maxlength="8"></Td>
</Tr>
<Tr>
<Td>DIRECCION</Td>
<Td><Input type=text name=T5 size=10 maxlength=35></Td>
</Tr>
<Tr>
<Td>TELEFONO</Td>
<Td><Input type=text name=T6 size=8 maxlength=6></Td>
</Tr>
<Tr>
<Td>SEXO</Td>
<Td><Input type=text name=T7 size=1 maxlength="1"></Td>
</Tr>
<Tr>
<Td>HABITACION</Td>
<Td><Input type=text name=T8 size=1 maxlength="4"></Td>
</Tr>
<Tr>
<Td>FOTO</Td>
<Td><Input type=file name="Foto"></Td>

</Tr>
<tr>
<Td align=center><input type="submit" value="Grabar"></Td>
<Td align=center><input type="button" value="Regresar"
onClick="javascript:window.history.back()"></Td>
</Tr>
</Table>
<br><br><hr><hr><hr>
</Form>
</Html>

AGREGAR HUESPED 1:
<?
$link=mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
if ($Foto) copy($Foto, "../Sistema_Hotel/Imagenes/".$Foto_name);
else $Foto_name="Foto.jpg";
$rs=mysql_query("insert into huesped
values('$T1','$T2','$T3','$T4','$T5','$T6','$T7', 'T8','$Foto_name')");
if($rs){
header("location:Cliente.php");
}
else
{
echo "Error en la Pagina!!";
exit();
}
mysql_close($link);
?>

CODIGO:
<html>
<body background="Imagenes/fondo1.jpg"
<HEAD>
<LINK HREF="../Sistema_Hotel/comun/style.css" REL="stylesheet"
TYPE="text/css">
</HEAD>
<Center><Img src="../Sistema_Hotel/Imagenes/Hab.jpg"
width=30%></Center><br><BR>
</body>
<center><img src="Imagenes/habi.gif"></center>
<?
$link = mysql_connect("localhost","root");
mysql_select_db("hotel", $link);
$rs=mysql_query("select * from habitacion");

echo "<table border=1 align=center width=100%>";

echo"<tr><td><a href=AgregarHab.php>AGREGAR</a></td>";

echo
"<tr><td>Codigo</td><td>Numero</td><td>Piso</td><td>Estado</td><td>Usuario</td
><td>Reservacion</td><td>TipoHab</td><td>Dias</td><td>Foto</td><Td>Eliminar</T
d><Td>Actualizar</Td></tr>";

while($row=mysql_fetch_array($rs)){
$cod=$row["idhabitacion"];
echo"<tr><td>";
echo $cod ."</td><td>";
echo $row["nro_hab"] ."</td><td>";
echo $row["piso_hab"] ."</td><td>";
echo $row["estado"] ."</td><td>";
echo $row["idusuario"] ."</td><td>";
echo $row["idresev_hab"] ."</td><td>";
echo $row["idtipo_hab"] ."</td><td>";
echo $row["dias_hospedados"] ."</td><td>";
$foto= $row["foto"];
echo "<Img src=../Sistema_Hotel/Imagenes/$foto width=40
height=20></Td><Td>";
echo "<A href=EliminarHab.php?codigo=$cod>Eliminar</a>";
echo "</Td><Td>";
echo "<A href=Actualizarhabitacion.php?codigo=$cod>Actualizar</a>";
echo "</td></tr>";

}
echo "</table>";
mysql_close($link);
?>
</body>
</html>

MANTENIMIENTO DE HABITACION
Cmo hacer mantenimiento a una Habitacion?
Seleccionar la opcin habitacin luego click en Agregar.

CODIGO:
AGREGAR HABITACION
<Html>
<Body background="Imagenes/fondo1.jpg">
<LINK HREF="../Sistema_Hotel/Comun/style.css" REL="stylesheet" TYPE="text/css">
<Form name="Frm" action="AgregarHab1.php" method="post"
enctype="multipart/form-data">
<Table border=1 align=center width=50%>
<Tr align=center>
<Td colspan=2><b><H2>AGREGAR HABITACION</H2></b></Td>
</Tr>
<Tr>
<Td>CODIGO</Td>
<Td><input type=text name=T1 size=3 maxlength=4></Td>
</Tr>
<Tr>
<Td>NUMERO</Td>
<Td><Input type=text name=T2 size=3 maxlength=3></Td>
</Tr>
<Tr>
<Td>PISO</Td>
<Td><Input type=text name=T3 size=15 maxlength=15></Td>
</Tr>
<Tr>
<Td>ESTADO</Td>
<Td><Input type=text name=T4 size=12 maxlength=12></Td>
</Tr>
<Tr>
<Td>USUARIO</Td>
<Td><Input type=text name=T5 size=4 maxlength=4></Td>
</Tr>
<Tr>
<Td>RESERVACION</Td>
<Td><Input type=text name=T6 size=3 maxlength=4></Td>
</Tr>

<Tr>
<Td>TIPO HABITACION</Td>
<Td><Input type=text name=T7 size=3 maxlength=4></Td>
</Tr>
<Tr>
<Td>DIAS</Td>
<Td><Input type=text name=T8 size=3 maxlength=2></Td>
</Tr>
<Tr>
<Td>Foto</Td>
<Td><Input type=file name="foto"></Td>
</Tr>
<Tr>
<Td align=center><input type="submit" value="Grabar"></Td>
<Td align=center><input type="button" value="Regresar"
onClick="javascript:window.history.back()"></Td>
</Tr>
</Table>

</Form>
</Body>
</Html>

AGREGAR HABITACION 1:
<?
$link=mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
if ($foto) copy($foto, "../Sistema_Hotel/Imagenes/".$foto_name);
else $foto_name="Foto.jpg";
$rs=mysql_query("insert into habitacion values('$T1','$T2','$T3','$T4','$T5','$T6','$T7',
'T8','$foto_name')");
if($rs){

header("location:Habitacion.php");
}
else
{
echo "Error en la Pagina!!";
exit();
}
mysql_close($link);
?>

CODIGO:
<html>
<body background="Imagenes/fond.gif">
<HEAD>
<LINK HREF="../Sistema_Hotel/comun/style.css" REL="stylesheet"
TYPE="text/css">
</HEAD>
</body>
<table align="center">
<br>
<br>
<br>

<br>
<br>
<br>
<img src="Imagenes/usuario.gif">
<?
$link = mysql_connect("localhost","root");
mysql_select_db("hotel", $link);
$rs=mysql_query("select * from usuario");

echo "<table border=1 align=center width=100%>";


echo"<tr><td><a href=Agregarusuario.php>AGREGAR</a></td>";

echo
"<tr><td>Codigo</td><td>TipoUsuario</td><td>Clave</Td><td>Nombre</td><td>Apelli
do</Td><td>Dni</td><td>Direccion</td><td>Telefono</td>
<Td>Eliminar</Td><Td>Actualizar</Td></tr>";

while($row=mysql_fetch_array($rs)){
$cod=$row["idusuario"];
echo"<tr><td>";
echo $cod ."</td><td>";
echo $row["tipo_usuario"] ."</td><td>";
echo $row["clave"] ."</td><td>";
echo $row["nombre_usu"] ."</td><td>";
echo $row["apellido_usu"] ."</td><td>";

echo $row["dni"] ."</td><td>";


echo $row["direccion"] ."</td><td>";
echo $row["telefono"] ."</td><td>";
echo "<A href=Eliminarusuario.php?codigo=$cod>Eliminar</a>";
echo "</Td><Td>";
echo "<A href=Actualizarusuario.php?codigo=$cod>Actualizar</a>";
echo "</td></tr>";
}
echo "</table>";
mysql_close($link);
?>
</table>
</body>
</html>

MANTENIMIENTO DEL USUARIO

CODIGO:
AGREGAR USUARIO:
<Html>
<Body background="Imagenes/fondo1.jpg">
<LINK HREF="../Sistema_Hotel/Comun/style.css" REL="stylesheet" TYPE="text/css">
<Form name="Frm" action="Agregarusuario1.php" method="post"
enctype="multipart/form-data">
<Table border=1 align=center width=50%>
<Tr align=center>
<Td colspan=2><b><H2>AGREGAR USUARIO</H2></b></Td>
</Tr>
<Tr><Td>Codigo</Td>
<Td><input type=text name=T1 size=4 maxlength=4></Td>
</Tr>
<Tr>
<Td>Tipo</Td>
<Td><Input type=text name=T2 size=20 maxlength=18></Td>

</Tr>
<Tr>
<Td>Clave</Td>
<Td><Input type=text name=T3 size=4 maxlength=3></Td>
</Tr>
<Tr>
<Td>Nombre</Td>
<Td><Input type=text name=T4 size=25 maxlength=25></Td>
</Tr>
<Tr>
<Td>Apellido</Td>
<Td><Input type=text name=T5 size=30 maxlength=30></Td>
</Tr>
<Tr>
<Td>Dni</Td>
<Td><Input type=text name=T6 size=8 maxlength=8></Td>
</Tr>
<Tr>
<Td>Direccion</Td>
<Td><Input type=text name=T7 size=35 maxlength=35></Td>
</Tr>
<Tr>
<Td>Telefono</Td>
<Td><Input type=text name=T8 size=8 maxlength=8></Td>
</Tr>
<Tr>
<Td align=center><input type="submit"
value="Grabar"></Td>
<Td align=center><input type="button" value="Regresar"
onClick="javascript:window.history.back()"></Td>
</Tr>
</Table>
</Form>
</Body>
</Html>

AGREGAR USUARIO 1:

<?
$link=mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
$rs=mysql_query("insert into usuario
values('$T1','$T2','$T3','$T4','$T5','$T6','$T7','$T8')");
if($rs){
header("location:Usuario.php");
}
else
{
echo "Error en la Pagina!!";
exit();
}
mysql_close($link);
?>

CODIGO:
<html>
<body background="Imagenes/fondo1.jpg">
<HEAD>
<LINK HREF="../Sistema_Hotel/comun/style.css"
REL="stylesheet" TYPE="text/css">
</HEAD>
<center><img src="Imagenes/reserv.gif"></center>
<?

$link = mysql_connect("localhost","root");
mysql_select_db("hotel", $link);
$rs=mysql_query("select * from
reservacion_habitacion");

echo "<table border=1 align=center>";


echo"<tr><td><a
href=Agregarreservacion.php>AGREGAR</a></td>";

echo
"<tr><td>Codigo</td><td>Estado</td><td>FechaReserv.</Td><td>FechaPostergacion
</td><Td>Eliminar</Td><Td>Actualizar</Td></tr>";

while($row=mysql_fetch_array($rs)){
$cod=$row["idresev_hab"];
echo"<tr><td>";
echo $cod ."</td><td>";
echo $row["estado_resev"] ."</td><td>";
echo $row["fecha_resev"] ."</td><td>";
echo
$row["fecha_postergada_resev"] ."</td><td>";
echo "<A href=EliminarReservacion.php?
codigo=$cod>Eliminar</a>";
echo "</Td><Td>";
echo "<A href=ActualizarReservacion.php?
codigo=$cod>Actualizar</a>";

echo "</td></tr>";
}
echo "</table>";
mysql_close($link);
?>
</body>
</html>

MANTENIMIENTO DE RESERVACION

CODIGO:
AGREGAR RESERVACION:
<Html>
<Body background="Imagenes/fondo1.jpg">
<LINK HREF="../Sistema_Hotel/Comun/style.css" REL="stylesheet" TYPE="text/css">
<Form name="Frm" action="Agregarreservacion1.php" method="post"
enctype="multipart/form-data">
<Table border=1 align=center width=50%>
<Tr align=center>
<Td colspan=2><b><H2>AGREGAR RESERVACION</H2></b></Td>
</Tr>
<Tr>
<Td>CODIGO</Td>
<Td><input type=text name=T1 size=2 maxlength=4></Td>
</Tr>

<Tr>
<Td>ESTADO</Td>
<Td><Input type=text name=T2 size=20 maxlength=20></Td>
</Tr>
<Tr>
<Td>FECHA RESEV</Td>
<Td><Input type=date name=T3 size=12></Td>
</Tr>
<Tr>
<Td>FECHA POSTERGADA</Td>
<Td><Input type=date name=T4 size=12></Td>
</Tr>
<Tr>
<Td align=center><input type="submit" value="Grabar"></Td>
<Td align=center><input type="button" value="Regresar"
onClick="javascript:window.history.back()"></Td>
</Tr>
</Table>
</Form>
</Body>
</Html>

AGREGAR RESERVACION 1:
<?
$link=mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
$rs=mysql_query("insert into reservacion_habitacion values('$T1','$T2','$T3','$T4')");
if($rs){
header("location:Reservacion.php");
}
else
{
echo "Error en la Pagina!!";
exit();

}
mysql_close($link);
?>

BARRA DE CONSULTAS

Cmo hacer una consulta?


Seleccionar la opcin husped luego escribir el apellido del husped buscar.

CLIENTES

CODIGO:
<Html>
<BODY background="../Imagenes/fondo1.jpg">

<Form action=Consulta.php method=post>


<table border=1 align=center>
<Tr><Td>huesped:
<Td><input type=text name=T1 size=10 maxlength=40 /></Td>
</Td>
<Td><input type=submit name=Buscar value=Buscar></Td></Tr>
</table>
</Form>
<?
if( $Buscar){
$link=mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
$sql="Select nombre_hue, apellido_hue,
dni_hue,direccion_hue,telefono_hue,sexo,foto from huesped where
apellido_hue='$T1'";
$rs=mysql_query($sql);
if ( $rs){
echo "<Table border=1 align=center width=60%>";
echo
"<Tr><Td>NOMBRE</Td><Td>APELLIDO</Td><Td>DNI</Td><Td>DIRECCION</Td
><Td>TELEFONO</Td><Td>SEXO</Td><Td>FOTO</TD></Tr>";

while($row=mysql_fetch_array($rs)){
echo "<Tr><Td>";
echo $row["nombre_hue"]."</Td><Td>";

echo $row["apellido_hue"]."</Td><Td>";
echo $row["dni_hue"]."</Td><Td>";
echo $row["direccion_hue"]."</Td><Td>";
echo $row["telefono_hue"]."</Td><Td>";
echo $row["sexo"]."</Td><Td>";
$Foto= $row["foto"];
echo "<Img src=../Imagenes/$Foto width=100
height=120></Td><Td>";
}
echo "</Table>";
}
mysql_close($link);
}
?>
</Body>
</Html>

HABITACION

CODIGO:
<Html>
<BODY background="../Imagenes/fondo1.jpg">
<Form action=Consulta.php method=post>
<table border=1 align=center>
<Tr><Td>huesped:
<Td><input type=text name=T1 size=10 maxlength=40 /></Td>
</Td>
<Td><input type=submit name=Buscar value=Buscar></Td></Tr>
</table>
</Form>
<?
if( $Buscar){
$link=mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
$sql="Select nombre_hue, apellido_hue, dni_hue,direccion_hue,telefono_hue,sexo,foto
from huesped where apellido_hue='$T1'";
$rs=mysql_query($sql);
if ( $rs){
echo "<Table border=1 align=center width=60%>";
echo
"<Tr><Td>NOMBRE</Td><Td>APELLIDO</Td><Td>DNI</Td><Td>DIRECCION</Td
><Td>TELEFONO</Td><Td>SEXO</Td><Td>FOTO</TD></Tr>";

while($row=mysql_fetch_array($rs)){
echo "<Tr><Td>";
echo $row["nombre_hue"]."</Td><Td>";
echo $row["apellido_hue"]."</Td><Td>";
echo $row["dni_hue"]."</Td><Td>";
echo $row["direccion_hue"]."</Td><Td>";
echo $row["telefono_hue"]."</Td><Td>";
echo $row["sexo"]."</Td><Td>";
$Foto= $row["foto"];
echo "<Img src=../Imagenes/$Foto width=100 height=120></Td><Td>";
}
echo "</Table>";
}
mysql_close($link);
}
?>
</Body>
</Html>

SISTEMA TRANSACCION

LISTA DE HABITACIONES DISPONIBLES Y NO DISPONIBLES

CODIGO:
<?
session_start();
session_register('usuario');
session_register('mihotel');
$usuario="";

$usuario=session_id();
?>
<HTML>
<body bgcolor="#FFFFCC">
<?
$link=mysql_connect("localhost","root");
mysql_select_db("hotel",$link);
$rs = mysql_query("select idhabitacion, nro_hab, piso_hab, tipo_hab from habitacion ,
tipo_hab where habitacion.idhabitacion=tipo_hab.idtipo_hab");
?>
<br><br>
<table border="2" bordercolor="#666666" width="62%" cellspacing="0" cellpadding="0"
align="center">
<tr align="center" ><td colspan="3"><b><?=$Descripcion?></b></td></tr>
<tr align="center" ><td colspan="3"></td>
</tr>
<tr class="Mtr" height="20">
<td width="30%"> CODIGO </td>
<td width="30%"> NUMERO </td>
<td width="15%"> PISO </td>
<td width="15%"> TIPO </td>
<td width="15%" align="center"> ALQUILAR </td>
</tr>
<?
if($rs){

while($row=mysql_fetch_array($rs)){
$cod=$row[0];
echo"<tr><td width=30%>";
echo "<a href=caracteristica.php?codigo=$cod>".$row[1]."</a></td>";
echo "<td width=15%>".$row[1 ]."</td>";
echo "<td width=15%>".$row[2]."</td>";
echo "<td width=15%>".$row[3]."</td>";
echo "<td width='15%' align='center'>";
echo "<a href=cantidadalquilar.php?codigo=$cod><img
src='../imagenes/alqui.gif'></a>";
echo "</td></tr>";
}
}
mysql_close($link);
?>
</table>
</body>
</HTML>

CARACTERISTICAS:

CODIGO:
<?
session_start(); if(!isset($usuario)) {echo "Seguridad:debe Iniciar Sesion"; exit();}
?>
<HTML>
<Body background="../Imagenes/fondo1.jpg">
<HEAD>
<LINK HREF= "../comun/style.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<?$link = mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
$rs = mysql_query("select idhabitacion, nro_hab, piso_hab, estado, idusuario,
idresev_hab, idtipo_hab, dias_hospedados from habitacion where
idhabitacion='$codigo'");
$row=mysql_fetch_array($rs);
echo"<br><br>";
echo"<table width='60%' cellspacing=0 cellpading=0 align=center>";
echo"<tr height=20 class=Mtr><td colspan=2 align=center>";
echo"<b>DETALLE DE LA HABITACION</b>";

echo"</td></tr>";

$numcampos=mysql_num_fields($rs);
for($i=0; $i<$numcampos; $i++){$campo=mysql_field_name($rs,$i);
echo"<tr height=20>";
echo"<td width=15% class=Mtr>";
echo"<b>&nbsp;".$campo."</b>";
echo"</td><td width=45% bgcolor=white >";
echo"&nbsp;<b>".$row[$i]."</b></td>";
echo"</tr>";
}
echo"<tr><td colspan=2 align=center>";
echo"<a href=lista.php?codigo=$row[1]><b>Regresar</b></a>";
echo"</td></tr>";
echo"</table>";mysql_close($link);
?>
</body>
</HTML>

CANTIDAD ALQUILAR

CODIGO:
<?
session_start(); if(!isset($usuario)) {echo "Seguridad:debe
Iniciar Sesion"; exit();}
?>
<?
$link = mysql_connect("localhost", "root");
mysql_select_db("hotel", $link);
$rs

mysql_query("select

habitacion.*,

estado_resev

from

habitacion,

reservacion_habitacion where idhabitacion='$codigo' and habitacion.idresev_hab =


reservacion_habitacion.idresev_hab");
$row=mysql_fetch_array($rs);
$idhue=$row["idhuesped"] ;
?>
<HTML>
<Body background="../Imagenes/fondo1.jpg">
<HEAD>
<LINK

HREF=

"../comun/style.css"

REL="stylesheet"

TYPE="text/css">
</HEAD>
<body>
<br><br>
<FORM ACTION="alquilar.php" method="post">
<input type=hidden name=idprod value=<?=$codigo?>>
<table

border="2"

bordercolor="#000000"width="50%"

class=mtableborder

cellspacing="0" cellpadding="0" align="center">


<tr class=mtr height="25%" align="center">
<td colspan="2"><b>ALQUILER DE HABITACIONES</b></td>
</tr>
<tr>
<td width="35%"><b>Codigo</b></td><td><?=$row["idhabitacion"]?></td>
</tr>
<tr>
<td width="35%"><b>Numero</b></td><td><?=$row["nro_hab"]?></td>
</tr>
<tr>
<td width="35%"><b>Estado</b></td><td><?=$row["estado_resev"]?></td>
</tr>
<tr>
<td width="35%"><b>Dias</b></td><td><?=$row["dias_hospedados"]?></td>
</td>
</tr>

<tr>

</tr>
<tr height="25%" align="center">
<td><input type="submit" class="boton" value="Registrar" ></td>
<td><input

type="button"

class="boton"

onClick="location='lista.php?codigo=<?=$idhue?>'"></td>
</tr>
</table>
</FORM>
</body>
</HTML>
<? mysql_close($link);?>

value="Regresar"

ALQUILER:

CODIGO:
<?php
session_start(); if(!isset($usuario)) {echo "Seguridad: Debe Iniciar Sesin"; exit();}
?>
<?php
if($sw==1){ // SI ES ANULAR COMPRA, VACIAR CARRITO DE COMPRAS
session_unset($micarrito);
header("location:lista.php?codigo=$codigo");
}
//---------------------------------------------------------------------------------------$link=mysql_connect("localhost","root");
mysql_select_db("hotel", $link);
if(isset($idprod)){
$rs=mysql_query("select idhabitacion, nro_hab, tipo_hab, monto from habitacion,
precio_hab, tipo_hab where habitacion='$idhab' and
habitacion.idhabitacion=tipo_hab.idtipo_hab and
tipo_hab.idtipo_hab=precio_hab.idprecio_hab");
$row=mysql_fetch_array($rs);
$idhab=$row[1];
if(!

isset($mihotel)){ // SI MICARRITO SE ENCUENTRA VACIO


// AGREGO EL ELEMENTO ( idhabitacion, nro_hab, dias_hospedados)
$mihotel[0]= array($row[0], $row[2], $dias, $row[3]);

} else { // BUSCAR HABITACION EN MI HOTEL


$numreg=count($mihotel);
for($i=0;$i<$numreg;$i++){
$elemento=$mihotel[$i];
$id=$elemento[0];
if ($id==$row[0]){
$mihotel[$i] = array($elemento[0],$elemento[1],$dias,$elemento[3]);
$encontrado=1;
break;
}
}
if(!$encontrado){ // SI NO ENCUENTRO HABITACION
// AGREGO EL ELEMENTO ( idhabitacion, nro_hab, estado)
$mihotel[]= array($row[0], $row[2], $cant, $row[5]);
}
}
}
//---------------------------------------------------------------------------------------?>
<HTML>

<HEAD>
<link href="../comun/style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<form action="pagar.php" method="post">
<table width="56%" class=Mtableborder cellspacing="0" cellpadding="0"
align="center">
<tr class=Mtr align="center">
<td colspan=4><b>
<marquee behavior=alternate width="75%">
LISTA DE HABITACIONES
</marquee>
</b></td>
</tr>
<tr class=Mtr>
<td width="20%"><b>Habitacion</b></td>
<td width="16%"><b>Numero</b></td>
<td width="15%"><b>Dias</b></td>
<td width="36%" align=right><b>Precio</b></td>
<td width="19%" align=right><b>SubTotal</b></td>
</tr>
<?php
//--------------------------------------------------------------------------------$numreg=count($mihotel);

for($i=0;$i<$numreg;$i++){
$elemento=$mihotel[$i];
$id=$elemento[0];
$nro_hab=$elemento[1];
$dias_hospedados=$elemento[2];
$precio=$elemento[3];
$subtotal=$cantidad * $precio;
echo "<tr>";
echo "<td> $id </td>";
echo "<td> $nro_hab </td>";
echo "<td> $dias_hospedados </td>";
echo "<td align=right> $precio </td>";
echo "<td align=right> $subtotal </td>";
echo "</tr>";
$total = $total + $subtotal;
}
//---------------------------------------------------------------------------------?>
<tr class=Mtr>
<td colspan=3 height=25% align=right>&nbsp;</td>
<td align=right><b>Total a Pagar ($US)
<?=$total?>
</b></td>
</tr>

<tr height=30%>
<td><input type=submit class=boton name=pagar value=Pagar></td>
<td><input type=button class=boton name=regresar value="Regresar"
onClick="location='../cantidadAlquiler.php'"></td>
<td colspan=2 align=right><input type=button class=boton name=anular
value="Anular Compra" onClick="location='comprar.php?sw=1&codigo=<?=$idcat?
>'">
</td>
</tr>
</table>
</form>
</body>
</html>
<? mysql_close($link); ?>

REGISTRAR ALQUILER

CODIGO:
<?php
//session_start(); if(!isset($usuario))
{echo "Seguridad: Debe Iniciar Sesin"; exit();}
?>
<HTML>
<HEAD>

<LINK HREF= "../comun/style.css"


REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY>
<?php
//-------------------------------------------------------------------------$link=mysql_connect("localhost","root");
mysql_select_db("hotel", $link);
$rs=mysql_query("select idhuesped from huesped where idhuesped='$idhuesped'");
$row=mysql_fetch_array($rs);
$documento=$row[0];
//--------------------------------------------------------------------------// OJO : FALTA VALIDACIN CUANDO NO DIJITAMOS TEXTOS .
//--------------------------------------------------------------------------if (!$documento) { // Si no existe huesped registrado
$sql = "insert into huesped(idhuesped,
nombre_hue,apellidos_hue,dni_hue,direccion_hue,telefono_hue,sexo)values('idhuespe
d', '$nom','$ape','$dni','$dir','$tel','$sexo')";
mysql_query($sql);
}
$numreg=count($mihotel);
for($i=0;$i<$numreg;$i++){
$elemento=$mihotel[$i];

$idhabitacion=$elemento[0];

$dias_hospedados=$elemento[2];
$precio_hab=$elemento[3];
$subtotal=$cantidad * $precio;
$total = $total + $subtotal;
mysql_query("insert into detalle_huesped_habitacion(idhuesped,idhabitacion) values
('$idhuesped','$idhabitacion')");
mysql_query("update habitacion set dias_hospedados where
idhabitacion=$idhabitacion");
}
//---------------------------------------------------------------------------session_unset($mihotel);

echo "<h2><center>Gracias<b> $nom </b> por su Preferencia!!</center></h2>";


echo "<center>Su Habitacion es <b> $idhabitacion </b>";
echo "<center>Hace un total de <b> $total </b> dolares<br>";
echo "estamos enviando indicaciones a tu correo $email";
echo "</center>";

echo "<br><a href='../Sistema_Hotel/principal.php'> Inicio </a>";


//---------------------------------------------------------------------------mysql_close($link);
session_unregister($usuario);
session_unregister($mihotel);
session_destroy();

?>

Das könnte Ihnen auch gefallen