<?php
$f_f ="";
$f_m="";
?>
<div align="center">
  <form name="form1" method="post" action="">
    <table width="458"  align="center">
      <tr>
        <th colspan="2">REGISTRO DE RESERVACIONES DE GRUPO </th>
      </tr>
      <tr>
        <th width="297"> <input name="r1" type="radio" value="clave" tabindex="1">
          X NOMBRE DE GRUPO </th>
        <th width="297"><input name="r1" type="radio" value="nombre" tabindex="2">
        X FECHA DE LLEGADA</th>
      </tr>
      <tr>
        <td><input name="tbus" id="tbus" type="text" onBlur="may(this)" size="30"/></td>
        <?php $fec3=(isset($_POST['fec']))?$_POST['fec']:date('d/m/Y'); ?>
        <td><input name="fec" type="text" class="emplea date" id="fec" size="9" maxlength="20" value="<?=$fec3 ?>"
			<?php
			//if(!isset($dt_empres['fec_alta']))$dt_empres['fec_alta']="";
				$fecha =(isset( $dt_empres['fec_alta']))? $dt_empres['fec_alta']:"";
	            $fechita = chfecha($fecha,'Y-m-d','d/m/Y');
				if(isset($_POST['fec'])){ //este es el t						ruco
					echo 'value="' . $_POST['fec'] .  '"';
				}else{
					echo 'value="'.$fechita.'"';
				}
			?> onkeypress="return soloNumeros(event)"
		/>
          <!--  <input name="bot" id="bot" type="image" value=" ... " src="logos/cal4.jpg"/>
        --></td>
      </tr>
      <tr>
        <td colspan="2"><div align="center">
          <input type="submit" name="Submit" value="Buscar" />
        </div></td>
      </tr> 
    </table>
  </form>
</div>
<div align="center" id="formulario" style="display:none;"></div>
<form name="frm1" method="post" action="" >
<input name="tbus" type="hidden" value="<?php
echo "".$_POST['tbus'].""; ?>" />
<?php
@$sql=mysqli_query($con ,"SELECT * FROM valeryus19 where status='RESERVA GRUPO' AND ftipocto='MAESTRA' AND cancelado='0' order by ffecllegada");
//echo "SELECT * FROM valeryus19 where status='RESERVA GRUPO' AND ftipocto='MAESTRA' AND cancelado='0' order by ffecllegada";
include("DE10000.php"); 
?>
  <div id="busqueda" style="color:#000">
             Busqueda Rapida <input type="text" style="width: 70%" id="q" name="q" value=""  placeholder="cualquier texto de la busqueda actual(nombre, folio, hab.)"/>
		</div>
<table width="1129" border='1' id="latabla" bordercolor=" " bordercolordark=" ">
     <thead>
      <tr>
        <th colspan="20"> 
			<div id="sticky-anchor"></div>
			<div align="center" id="sticky">
			  <input type="submit" name="Submit6" value="Agregar Grupo" onClick="openpage('res_grupos_AG.php','_self')"/>
			  <input type="button" name="bot4" value="Imprimir Grupo" onClick="openpage('res_grupos_IM.php','_self')"/>
			  <input name="bot44" type="button" class="original" onClick="openpage('valeryus40011_IM.php','_self')" value="Tarjetas de Registro"/>
			</div>
		</th>
      </tr>
	  <tr>
      <th colspan="20">REGISTRO DE RESERVACIONES DE GRUPO </th>
      </tr>
      <tr>
      <th width="30"><div align="center">SEL</div></th>  
      <th width="211"><div align="center">GRUPO</div></th> 
	  <th width="102"><div align="center">HABITACIONES</div></th>
      <th width="200"><div align="center">CLIENTE</div></th>
	  <th width="100"><div align="center">FECHA DE ENTRADA</div></th>
	  <th width="100"><div align="center">FECHA DE SALIDA</div></th>
      <th width="99"><div align="center">STATUS</div></th>
	  <th width="58" colspan="13"><div align="center">FOLIOS</div></th>
    </tr>
 </thead>
 <tbody>
<?php

$fec = (isset($_POST['fec']))?$_POST['fec']:"";
		include('DF20000.php');
		$fecha_inicial = $f_m;
                $vart=(isset($_POST['tbus']))?$_POST['tbus']:"";
