<?php
 
session_start();
include("DSA1000.php");
include("DMMYSQLG.php");
include("DF80000.php");
include("JQUERY.inc");
$var="";
$fila=array();
$f_m="";
$i = 1; 
?>
<html>
    <head> 
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/> 
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script type="text/javascript" language="JavaScript1.2" src="RSSCRIPT.js"></script>
  </head>
<script language="javascript">
function openWindow(dataGen,valores){
	var objDate=document.getElementById('ffecllegada');
	var objDate2=document.getElementById('ffecsalida');	
	var getVars,getVarsAux,distPage;
	var idVentana;
	for(getVarsAux in valores){
		getVars +='&'+getVarsAux+'='+valores['getVarsAux'];
	}
	if(typeof dataGen.width=='undefined') dataGen.width='800';
	if(typeof dataGen.height=='undefined') dataGen.height='600';
	distPage='&feclle='+objDate.value;
	distPage2='&fecsal='+objDate2.value;
	idVentana=window.open(dataGen.action+distPage2+distPage+'&'+getVars,dataGen.name,'width='+dataGen.width+',height='+dataGen.height+',top=100,left=50,scrollbars=yes,menubar=yes,status=yes');
	return idVentana;
}
</script>
<style type="text/css">
BODY {
SCROLLBAR-FACE-COLOR:#0000CC; SCROLLBAR-HIGHLIGHT-COLOR:#00CCFF; SCROLLBAR-SHADOW-COLOR:#0000CC; SCROLLBAR-3DLIGHT-COLOR:#0000CC; SCROLLBAR-ARROW-COLOR:#FFFFFF; SCROLLBAR-TRACK-COLOR:#FFFFFF; SCROLLBAR-DARKSHADOW-COLOR: #330000
}
.Estilo16 {
	font-size: 14px;
	font-weight: bold;
}
</style>
<body> 

<div align="center">
  <form name="form1" id="form1" method="post" action="" enctype="multipart/form-data">
    <table width="331" align="center">
      <tr>
	  <th width="323" colspan="2">CHECK OUT  X GRUPO </th>
	  </tr>
      <tr>
      <th align="center"><div align="center">GRUPO</div></th>
      </tr>
		  <tr>
		  <td align="center"><select name="fcodgrupo" id="fcodgrupo" onChange="javascript: document.getElementById('form1').submit()" tabindex="6">
            <option value="">----------SELECCIONE----------</option>
            <?php
