<?php
 
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
include("DF80000.php");
require_once("DFJQUERY.inc");

?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<?php

if ($_REQUEST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=FC60000_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	
	include('FC60000_CL.php');
	$varible_clase = new clase();
	$res=$varible_clase->lista_busqueda($_REQUEST["bot"]);
	$reg=mysqli_fetch_array($res);
	if(!isset($_REQUEST['fnombre'])){
	$_REQUEST['fcodtarifa']=$reg['fcodtarifa'];
	$_REQUEST['fnumres']=$reg['fnumres'];
	$_REQUEST['fnumcto']=$reg['fnumcto'];
	$_REQUEST['ffecllegada']=chfecha($reg['ffecllegada'],'Y-m-d','d/m/Y');
	$_REQUEST['ffecsalida']=chfecha($reg['ffecsalida'],'Y-m-d','d/m/Y');
	$_REQUEST['fnumadu']=$reg['fnumadu'];
	$_REQUEST['fnummenor']=$reg['fnummenor'];
	$_REQUEST['fhorallega']=$reg['fhorallega'];
	$_REQUEST['fnumctos']=$reg['fnumctos'];
	$_REQUEST['ffecalt']=chfecha($reg['ffecalt'],'Y-m-d','d/m/Y');
	$_REQUEST['ftipocto']=$reg['ftipocto'];
	$_REQUEST['select1']=$reg['status'];
	
	//forma de pago
	$_REQUEST['fformpago']=$reg['fformpago'];
	$_REQUEST['fnumtar']=$reg['fnumtar'];
	$_REQUEST['fsaldo']=$reg['fsaldo'];
	$_REQUEST['flimite']=$reg['flimite'];
	$_REQUEST['fcodseg']=$reg['fcodseg'];
	//datos
	$_REQUEST['fcodgrupo']=$reg['fcodgrupo'];
	$_REQUEST['fcodagen']=$reg['fcodagen'];
	$_REQUEST['fcodmeca']=$reg['fcodmeca'];
	$_REQUEST['fplan']=$reg['fplan'];
	$_REQUEST['smerf']=$reg['smerf'];
	$_REQUEST['fnorasvip']=$reg['fnorasvip'];
	//direccion
	$_REQUEST['fnombre']=$reg['fnombre'];
	$_REQUEST['fapellido']=$reg['fapellido'];
	$_REQUEST['flengua']=$reg['flengua'];
	$_REQUEST['fempresa']=$reg['fempresa'];
	$_REQUEST['ftelefono']=$reg['ftelefono'];
	$_REQUEST['fvip']=$reg['fvip'];
	$_REQUEST['femail']=$reg['femail'];
	$_REQUEST['fmail']=$reg['fmail'];
	$_REQUEST['fdireccion']=$reg['fdireccion'];
	$_REQUEST['tcol']=$reg['fgntd'];
	$_REQUEST['tcp']=$reg['fcp'];
	$_REQUEST['pais']=$reg['fpais'];
	$_REQUEST['estados']=$reg['festado'];
	$_REQUEST['tmun']=$reg['fciudad'];
	$_REQUEST['fvehiculo']=$reg['fvehiculo'];
	$_REQUEST['fplacas']=$reg['fplacas'];
	$_REQUEST['ftelemp']=$reg['ftelemp'];
	$_REQUEST['ftiphuesped']=$reg['ftiphuesped'];
	}
	
	
?>

<body
<?php
 
if(isset($_POST['bot3'])){
	echo ' onLoad="deshab()"';
}
?>
>
<div id="Layer2"></div>
<form  name="frm1" method="post" action="" enctype="multipart/form-data">
<p>
  <input name="bot" type="hidden" value="<?php
 echo $_POST["bot"]?>">
</p>
<p>&nbsp;</p>
<table width="987"  align="center">
  <tr>
    <th colspan="13" class=\"titulo\"><div align="center"> CONSULTA DE HUESPED </div></th>
  </tr>
  <tr>
    <td width="41">ALTA:</td>
    <td width="55"><input name="ffecalt" type="text"  class="styTabEspA" id="ffecalt" onKeyPress="return validar(event)" size="7" disabled="disabled" value="<?php
echo $_REQUEST['ffecalt'];?>"></td>
    <td width="195"><input name="fusualta" type="text" id="fusualta" disabled="disabled" size="20" value=" <?php
 
		echo  $_SESSION['usuario']  ;?>"></td>
    <td colspan="2">CAMBIO:</td>
    <td><input name="ffeccam" type="text" class="styTabEspA" id="ffeccam"  value="<?php
echo date('d/m/Y') ?>"size="7" ></td>
    <td><div align="right">STATUS:</div></td>
    <td width="58">&nbsp;</td>
    <td colspan="2"><div align="center"><span class="Estilo18">VIP
      <input name="fvip" type="checkbox" id="fvip" value="SI" <?php
if($_REQUEST['fvip']=='SI') echo 'checked';?>>
    </span></div></td>
    <td width="124" colspan="3" rowspan="6" nowrap bordercolor="#FFFFFF" style="#5F84B1"><div align="center" id="capa"><?php

			$fotografia = 'foto/valeryus19/NO_'. $reg["n_reg"] .'.JPG';
			if (file_exists($fotografia)) {
				echo '<img src="foto/valeryus19/NO_'.$reg["n_reg"].'.JPG" width="150" height="175">';
			}else{
				echo '<img src="foto/Sin_Foto.jpg" width="150" height="175">';
			}
		  ?>
	    </div>
	    <input type="checkbox" name="ac" value="1" onClick="act_fichero(ac.checked)">
        <input name="fichero" type="file" disabled="disabled" size="1" ></td>
  </tr>
  <tr>
    <td colspan="2"><strong>NOMBRE:</strong></td>
    <td><input name="fnombre" type="text" tabindex="17" onBlur="may(this)" value="<?php
echo $_REQUEST['fnombre'];?>"/></td>
    <td colspan="2"><strong>GRUPO:</strong></td>
    <td colspan="5"><span class="Estilo18">
      <select name="fcodgrupo" id="fcodgrupo" tabindex="5">
        <option value="">----------SELECCIONE----------</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus04");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fcodgrupo']==$reg['gdescrip'] ){
		echo '<option value="' . $reg['gdescrip'] . '" selected>' . $reg['gdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['gdescrip'] . '">' . $reg['gdescrip'] . '</option>';
	}
}
?>
      </select>
    </span></td>
    </tr>
  <tr>
    <td colspan="2"><strong>APELLIDO:</strong></td>
    <td><input name="fapellido" type="text" id="fapellido" tabindex="18" size="25" value="<?php
