<?php
if(session_id()=="") 
session_start();
include("DMMYSQLG.php"); 
 
include("DF80000.php"); 
 $fecha=$dt_empres['fec_alta']; 
    @$sql = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE ffecllegada='$fecha' and cancelado='0' AND (status='RESERVA INDIVIDUAL' or status= 'RESERVA GRUPO')");
   $reservas=  mysqli_num_rows($sql);
   @$sqlVIP = mysqli_query($con ,"select *  from valeryus19 where fvip='SI' and date('$fecha') between ffecllegada and ffecsalida and cancelado=0");
   @$sqlESP = mysqli_query($con ,"select *  from valeryus19 where con_1='1' and date('$fecha') between ffecllegada and ffecsalida and cancelado=0");
  @$sqldia = mysqli_query($con ,"select count(n_reg) as ocupadas,(select count(*) as cantid from valeryus08 WHERE ntipo<>'MAESTRA') as total,
(select count(n_reg) from valeryus19 where cancelado='0'
 and ffecllegada='$fecha' and ftipocto<>'MAESTRA' and extra1='0') as entradas,
 (select count(n_reg)
 from valeryus19 where ffecsalida='$fecha' and cancelado='0' and ftipocto<>'MAESTRA' and extra1='0')salidas

from valeryus19 where cancelado='0' and '$fecha'>ffecllegada and '$fecha'<=ffecsalida 
and ftipocto<>'MAESTRA' and extra1='0' order by fnumcto

");
 $dia= mysqli_fetch_array($sqldia);
  $user = $_SESSION['num_usu'];//153-380  
        $select = "select * from cmodulo left join cpermiso_grupo on url=modulo_url where servicio='hotelero' and  grupo_id in (select cgrupo_id from cusuario_grupo where dxopemaex_oper=$user)order by order_parent,order_child asc";
        $query = mysqli_query($con ,$select);
        $total = mysqli_num_rows($query);
            
        $con = 0;
        $parent="";
   
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es-es">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

<link rel="stylesheet" href="css/menu.css" type="text/css"/>
<script type="text/javascript"  src="js/jquery.js"></script>
<script type="text/javascript"  src="js/menu.js"></script>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
    .post-it {
background:#fefabc; 
padding:15px; 
font-family: 'Gloria Hallelujah', cursive; 
font-size:15px; 
color: #000; 
width:100px; 
float: left;
margin:2px; 
-moz-transform: rotate(7deg);
-webkit-transform: rotate(7deg);
-o-transform: rotate(7deg);
-ms-transform: rotate(7deg);
transform: rotate(7deg);

box-shadow: 0px 4px 6px #333;
-moz-box-shadow: 0px 4px 6px #333;
-webkit-box-shadow: 0px 4px 6px #333;

}
.red{
    background: #FF2F46;
}
.purple{
    background: #e100ff;
    width:160px; 
}
.pin {
  background-color: #aaa;
  display: block;
  height: 16px;
  width: 2px;
  position: absolute;
  left: 50%;
  top: -7px;
  z-index: 1;
}
.pin:after {
  background-color: blue;
  background-image: radial-gradient(25% 25%, circle, hsla(0,0%,100%,.3), hsla(0,0%,0%,.3));
  border-radius: 50%;

  content: '';
  height: 12px;
  left: -5px;
  position: absolute;
  top: -10px;
  width: 12px;
}
 
</style>
    
</head>

<body>


	<div id="menu">
<ul>

            <?php
            if($total==0){
//               esto se debe quitar cuando ya existan todos los usuario en un perifl
                  $select = "select * from cmodulo left join cpermiso_grupo on url=modulo_url where servicio='hotelero'  GROUP BY id order by order_parent,order_child asc";
        $query = mysqli_query($con ,$select);
        $total = mysqli_num_rows($query);
      
                } 
            while($row = mysqli_fetch_array($query)) {
                if($con == 0){  
                    $parent = $row['modulo_parent'];
                    echo "<li ><a href='#'>$parent </a>";
                    echo "<ul>";
                    $con++;
                }
                if($row['modulo_parent'] == $parent){                 
                        echo "<li ><a href=".$row['url'].">".$row['nombre']."</a></li>";               
                          $con++;
                    }  else{
                        $parent = $row['modulo_parent'];
                        echo "</ul></li>";
                        if($row['order_child']=="-1"){
                            echo "<li class='salir'><a href=".$row['url']." target='_top' class='salir'>$parent </a>";
                            echo "<ul>"; 
                            }
                            else{
                        echo "<li><a href='#'>".$parent."</a>";
                        echo "<ul>";
                           echo "<li ><a href=".$row['url'].">".$row['nombre']."</a></li>"; 
                            }
                         $con++;
                    }     
                }             
            ?>     
<li class="salir"><a href="servicios.php" target="_top" class="salir">SALIR</a></li>

  </ul> 
            
  </div>

   
    <div class="info" STYLE="color:#000; font-size:16px; width: 100%;display: block;margin:auto;font-weight: bold; height: auto;" >
        <div style="margin:auto; width: 1200px; display: block; position: relative">
        <iframe src="tipocambio.php" style="height: 400px;width:300px;float:left;margin:5px" border="none"></iframe>
        <iframe src="chat/index.php" style="width:500px;height:400px;margin:5px;float:left;"></iframe>      
        <div class="">
              

         <div class="post-it">
             <i class="pin"></i>
            Hoy se esperan <?=$reservas?> reservaciones            
        </div>
            <div class="post-it" style="background:greenyellow;">
             <i class="pin"></i>
            Status Hotel:
            Ocup: <?=$dia['ocupadas']?>   <br>
            Ent: <?=$dia['entradas']?>         <br> 
            Sal: <?=$dia['salidas']?>       <br>   
            Cierre: <?=($dia['ocupadas']+$dia['entradas'])-$dia['salidas']?> <br>
                     
        </div> 
        <?php
                while($reg = mysqli_fetch_array($sqlVIP))
                {
                echo '    
                <div class="post-it red">
                <i class="pin"></i> 
                <b style="color:blue">'.(($reg['fnumcto']=='')?$reg['fmuncto']:$reg['fnumcto']).'</b> es <b style="color:green">VIP</b>           
                </div>';
              
                      }
              ?>  
        
         <?php
                while($reg = mysqli_fetch_array($sqlESP))
                {
                echo '    
                <div class="post-it purple">
                <i class="pin"></i> 
                <b style="color:blue">'.(($reg['fnumcto']=='')?$reg['fmuncto']:$reg['fnumcto']).'</b> '.$reg['fapellido'].' '.$reg['fnombre'].' <b style="color:darkred">Servicio Especial</b>           
                </div>';
              
                      }
              ?>  
        
        </div>
        </div>
       
        
    </div>             

</body>

</html>
