<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DF30000.inc");
include("DF80000.php");
include("JQUERY.inc");
$f_m="";
$tot_ocu=0;
$tot_tot=0;
$cant=0;
?>
<html>
<HEAD> <meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8">
<style type="text/css">
<!--
.Estilo16 {font-size: 14px}
.Estilo19 {font-family: Verdana, Helvetica; font-weight: bold; font-size: 10px; }
-->
BODY {
SCROLLBAR-FACE-COLOR:#7397A7; 
SCROLLBAR-HIGHLIGHT-COLOR:#5FBEC2;/*sombra izquierda arriba*/ 
SCROLLBAR-SHADOW-COLOR:#5FBEC2;/*sombra derecha abajo*/ 
SCROLLBAR-3DLIGHT-COLOR:#5FBEC2;/*lo mismo que la segunda*/ 
SCROLLBAR-ARROW-COLOR:#5FBEC2;/*flechita*/ 
SCROLLBAR-TRACK-COLOR:#5FBEC2;/*base*/
SCROLLBAR-DARKSHADOW-COLOR:#5FBEC2/*lo mismo que la tercera*/
}--> 
</style>
</HEAD>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>

<body>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="">
    <table width="441" border="0">
	<tr> <th colspan="2"><span class="Estilo16">PRONOSTICO DE rec_ocupacion X SEGMENTO </span> </th> 
	</tr>
      <tr>
        <!--td> <div align="right" class="Estilo19"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /> PERIODO. </div></td-->
        <td><!--input name="r1" type="radio" value="f" tabindex="5"/-->
           
            <div align="center">
                <?php
          $fec=(isset($_POST['fec']))?$_POST['fec']:date('d/m/Y');
          ?>
              <input name="fec" type="text" class="emplea date" id="fec" size="9" maxlength="20" value="<?=$fec?>"
			<?php

				if(isset($_POST['fec'])){ //este es el truco
					echo 'value="' . $_POST['fec'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?> onkeypress="return soloNumeros(event)"
		/>
             <!-- <input name="bot" id="bot" type="image" value=" ... " src="logos/cal4.jpg"/>
              -->
            </script>
            </div></td>
      </tr>
      <tr>
        <td colspan="2">
          <div align="center">
            
            <input name="Submit" type="button" class="original" onClick="openpage('ger_segmento_PR.php','_self')" value="Buscar"/>
			<input name="bot4" type="button" class="bot_WsW" onClick="openpage('ger_segmento_IM.php','_self')" value="Imprimir "/>
           
		  </div></td>
      </tr>
    </table>
     
  </form>
</div>
<div align="center">
  <form method="post" action="" >
    <?php
 @$result = mysqli_query($con ,"SELECT * FROM valeryus06"); ?>
    <table width="36%"   align="center" cellpadding="0" cellspacing="0">
      <tr>
        <th colspan="13">
          <div align="center"></div></th></tr>
      <tr>
        <th width="31%"><div align="center">SEGMENTOS</div></th>
		<th colspan="2"><div align="center">OCUPADAS</div></th>
		<th width="26%"><div align="center">%</div></th>
		<!--th width="3%"><div align="center">MEN</div></th>
		<th width="7%"><div align="center">HORA</div></th-->						
	  </tr>
	<?php

	 // --->
	 //if(!isset($_POST['fec']))$_POST['fec']="";
	  	$fec = (isset($_POST['fec']))?$_POST['fec']:"";
		include('DF20000.php');
		$fecha_inicial = $f_m;
		//$pdf->Cell(15,5,$fecha_inicial,1,0,'C');
		
		$fec = (isset($_POST['fec2']))?$_POST['fec2']:"";
		include('DF20000.php');
		$fecha_final = $f_m;
	  // -->
	//if(!isset($_POST['r1']))$_POST['r1']="";  
	if(isset($_POST['r1']) &&$_POST['r1']=="no"){
		//echo '<input name="tbusqueda" type="hidden" value="no">';
	  	//$result = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE (status='RESERVA INDIVIDUAL' OR status='RESERVA GRUPO') and cancelado=1 ORDER BY n_reg");
		
   	}elseif(isset($_POST['r1']) &&$_POST['r1']=="f"){	
		//echo '<input name="tbusqueda" type="hidden" value="f">';
		//$result = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE ffecllegada >= '$fecha_inicial' and ffecllegada <= '$fecha_final' AND (status='RESERVA INDIVIDUAL' OR status='RESERVA GRUPO' or status='HUESPED')");
   	    
	}
	include("DE10000.php");
	while($reg = mysqli_fetch_array($result))
	{
	  	$cant ++;
		echo "<tr>";
		//echo '<td><div align="center"><input name="bot" type="radio" value="'. $reg["n_reg"].'">&nbsp</div></td>';
		$color=mysqli_fetch_array(mysqli_query($con ,"select * from tipmerca where tdescrip='".$reg['stipodaily']."'"));
		
		echo "<td> <div align='center' style='background-color:".$color['color'].";'><strong>" . $reg["descripcion"] . "&nbsp;</strong></div></td>";
		$Seg=mysqli_fetch_array(mysqli_query($con ,"select count(*) as ocupadas from valeryus19 where ffecllegada<='$fecha_inicial' and ffecsalida>='$fecha_inicial' and codseg='".$reg['descripcion']."' and status='HUESPED'"));
		//while ($S_dis=mysqli_fetch_array($Seg)){
		$var1=(isset($reg['fnombre']))?$reg['fnombre']:"";
		echo "<td> <div align='center'><strong>" . $Seg['ocupadas'] . ' '. $var1 . "&nbsp;</strong></div></td>";
		//}
		echo "<td> <div align='center'><strong>HABS</strong></div></td>";
		$Por=$Seg["ocupadas"]*100/392;
		echo "<td> <div align='center'><strong>" . number_format($Por,2,'.',',') . "%</strong></div></td>";
		
		$tot_ocu=$tot_ocu+$Seg["ocupadas"];	
		$tot_tot=$tot_tot+$Por;		
		echo "</tr>";
	}
	    echo "<tr><td><div align='center' style=' '><strong>HABITACIONES</strong></div></td>
                  <td><div align='center' style=' '><strong>".$tot_ocu."</strong></div></td>
	              <td><div align=\"center\" style=' '><strong>GRAN TOTAL</strong></div></td>
	              <td><div align=\"center\" style=' '><strong>". number_format($tot_tot,2,'.',',')."%</strong></div></td>
	          </tr>";
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>
<?php

//172----->100 ultima actualizacion reporte de rec_ocupacion 23/11/2011
?>