echo $_REQUEST['fapellido'];?>"></td>
    <td colspan="2">FECHA DE LLEGADA: </td>
    <td width="119"><input name="ffecllegada" type="text" id="ffecllegada" size="10" onKeyPress="return validar(event)" value="<?php
echo $_REQUEST['ffecllegada'];?>" onChange="javascript: document.getElementById('frm1').submit()">
      <input name="reset2" id="bot_a" type="image" src="logos/cal4.jpg"/>
      <script type="text/javascript">
	Calendar.setup(
			{
			  inputField  : "ffecllegada",        // ID of the input field
			  ifFormat    : "%d/%m/%Y",    // the date format
			  button      : "bot_a"      // ID of the button
			}
		  );
        </script></td>
    <td width="117">DIAS:</td>
    <td colspan="3"><input name="fnumctos" type="text" id="fnumctos" tabindex="20" onKeyPress="return validar(event)" size="15" value="<?php
echo (daydiff ($_POST['ffecsalida'],$_POST['ffecllegada'],'d/m/Y'));?>"></td>
    </tr>
  <tr>
    <td colspan="2"><strong>EMPRESA:</strong></td>
    <td><select name="fempresa" id="fempresa" tabindex="7">
      <option value="">-----SELECCIONE-----</option>
      <?php
 
$sql = mysqli_query($con ,"SELECT * FROM fcompas");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fempresa']==$reg['pdesco'] ){
		echo '<option value="' . $reg['pdesco'] . '" selected>' . $reg['pdesco'] . '</option>';
	}else{
		echo '<option value="' . $reg['pdesco'] . '">' . $reg['pdesco'] . '</option>';
	}
}
?>
    </select></td>
    <td colspan="2">FECHA DE SALIDA</td>
    <td><input name="ffecsalida" type="text" id="ffecsalida" size="10" onKeyPress="return validar(event)" value="<?php
