<?php
 
session_cache_limiter('private');
session_start();
include("DMMYSQLG.php");
require_once("DF80000.php");
$i=0;
$name="Inventario.xls"; 
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
	header('Content-Type: application/force-download');
else
	header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="'.$name.'"');

?>
  <table width="748" border='1'>       
	  <tr> <th  colspan="9"><span class="Estilo2 Estilo3">DISPONIBILIDAD X TIPO DE HABITACION </span></th> </tr>
	  <tr>  <td   width="104"><div align="center">TIPO DE CUARTOS</div>           </td>             
      <th width="593" colspan="8">FECHA DEL <?php
echo "".$_GET['fec']."";?> AL <?php
echo "".$_GET['fec2']."";?></th>             </tr>
	     <tr> <th>&nbsp; </th>
	           <?php

		$fec = $_GET['fec'];
		include('DF20000.php');
			$ffecllegada = $f_m;
		$fec = $_GET['fec2'];
		include('DF20000.php');
			$ffecsalida = $f_m;
	 while ( dateCmp($ffecllegada,$ffecsalida)<=0)
	 {
	 echo "<td width='60'  nowrap> ".chfecha($ffecllegada,'Y-m-d','dd')." </td>";
	 	$ffecllegada=addDay($ffecllegada,1); 
	 	 }
	 ?>    </tr>  <?php

$sql=mysqli_query($con ,$sq1="SELECT * FROM valeryus05 where descripcion!='MAESTRA' order by descripcion");
  
	while($reg = mysqli_fetch_array($sql))
	{
	$fec = $_GET['fec'];
		include('DF20000.php');
			$ffecllegada = $f_m;
		$fec = $_GET['fec2'];
		include('DF20000.php');
			$ffecsalida = $f_m;
		    echo "<tr>"; ?>
			<td width="160"><div align='center'><?php
echo "" . $reg["descripcion"] .""; ?></div></td>
		<?php
$i ++;
	 while ( dateCmp($ffecllegada,$ffecsalida)<=0)
	 {
	 $sqb=mysqli_fetch_array(mysqli_query($con ,"SELECT count(*) as OCupaDos  FROM valeryus19 where (ffecllegada <= '$ffecllegada' AND ffecsalida > '$ffecllegada' and ftipocto='".$reg['descripcion']."' and status!='HISTORICO' and cancelado='0') or (ffecllegada < '$ffecsalida' AND ffecsalida >= '$ffecsalida' and ftipocto='".$reg['descripcion']."' and status!='HISTORICO' and cancelado='0') or (ffecllegada > '$ffecllegada' AND ffecsalida < '$ffecllegada' and ftipocto= '".$reg['descripcion']."' and status!='HISTORICO' and cancelado='0')"));
	 $ResTa=$reg['totalcuartos']-$sqb['OCupaDos'];
	 echo "<td>&nbsp";		
	 echo "<div style='background:#b1d8ff; color:#000000; font-size:12px'>". $ResTa ."</div>";
	 	$ffecllegada=addDay($ffecllegada,1); 
		}	 	 
		echo "</td>";
					echo "</tr>";	
	}
			?>	
	</table>