<?php
 
session_start();
include("DMMYSQLG.php");
//include("DSA3000.php");  
include("DF30000.inc");
include("DF80000.php");
include("JQUERY.inc");
//include("DSA1000.php");
$tipo="";

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

<?php

if ($_GET['ncto']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=ventana.php"  HTTP-EQUIV="REFRESH">';
}
else
{
	$cam=$_GET["ncto"];
	//include('FC60000_CL.php');
	//$varible_clase = new clase();
	//$res=$varible_clase->lista_busqueda($cam);
	$sql=mysqli_query($con ,"select * from valeryus19 WHERE fnumcto='$cam' AND status='HUESPED'");
	echo mysqli_error($con);
	while ($reg=mysqli_fetch_array($sql)){
	///if(!isset($_POST['ffecllegada'])){
	$_REQUEST['ncto']=isset($reg['ncto'])?$reg['ncto']:"";
	//$_REQUEST['ffecllegada']=$reg['ffecllegada'];
	$_REQUEST['ffecllegada']=chfecha($reg['ffecllegada'],'Y-m-d','d/m/Y');
	$_REQUEST['ffecsalida']=chfecha($reg['ffecsalida'],'Y-m-d','d/m/Y');
	//$_REQUEST['ffecsalida']=$reg['ffecsalida'];
	$_REQUEST['fnombre']=$reg['fnombre'];
	$_REQUEST['fapellido']=$reg['fapellido'];
	$_REQUEST['fhorallega']=$reg['fhorallega'];
	$_REQUEST['fcodtarifa']=$reg['fcodtarifa'];
	$_REQUEST['fnumadu']=$reg['fnumadu'];
	$_REQUEST['fhorasalid']=$reg['fhorasalid'];
	$_REQUEST['fsaldo']=$reg['fsaldo'];
	$_REQUEST['fnummenor']=$reg['fnummenor'];
	$_REQUEST['fnorasvip']=$reg['fnorasvip'];
        
        }
print_r($reg);
}
?>
<body>
<form name="frm" id="frm" method="post" action="">
  <input type="hidden" name="retPag" id="retPag" value="<?php echo $_REQUEST['retPag'];?>">
	<table width="358"  align="left">
      <tr class="men"> 
        <td colspan="2"><div align="center"><span class="men">AMA DE LLAVES </span></div></td>
      </tr>
      <tr> 
        <td><span class="Estilo17">HABITACION.</span></td>
        <td><input name="ncto" type="text" id="ncto" size="10" value="<?php

		echo $_GET['ncto'];?>"></td>
      </tr>
      <tr>
        <td><span class="Estilo17">NOMBRE.</span></td> 
        <td><input name="fnombre" type="text" id="fnombre" 
                   value="<?php $vrfn= isset($_REQUEST['fnombre'])?$_REQUEST['fnombre']:""; 
                   echo $vrfn;?>" size="30">
		<input name="fapellido" type="text" id="fapellido" 
                       value="<?php $vrfa= isset($_REQUEST['fapellido'])?$_REQUEST['fapellido']:"";
                       echo $vrfa;?>" size="30">		</td>
      </tr>
      <tr>
        <td width="147" ><span class="Estilo8 "><strong>FECHA DE LLEGADA. </strong> </span></td>
        <td width="195"><input name="ffecllegad"  class="datefrom" type="text" id="ffecllegad" size="15"
         value="<?php $vfl=isset($_REQUEST['ffecllegada'])?$_REQUEST['ffecllegada']:"";
         echo $vfl;?>"
			
></td>
      </tr>
      <tr>
        <td><span class="Estilo8"><strong>FECHA DE SALIDA. </strong> </span></td>
	        <td><input name="ffecsalid" class="dateto" type="text" id="ffecsalid" size="15" 
                value="<?php $vfs=isset($_REQUEST['ffecsalida'])?$_REQUEST['ffecsalida']:""; 
                    echo $_REQUEST['ffecsalida'];?>"
				
></td>
      </tr>
      <tr>
        <td><span class="Estilo8"><strong>TARIFA.</strong></span></td>
        <td><input name="fcodtarifa" type="text" id="fcodtarifa" size="15"
			  
></td>
      </tr>
      <tr>
        <td width="147"><span class="Estilo8">Hora de llegada: </span></td>
        <td width="195"><input name="fhorallega" type="text" id="fhorallega" size="15" 
       value="<?php $vfh=isset($_REQUEST['fhorallega'])?$_REQUEST['fhorallega']:"";
       echo $vfh;?>"
			
></td>
      </tr>
      <tr>
        <td><span class="Estilo8">Hora de Salida: </span></td>
        <td><input name="fhorasalid" type="text" id="fhorasalid" size="15" 
       value="<?php $vfhs=isset($_REQUEST['fhorasalid'])?$_REQUEST['fhorasalid']:"";
       echo $vfhs;?>"
			 
></td>
      </tr>
      <tr>
        <td><span class="Estilo8"><strong>ADULTOS.</strong></span></td>
        <td><input name="fnumadu" type="text" id="fnumadu" size="15" 
        value="<?php $vfnu=isset($_REQUEST['fnumadu'])?$_REQUEST['fnumadu']:""; 
        echo $vfnu;?>"
			 