echo $_REQUEST['ffecsalida'];?>" onChange="javascript: document.getElementById('frm1').submit()">
        <input name="reset" id="bot_b" type="image" src="logos/cal4.jpg"/>
        <script type="text/javascript">
		  Calendar.setup(
			{
			  inputField  : "ffecsalida",        // ID of the input field
			  ifFormat    : "%d/%m/%Y",    // the date format
			  button      : "bot_b"      // ID of the button
			}
		  );
        </script></td>
    <td><strong>NUMERO DE HABITACION: </strong></td>
    <td colspan="3"><input name="fnumcto" type="text" id="fnumcto" tabindex="20" size="5"  value="<?php
echo $_REQUEST['fnumcto'];?>"></td>
    </tr>
  <tr>
    <td colspan="2"><strong>TARIFA:</strong></td>
    <td>&nbsp;</td>
    <td colspan="2">HORA DE LLEGADA:</td>
    <td><input name="fhorallega" type="text" id="fhorallega" onKeyPress="return validar(event)" disabled="disabled" size="6"  value="<?php
echo $_REQUEST['fhorallega'];?>"></td>
    <td><strong>TIPO DE HABITACION:</strong></td>
    <td colspan="3"><input name="ftipocto" type="text" id="ftipocto" value="<?php
echo $_REQUEST['ftipocto'];?>"></td>
    </tr>
  <tr>
    <td colspan="2">NUMERO DE ADULTOS: </td>
    <td><label>
      
      <input name="fnumadu" type="text" id="fnumadu" tabindex="1" onKeyPress="return validar(event)" size="5"  value="<?php
echo $_REQUEST['fnumadu'];?>">
    </label></td>
    <td colspan="2">NUMERO DE MENORES: </td>
    <td><input name="fnummenor" type="text" id="fnummenor" tabindex="2" onKeyPress="return validar(event)" size="5"  value="<?php
echo $_REQUEST['fnummenor'];?>"></td>
    <td><label></label>
        <label></label>        <label><strong>FORMA DE PAGO:</strong></label></td>
    <td colspan="3"><span class="Estilo18">
      <select name="fformpago" id="fformpago" onChange="javascript: document.getElementById('frm1').submit()" tabindex="12">
        <option value="">---SELECCIONE---</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus09 WHERE pmontomax = 'ABONO' AND ppago = 'SI'");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fformpago']==$reg['descripcion'] ){
		echo '<option value="' . $reg['descripcion'] . '" selected>' . $reg['descripcion'] . '</option>';
	}else{
		echo '<option value="' . $reg['descripcion'] . '">' . $reg['descripcion'] . '</option>';
	}
}
?>
      </select>
    </span></td>
    </tr>
  <tr>
    <td colspan="2"><strong>DIRECCION:</strong></td>
    <td><input name="fdireccion" type="text" id="fdireccion" tabindex="25" size="25" value="<?php
echo $_REQUEST['fdireccion'];?>"></td>
    <td colspan="2"><strong>COLONIA:</strong></td>
    <td colspan="2"><span class="Estilo18">
      <input type="hidden" name="tcol1" id="tcve" value="<?php
echo $_REQUEST['tcve'];?>">
      <input name="tcol" type="text" id="tcol" value="<?php
echo $_REQUEST['tcol'];?>" size="20">
      <input name="?" type="button" tabindex="26" value="..." onClick="window.open('DX40000_AG1.php?retPag=FC60000_MO.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" >
    </span></td>
    <td colspan="6" rowspan="2"><textarea name="fnorasvip" cols="30" rows="3" id="fnorasvip" tabindex="4"><?php
echo $_REQUEST['fnorasvip'];?></textarea></td>
    </tr>
  <tr>
    <td colspan="2"><strong>CODIGO POSTAL:</strong></td>
    <td><input name="tcp" type="text" onKeyPress="return validar(event)" value="<?php