echo '<input name="txt_bus" type="hidden" value="'.$vart.'">';
            $vars=(isset($_POST['submit']))?$_POST['submit']:"";//if(!isset($_POST['r1']))$_POST['r1']="";
            $varr=(isset($_POST['r1']))?$_POST['r1']:"";
            if($vars=="" && $varr=='clave')//clave
	{
		echo '<input name="tip_bus" type="hidden" value="clave">';
	  	@$sql = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE fcodgrupo like '%".$vart."%' and status = 'RESERVA GRUPO' AND ftipocto='MAESTRA' AND cancelado='0' order by ffecllegada");
                //echo "SELECT * FROM valeryus19 WHERE fcodgrupo like '%".$vart."%' and status = 'RESERVA GRUPO' AND ftipocto='MAESTRA' AND cancelado='0' order by ffecllegada";
                }elseif($vars=="" && $varr=='nombre')//nombre
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
		@$sql = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE ffecllegada = '$fecha_inicial' AND status = 'RESERVA GRUPO' AND ftipocto='MAESTRA' and cancelado='0' ORDER BY ffecllegada");
	}
 
while($row = mysqli_fetch_array($sql)){
	echo "	<tr>";
	if ($row['cancelado'] == 1){
	echo "<td style='#FF3300'> <div align='center'><input name='bot' type='radio' value='". $row["n_reg"]."' disabled></div></td>";
	echo "<td style='#FF3300'><div align='center'><span class='Estilo1'><a style=\"pedirDatos('".$row['n_reg']."')\">".$row['n_reg']." </span></div></a></td>";
	echo "<td style='#FF3300'> <div align='center'><span class='Estilo1'>" . $row["fcodgrupo"] . "&nbsp;</span></div></td>";
	echo "<td style='#FF3300'> <div align='center'><span class='Estilo1'>" . $row["ftipocto"] . "&nbsp;</span></div></td>";
	echo "<td style='#FF3300'> <div align='center'><span class='Estilo1'>" . $row["fnumcto"] . "&nbsp;</span></div></td>";
	//print_r($row["fnumcto"]);
        echo "<td style='#FF3300'> <div align='center'><span class='Estilo1'>" . $row["fnombre"] ." ". $row["fapellido"] . " &nbsp;</span></div></td>";
	$fec1=$row["ffecllegada"];
	include('DF20000.php');
	echo "<td style='#FF3300'> <div align='center'><span class='Estilo1'>" . $f_f . "&nbsp</span></div></td>";
	$fec1=$row["ffecsalida"];
	include('DF20000.php');
	echo "<td style='#FF3300'> <div align='center'><span class='Estilo1'>" . $f_f . "&nbsp</span></div></td>";
	echo "<td style='#FF3300'> <div align='center'><span class='Estilo1'>CANCELADO</span></div></td>";
	print_r($row['fnumcto']);
	}else{
	echo '<td> <div align="center"><input name="bot" type="radio" value="'. $row["n_reg"].'"></div></td>';
	echo "<td style=' '><div align='center'><a style=\"text-decoration:underline;cursor:pointer;\" onclick=\"openpage('res_grupos_VER.php?grupo=".urlencode($row['fcodgrupo'])."','_self')\"><h5><strong>".$row['fcodgrupo']."</h5></strong> </div></a></td>";
	$grupo=$row["fcodgrupo"];
	$fecha=$row["ffecllegada"];
	$ssl=mysqli_fetch_array(mysqli_query($con ,"SELECT COUNT(*) as total FROM valeryus19 where status='RESERVA GRUPO' AND fcodgrupo='$grupo' and cancelado='0'"));
    $suma_cuartos=$ssl['total'] - 1;
	echo "<td> <div align='center'><span class='Estilo1'>" . $suma_cuartos . "&nbsp;</span></div></td>";
	echo "<td> <div align='center'><span class='Estilo1'>" . $row["fnombre"] . " ". $row["fapellido"] . "&nbsp;</span></div></td>";
	$fec1=$row["ffecllegada"];
	include('DF20000.php');
	echo "<td> <div align='center'><span class='Estilo1'>" . $f_f . "&nbsp</span></div></td>";
	$fec1=$row["ffecsalida"];
	include('DF20000.php');
	echo "<td><div align='center'><span class='Estilo1'>" . $f_f . "&nbsp</span></div></td>";
	echo "<td><div align='center'><span class='Estilo1'></span></div></td>";
	$FoL=mysqli_query($con ,"select * from valeryus19 where status='RESERVA GRUPO' AND fcodgrupo='$grupo' AND folio='EXTRAS' and cancelado='0'");
	while ($NrEg=mysqli_fetch_array($FoL)){
	echo "<td> <div align='center'><span class='Estilo1'>" . $NrEg['n_reg'] . "&nbsp;</span></div></td>";
	}
	}
        
	echo "</tr>";
}
mysqli_close($con);
?>
     </tbody>
</table>
</form>