$hoy = date("Y-m-d");
			include("DMMYSQLG.php");
 $resultado = mysqli_query($con ,' SELECT valeryus04.n_reg, valeryus04.*, valeryus19.ffecsalida	 FROM valeryus04 
                    left outer JOIN valeryus19 on TRIM(valeryus04.gdescrip)=TRIM(valeryus19.fcodgrupo)
                     where  valeryus19.`status`="HUESPED"
                    		group by gdescrip 
                    order by ffecllegada desc');

while($reg=mysqli_fetch_array( $resultado)){
	if(isset($_POST['fcodgrupo'])&&$_POST['fcodgrupo']==$reg['gdescrip'] ){
		echo '<option value="' . $reg['gdescrip'] . '" selected>' . $reg['gdescrip'] . '</option>';
	}else{      
        
         echo '<option style="color:red"  value="' . $reg['gdescrip'] . '">' . $reg['gdescrip'] . '</option>';
            }        
} 
include("DMMYSQLG.php");
//			include("DMMYSQLG.php");
//$sql = mysqli_query($con ,"SELECT * FROM valeryus04");
//while($reg=mysqli_fetch_array($sql)){
//	if($_POST['fcodgrupo']==$reg['gdescrip'] ){
//		echo '<option value="' . $reg['gdescrip'] . '" selected>' . $reg['gdescrip'] . '</option>';
//	}else{
//		echo '<option value="' . $reg['gdescrip'] . '">' . $reg['gdescrip'] . '</option>';
//	}
//}
//include("DMMYSQLG.php");
?>
          </select></td>
		  </tr>
		  <tr>
		  <th align="center">FECHA DE LLEGADA </th>
		  </tr>
		  <tr>
                        <?php $fech=(isset($_POST['ffecllegada']))?$_POST['ffecllegada']:date('d/m/Y'); ?>
		  <td align="center"><input name="ffecllegada" type="text" class="emplea date" id="ffecllegada" size="10" maxlength="20" value="<?=$fech?>"
			<?php

				if(isset($_POST['ffecllegada'])) //este es el truco
					echo 'value="' . $_POST['ffecllegada'] .  '"';
				else
			  		echo 'value="'.date('d/m/Y').'"'; 
			?>onkeypress="return soloNumeros(event)"
		/>

        <input name="ffecsalida" type="text" class="emplea datefrom" id="ffecsalida" size="10" maxlength="20"
		<?php
                $fecha_llegada = (isset($_POST['ffecllegada']))?$_POST['ffecllegada']:"";
		$nueva_fecha = chfecha($fecha_llegada,'d/m/Y','Y-m-d');
                $var1=(isset($_POST['fcodgrupo']))?$_POST['fcodgrupo']:"";
		$fec_salida = mysqli_query($con ,"select * from valeryus19 where ffecllegada = '".$nueva_fecha."' and status = 'RESERVA GRUPO' and fcodgrupo = '".$var1."' limit 1");
		$salida = mysqli_fetch_array($fec_salida);
		$salida_fecha = $salida['ffecsalida'];
		$nueva_fecha_salida = chfecha($salida_fecha,'Y-m-d','d/m/Y');
		echo 'value="'.$nueva_fecha_salida.'"';
		?> READONLY/>
		</td></tr>
      <tr>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td colspan="2"><div align="center"><input name="Submit" type="submit" class="original" value="Buscar" />
        </div></td>
      </tr>
    </table>
  </form>
</div> 
<div align="center">    
<form action="" method="post" name="frm1"> 
<input type="hidden" name="r1" value="<?php
echo $_POST['r1'];?>">
<input type="hidden" name="select1" value=" <?php
echo $var1;?>">
<?php

   $ssql=mysqli_query($con ,"select * from valeryus19 WHERE status = 'RESERVA GRUPO' "); 
?>
  <table width="711" align=center> 
  <tr>
        <th colspan="7"> <div align="center">
          <input name="Submit" type="button"  value="Check Out" onClick="openpage('caj_cogrupos_MC.php','_self')" class="bot_WsW"/>
        </div></th>
      </tr> 
    <tr>
    
		<th width="70"><div align="center">FOLIO</div></th>
        <th width="300"><div align="center">NOMBRE Y APELLIDO</div></th>
		<th width="201"><div align="center">TIPO DE HABITACION</div></th>
		<th width="120"><div align="center">HABITACION</div></th>
      </tr>
   <?php

$fec = (isset($_POST['ffecllegada']))?$_POST['ffecllegada']:"";
		include('DF20000.php');
		$fecha_final = $f_m;
                $var2=(isset($_POST['fcodgrupo']))?$_POST['fcodgrupo']:"";
                $vars=(isset($_POST['submit']))?$_POST['submit']:"";
                echo '<input name="txt_bus" type="hidden" value="'.$var2.'">';

	if($vars=="")
	{
          print_r($_POST['fcodgrupo']);
		echo '<input name="tip_bus" type="hidden" value="clave">';
	  	@$ssql = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE fcodgrupo = '".$var2."' AND ffecllegada = '$f_m' AND status = 'HUESPED' and suma='0'");
		echo $var2;
        }
	
        $var3=(isset($fila["ffecsalida"]))?$fila["ffecsalida"]:"";
      echo "<td><h5 align='center'>" . $var3 . "</h5></td>";
        while ($fila=mysqli_fetch_array($ssql)){ 
      echo "\n<div align='center'><input type=hidden name='id$i' value='" . $fila["n_reg"] . "'></div>"; 
      echo "<tr>"; 
	  
	  $sopas[] = $fila["n_reg"];
	  if ($fila['cancelado'] == 1){
	  echo "<td align = 'center' style='#FF3300'><span class='Estilo16'>" . $fila["n_reg"] . "</span></td>"; 
      echo "<td align = 'center' style='#FF3300'><span class='Estilo16'>" . $fila["fnombre"] . " " . $fila["fapellido"] . "</span></td>";
	  echo "<td align = 'center' style='#FF3300'><span class='Estilo16'>" . $fila["ftipocto"] . "</span></td>";
	  echo "<td align = 'center' style='#FF3300'><span class='Estilo16'>" . $fila["fnumcto"] . "</span></td>";
	  }else{
	  echo "<td align = 'center'><span class='Estilo16'>" . $fila["n_reg"] . "</span></td>";
	  echo "<td align = 'center'><span class='Estilo16'>" . $fila["fnombre"] . " " . $fila["fapellido"] . "</span></td>";
	  echo "<td align = 'center'><span class='Estilo16'>" . $fila["ftipocto"] . "</span></td>";
	  echo "<td align = 'center'><span class='Estilo16'>" . $fila["fnumcto"] . "</span></td>";
	  }

          echo "</tr>"; 
      
          $i++;
                
      $ultimo_mostrado = $fila["n_reg"]; 

   }
/**
 * Send debug code to the Javascript console
 */ 
function debug_to_console($fila) {
    if(is_array($fila) || is_object($data))
	{
		echo("<script>console.log('PHP: ".json_encode($fila)."');</script>");
	} else {
		echo("<script>console.log('PHP: ".$fila."');</script>");
	}
}
?>


   </table>
  </form>
   </div>
   
</table>
</BODY> 
</HTML> 
<?php

//183--->100
?>