echo $_REQUEST['tcp'];?>" size="25" maxlength="5"></td>
    <td colspan="2"><strong>PAIS:</strong></td>
    <td colspan="2"><span class="Estilo18">
      <select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()">
        <option value="">--Selecciona--</option>
        <?php
   
		  include("DMMYSQLG.php");
			@$resultado=mysqli_query($con ,"select * from dxpaises");
			if(!isset($_REQUEST['pais'])){
				$dt_paises=mysqli_fetch_array($resultado);
				$selPais=$dt_paises['cve_pais'];
				if(mysqli_num_rows($resultado)>0)
					mysqli_data_seek($resultado,0);		
			}
			else{
				$selPais=$_REQUEST['pais'];
			}
			while($registro=mysqli_fetch_array($resultado)){
				if($selPais==$registro['cve_pais']){
					echo '<option value="' . $registro['cve_pais'] . '" selected>' . $registro['des_pais'] . '</option>';
				}else{
					echo '<option value="' . $registro['cve_pais'] . '">' . $registro['des_pais'] . '</option>';
				}
				
			}			
		?>
      </select>
    </span></td>
    </tr>
  
  
  <tr>
    <td colspan="2"><strong>ESTADO:</strong> </td>
    <td><span class="Estilo18">
      <select name="estados" onChange="javascript: document.getElementById('frm1').submit()">
        <option  value="">-----Selecciona-----</option>
        <?php
  
		@$resultado=mysqli_query($con ,"select * from dxestado where cve_pais='$selPais'");
		if(!isset($_REQUEST['estados'])){
			$dt_estado=mysqli_fetch_array($resultado);
			$selEnt=$dt_estado['cve_estado'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}
		else{
			$selEnt=$_REQUEST['estados'];
		}
		while($registro=mysqli_fetch_array($resultado)){
			if($selEnt==$registro['cve_estado'] ){ 
				echo '<option value="' . $registro['cve_estado'] . '" selected>' . $registro['des_estado'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_estado'] . '">' . $registro['des_estado'] . '</option>';
			}
			
		}
?>
      </select>
    </span>    
    <td colspan="2"><strong>DELEGACION MUNICIPIO:</strong>    
    <td colspan="2"><span class="Estilo18">
    <select name="tmun" id="tmun" >
      <option  value="">-----Selecciona-----</option>
      <?php
 
		@$resultado=mysqli_query($con ,"select * from dxdelmun where cve_estado='$selEnt' and cve_pais='$selPais'");
		if(!isset($_REQUEST['tmun'])){
			$dt_delmun=mysqli_fetch_array($resultado);
			$selDelMun=$dt_delmun['cve_delmun'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}
		else{
			$selDelMun=$_REQUEST['tmun'];
		}
		while(@$registro=mysqli_fetch_array($resultado)){
			if($selDelMun==$registro['cve_delmun']){ 
				echo '<option value="' . $registro['cve_delmun'] . '" selected>' .$registro['des_delmun'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_delmun'] . '">' . $registro['des_delmun'] . '</option>';
			}
		}
?>
    </select>
    </span></td>
    <td colspan="2"><strong>TIPO DE HUESPED: </strong></td>
	<td colspan="5"><select name="ftiphuesped" id="ftiphuesped" onChange="javascript: document.getElementById('frm1').submit()" tabindex="19">
      <option value="">--SELECCIONE--</option>
      <?php
 
$sql = mysqli_query($con ,"SELECT * FROM tiphuesped");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['ftiphuesped']==$reg['tpdescrip'] ){
		echo '<option value="' . $reg['tpdescrip'] . '" selected>' . $reg['tpdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['tpdescrip'] . '">' . $reg['tpdescrip'] . '</option>';
	}
}
?>
    </select></td>
  </tr>
  
  <tr>
    <td colspan="13"><div align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="button" name="Submit" value="Regresar" onClick="openpage('CXC10600_PR.php','_self')" tabindex="30"/>
    </div></td>
    </tr>
</table>
</form>
  <?php
 
if(isset($_POST['bot3'])){
	echo '<div align="center">
	<form id="form1" name="form1" action="FC60000_PR.php" target="_self">
		<input type="submit" name="submit" value="Regresar">
	</form>
	</div>';
	
}
?>
</body>
<?php
 
mysqli_close($con);
}
?>
</html>