></td>
      </tr>
      <tr>
        <td><span class="Estilo8"><strong>MENORES.</strong></span></td>
        <td><input name="fnummenor" type="text" id="fnummenor" size="15"
        value="<?php $vfnum=isset($_REQUEST['fnummenor'])?$_REQUEST['fnummenor']:""; 
        echo $vfnum;?>"></td>
      </tr>
      <tr>
        <td><span class="Estilo8">Saldo:</span></td>
        <td><input name="fsaldo" type="text" id="fsaldo" size="15"	
        value="<?php $vfs=isset($_REQUEST['fsaldo'])?$_REQUEST['fsaldo']:""; 
        echo $vfs;?>"
></td>
      </tr>
      <tr>
        <td><span class="Estilo8"><strong>NOTAS.</strong></span></td>
        <td rowspan="3"><span class="Estilo7">
          <textarea name="fnotasvip" cols="25" rows="3" id="fnotasvip">
              <?php $frns=isset($_REQUEST['fnorasvip'])?$_REQUEST['fnorasvip']:"";
              echo $frns;?></textarea>
		  </span></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr> 
        <td>&nbsp;</td>
      </tr>
    </table>
    <table width="345"  align="center">
      <tr class="men">
        <td><div align="center" class="men">Cambiar Status </div></td>
      </tr>
      <tr>
        <td><div align="center" class="Estilo1">
		<a href="FA.php?ncto=<?php
 echo $_GET['ncto'];?>&habinicial=<?php echo $_SESSION['habinicial'];?>&habfinal=<?php echo $_REQUEST["habfinal"];?>"><img src="limpio.jpg" width="100" height="60" border="0"/></a></div>          
    <div align="center" class="Estilo6"><a href="FA2000_SU.php?ncto=<?php echo $_GET['ncto']; ?>"><img src="sucio.jpg" width="100" height="60" border="0"></a> </div>        
    <div align="center" class="Estilo6"><a href="FA2000_CE.php?ncto=<?php echo $_GET['ncto']; ?>"><img src="checar.jpg" width="100" height="60" border="0"></a> </div>        
	<div align="center" class="Estilo6"><img src="bloquear.jpg" width="100" height="60" border="0" onClick="window.open('valeryus60002_AL.php?hb1=<?php
 echo $_GET['ncto']; ?>&tpo=BLOQUEADO&tpi=bloqueado','STATUS','width=400,height=400');window.close();"></div>     
	<div align="center" class="Estilo6"><img src="fuera.jpg" width="100" height="60" border="0" onClick="window.open('valeryus60002_AL.php?hb1=<?php
 echo $_GET['ncto']; ?>&tpo=FUERA DE SERVICIO&tpi=fuera','STATUS','width=400,height=400');window.close();"></div>     
    <div align="center" class="Estilo6"><img src="asiganado.jpg" width="100" height="60" border="0"></div></td></tr>
    </table>

</table>
</form>
<?php
 $vfl=isset($_POST['limpio'])?$_POST['limpio']:"";
if ($vfl){
//FA2000_BL.php?ncto=<?php echo $_GET['ncto']; 
}
?>
<?php
 
$st=mysqli_fetch_array(mysqli_query($con ,"select ocupado from valeryus08 where ncto='".$_GET['ncto']."'"));
echo mysqli_error($con);
//echo $st['ocupado'];
if ($st['ocupado']=='#000000'){
$tipo='fuera';
$rom='FUERA DE SERVICIO';
}else if($st['ocupado']=='#0000CC'){ 
$tipo='bloqueado';
$rom='BLOQUEADO';
}
$sqst=mysqli_fetch_array(mysqli_query($con ,"select * from valeryusst08 where fnumcto='".$_GET['ncto']."' and status='$tipo' order by n_reg desc limit 1"));
echo mysqli_error($con);
if (($st['ocupado']=='#000000') || ($st['ocupado']=='#0000CC') ){?>
<table width="358" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr class="men">
    <td colspan="2"><div align="center" class="theli"><span>ROMM STATUS: <?php
 echo $rom; ?> </span></div></td>
  </tr>

  <tr>
    <td><span class="Estilo17">HABITACION</span></td>
    <td><?php
 echo $sqst['fnumcto']; ?></td>
  </tr>
  <tr>
    <td width="147"><span class="Estilo8"><strong>FECHA DE INICIO </strong> </span></td>
    <td width="195"><input name="fec" type="text" class="emplea datefrom" id="fec" size="9" maxlength="20"
			<?php

				if(isset($_POST['fec'])){ //este es el truco
					echo 'value="' . $_POST['fec'] .  '"';
				}else{
					echo 'value="'.chfecha($sqst['fec_ini'],'Y-m-d','d/m/Y').'"';
				}
			?>onkeypress="return soloNumeros(event)"
		/>
    </td>
  </tr>
  <tr>
    <td><span class="Estilo8"><strong>FECHA DE FINAL </strong> </span></td>
    <td><input name="fec2" type="text" class="emplea dateto" id="fec2" size="9" maxlength="20"
			<?php

				if(isset($_POST['fec2'])){ //este es el truco
					echo 'value="' . $_POST['fec2'] .  '"';
				}else{
					echo 'value="'.chfecha($sqst['fec_fin'],'Y-m-d','d/m/Y').'"';
				}
			?>onkeypress="return soloNumeros(event)"
		/>
</td>
  </tr>
  <tr>
    <td><span class="Estilo8"><strong>MOTIVO </strong></span></td>
    <td rowspan="3"><span class="Estilo7">
      <textarea name="motivo" cols="25" rows="3" id="motivo"><?php echo $sqst['motivo'];?></textarea>
    </span></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<?php
 }?>
</body>
</html>