<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
include("JQUERY.inc");
require_once("DF80000.php");
require_once("DFMOVCAP.inc");
require_once("DFJQUERY.inc");
//require_once("RG16100_CL.php");
require_once("DFSELMAN.inc");
require_once("DFJSISCI.inc");
//$encDieta = new dieTa($dataEnc);
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="javascript">
addEvent(window,'load',function(){
	objSelRan=new SelectManager('selran');
	addEvent(ge('tesecorral'),'click',function(){
		getOnLayer({
			idLayer:'divCorrales', 
			action:'RF41000_PR-SRV.php',
			title:'CORRALES',
			width:'200',
			height:'300',
			left:'500',
			top:'50',
			className:'divCorrales'
		},{
			gc:'1',
			ir:objSelRan.getSelectedValue(),
			sc:ge('tesecorral').value
		});
	});
	addEvent(ge('selran'),'change',function(){
		ge('tesecorral').value="";
	});	
	addEvent(ge('tesecorral'),'focus',function(){
		ge('tesecorral').blur();
	});
});
function actDiet(valRad){
	if(confirm("DESEA ACTUALIZAR ESTA DIETA?"))
		openpage('RG41000_AC.php','_self');
}

function checkAllBox(check){
	var objCorr=document.getElementsByName('checorr'),i=0,auxCheck= new Array(),auxi=0;
	for(i=0;i<objCorr.length;i++){
			objCorr['i'].checked=check;
	}
}
function devCheCorr(){
	var objCorr=document.getElementsByName('checorr'),i=0,auxCheck= new Array(),auxi=0;
	for(i=0;i<objCorr.length;i++){
		if(objCorr['i'].checked){
			auxCheck['auxi']=objCorr['i'].value;
			auxi++;
		}
	}
	ge('tesecorral').value= "|"+auxCheck.join('|')+"|";
	removeHTML_OBJECT('divCorrales');
}
</script>
<style type="text/css">
<!--
.Estilo6 {font-size: 14px}
#loadAse {
	position:absolute;
	width:50px;
	height:16px;
	z-index:1;
	left: 342px;
	top: 21px;
	overflow: auto;
}
.divCorrales{
	background- ;
	border:solid;
	border-color:#666666;
	border-bottom-width:1px;
}
.encCorr{
	background-color:#FF9900;
	color:#000000;
	font-family:Arial, Helvetica, sans-serif;
	font-size:14px;
	text-align:center;
}
.footCorr{
	background-color: ;
	color:#000000;
	font-family:Arial, Helvetica, sans-serif;
	font-size:14px;
	text-align:center;
}
.style9 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #FFFFFF; }
.dataAct{
	background-color:#F5F5F5;
	font-family:Arial, Helvetica, sans-serif;
	font-size:12px;
	font-weight:bold;
}
-->
</style><body onLoad="movCap({idObj:'loadAse'});">
<form name="frm1" id="frm1" method="post" action="" >
    <table width="498"   border="0" align="center" >
      <tr>
        <th colspan="7" nowrap>
          
          <div align="left">
            <label></label>
            APLICACION DIETAS</div></th>
      </tr>
      <tr>
        <td height="19" colspan="5" nowrap class="dataAct">Fecha Actualizacion:
          <input name="fecact" type="text" class="emplea date" id="fecact" size="15" 
			<?php
 
				if(isset($_POST['fecfin']))
			  		echo 'value="'.$_POST['fecfin'].'"'; 
			  	else
			  		echo 'value="'.date('d/m/Y').'"'; 
			?>>
        		  
        </td>
      </tr>
      <tr>
        <td height="19" nowrap class="dataAct">Rancho:</td>
        <td colspan="2" nowrap class="dataAct"><label>
          <select name="selran" id="selran">
		  	<option value="">Seleccione Rancho</option>
			<?php
 
			$sql = mysqli_query($con ,"SELECT * FROM valeryus05 order by descripcion");
			if(isset($_REQUEST['selran']))
				$selRancho=$_REQUEST['selran'];
			else
				$selRancho='';	
			while($row=mysqli_fetch_array($sql)){
				if($row['id_ranchos']==$selRancho)
					echo '<option value="'.$row['descripcion'].'" selected>'.$row['descripcion'].'</option>';
				else
					echo '<option value="'.$row['descripcion'].'">'.$row['descripcion'].'</option>';				
			}
			?>		
        </select>
        </label></td>
        <td colspan="2" nowrap class="dataAct">Corrales:
     
          <input name="tesecorral" type="text" id="tesecorral">     </td>
      </tr>
      <tr>
        <th width="29" height="19" nowrap>SEL</th>
        <th width="60" nowrap><div align="center">CLAVE. </div></th>
        <th width="143" nowrap>NOMBRE DIETA  </th>
		 <th width="96" nowrap>TIPO DE DIETA  </th>
		<th width="56" nowrap><div align="center">TOTAL</div></th>
	  </tr>
	  
	
	<?php

	$fec = '24/01/2014';
		include('DF20000.php');
		$fecha_inicial = $f_m;
		$fec = '25/01/2014';
		include('DF20000.php');
		$fecha_final = $f_m;
	echo "<td style=' '>";
		
		$proXlin=3;
$auxNumLin=-1;
@$resultado = mysqli_query($con ,"SELECT * FROM valeryus05 where clavetp<>'MTA' order by n_reg");
echo mysqli_error($con);
$g=1;
$count=mysqli_num_rows($resultado);
while(@$registro=mysqli_fetch_array(@$resultado)){
if(!isset($dt_invent['ncto']))$dt_invent['ncto']="";
    $sqb=mysqli_query($con ,"SELECT * FROM valeryus19 where status='HUESPED' and fnumcto= '".$dt_invent['ncto']."'");
$reb= mysqli_fetch_array($sqb);

	$auxNumLin++;
	if($auxNumLin==-1 || $auxNumLin%$proXlin==0){
		if($auxNumLin==-1){
			echo "<tr>";
		}else{
			echo "</tr><tr>";
		}
	}
	
	$ToT = $registro['totalcuartos'];
		$TiPo = $registro['descripcion'];
		
		$XoXo = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE (ffecllegada <= '$fecha_inicial' AND ffecsalida > '$fecha_inicial' and ftipocto = '$TiPo' and status != 'HISTORICO' and cancelado = '0') or (ffecllegada < '$fecha_final' AND ffecsalida >= '$fecha_final' and ftipocto = '$TiPo' and status <> 'HISTORICO' and cancelado = '0') or (ffecllegada > '$fecha_inicial' AND ffecsalida < '$fecha_final' and ftipocto = '$TiPo' and status <> 'HISTORICO' and cancelado = '0') ");
		$i = 0;
		while ($as = mysqli_fetch_array ($XoXo)){
		  $OCU = $as['fnumcto'];
		   $i++;
		}
		
		$aMa = mysqli_query($con ,"SELECT * FROM valeryusst08 WHERE (fec_ini <= '$fecha_inicial' AND fec_fin > '$fecha_inicial' and ftipocto = '$TiPo' ) or (fec_ini < '$fecha_final' AND fec_fin >= '$fecha_final' and ftipocto = '$TiPo' ) or (fec_ini > '$fecha_inicial' AND fec_fin < '$fecha_final' and ftipocto = '$TiPo') ");
		$a = 0;
		while ($status = mysqli_fetch_array ($aMa)){
		  $desocupadas = $status['fnumcto'];
		   //echo "-".$BLOQUEADAS."";
		   $a++;
		   
		} 
		 
		$rEs =$ToT -$i-$a;
		
		echo '<input name="ver1" type="hidden" value="'.$registro['descripcion'].'">';     
		
		echo "<td style=' '>";
		
		echo "<input name='box$g' type='checkbox' value='1' onClick='checkbox$g(box$g.checked)' "; 
	    
		/*if($_REQUEST['box'.$g])*/
                
               if(isset($_REQUEST['box'.$g])&&$_REQUEST['box'.$g]) echo 'checked';
		
		echo " />";
		
		echo "<em> Hay ".$rEs." Habitaciones ".$registro['descripcion']. " desocupadas </em></td>";    
		
		//echo "<td  style=\"color:#66CCFF\" style=' ' onclick=\"openWindow({action:'ventana.php'},{ncto:'".$dt_invent['ncto']."'})\"><div  style='background-color:".$dt_invent["ocupado"].";' align='center'>
//".$reb['fapellido']."<br>
//<br>".$oco.''.substr($registro['descripcion'],0,5)."<br>".$registro['descripcion']."</div></td>";
		
		echo "<td width='130' style='#66CCFF'>";
		
		echo "<input name='ingHab$g' type='text' tabindex='1' size='4' maxlength='10' onKeyPress='return soloNumeros(event)' onKeyUp='suma_campo()' ";
		
		if(isset($_REQUEST['box'.$g])&&$_REQUEST['box'.$g]=='1'){ 
		echo 'value="' . $_POST['campo1'] .  '" />';
		}else{
		echo 'value="0" disabled />';
		} 
		
		echo "</td>"; 
	
	$g++;
} 
	
	
	/*$encDieta->resetData(array("esAct"=>"0"));
	$sq_dieTa=$encDieta->getRegBySta();
	echo mysqli_error($con);
	
	while($dt_dieTa = mysqli_fetch_array($sq_dieTa)){
		 @$sql = mysqli_query($con ,"SELECT * FROM rgtipdie WHERE id_tipdie='".$dt_dieTa['id_tipdie']."'");
	     $reg1 = mysqli_fetch_array($sql);
		 
		 @$sql2 = mysqli_query($con ,"SELECT * FROM rgdetdie WHERE id_dieta='".$dt_dieTa['id_dieta']."'");
	
			
		echo "<tr>";
		echo '<td><div align="center"'.$class.'><input name="bot" type="radio" value="'. $dt_dieTa["id_dieta"].'" onclick="actDiet(this.value)">&nbsp</div></td>';
		echo '<td><div align="left" '.$class.'>'.$dt_dieTa["id_dieta"]. '&nbsp</div></td>';
		echo '<td><div align="left" '.$class.'>'. $dt_dieTa["nom_diet"]. '&nbsp</div></td>';
		echo '<td><div align="left" '.$class.'>'.$reg1["nom_tip"] . '&nbsp</div></td>';	
		echo '<td><div align="right"'.$class.'>'.number_format($dt_dieTa["tot_dieta"],2,'.',','). '&nbsp</div></td>';
		echo '</tr>';
	}
	mysqli_close($con);
//}	*/
	?>
  </table>
</form>    
	</form>
    </div>
</body>
</html>















































<?php
 
if(!isset($_SESSION)) {  session_start();  }
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
include("DF80000.php");
include("DFJQUERY.inc");

require_once("DFMOVCAP.inc");

require_once("DFSELMAN.inc");
require_once("DFJSISCI.inc");
$q=$_GET['num'];
//echo $q;
if ($q=='0' || $q==''){
$q='1';
}else{
$q=$q;
}
?>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="JavaScript">
function cambia_color(celda){

        
		//celda = document.getElementById("celda" + document.fcolor.celda.value)
		celda.style.backgroundColor="#FF00CC"
		
	}
function cambiar_color_over(celda){
		celda.style.backgroundColor=""
	}	
</script>
<script language="javascript">
addEvent(window,'load',function(){
	objSelRan=new SelectManager('selran');
	addEvent(ge('tesecorral'),'click',function(){
		getOnLayer({
			idLayer:'divCorrales', 
			action:'RF41000_PR-SRV.php',
			title:'CORRALES',
			width:'200',
			height:'300',
			left:'500',
			top:'50',
			className:'divCorrales'
		},{
			gc:'1',
			ir:objSelRan.getSelectedValue(),
			sc:ge('tesecorral').value
		});
	});
	addEvent(ge('selran'),'change',function(){
		ge('tesecorral').value="";
	});	
	addEvent(ge('tesecorral'),'focus',function(){
		ge('tesecorral').blur();
	});
});
function actDiet(valRad){
	if(confirm("DESEA ACTUALIZAR ESTA DIETA?"))
		envia('RG41000_AC.php','_self');
}

function checkAllBox(check){
	var objCorr=document.getElementsByName('checorr'),i=0,auxCheck= new Array(),auxi=0;
	for(i=0;i<objCorr.length;i++){
			objCorr['i'].checked=check;
	}
}
function devCheCorr(){
	var objCorr=document.getElementsByName('checorr'),i=0,auxCheck= new Array(),auxi=0;
	for(i=0;i<objCorr.length;i++){
		if(objCorr['i'].checked){
			auxCheck['auxi']=objCorr['i'].value;
			auxi++;
		}
	}
	ge('tesecorral').value= "|"+auxCheck.join('|')+"|";
	removeHTML_OBJECT('divCorrales');
}
</script>	
<?php

    if (isset($_POST['bt8'])){
      $mirror=mysqli_query($con ,"insert into valeryus29 set fnumcto='24'");
	  echo "<script language='javascript'>
				
					document.getElementById('form1').submit()
					
				 </script>";
}
	
	if (isset($_POST['asignado'])){
$fecha_llegada = chfecha($_POST['a1'],'d/m/Y','Y-m-d');
	$fecha_salida = chfecha($_POST['a2'],'d/m/Y','Y-m-d');
@$ss = mysqli_query($con ,"insert into valeryus29 SET ffecllegada='$fecha_llegada', ffecsalida='$fecha_salida', fnumcto='".$_POST['a3']."', fnombre='".$_POST['a4']."'");

}elseif (isset($_POST['denegar'])){
$fecha_llegad = chfecha($_POST['b1'],'d/m/Y','Y-m-d');
	
@$ss = mysqli_query($con ,"delete from valeryus29 where ffecllegada='$fecha_llegad' and fnumcto='".$_POST['b3']."'");
}
?>
<style type="text/css">
<!--
.Estilo2 {color: #000099}
body {
	background-image: url(fondo.JPG);
}
-->
</style>
<link href="css/estilo1.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo3 {
	color: #FFFFFF;
	font-size: 14px;
}
.Estilo5 {font-size: 16px}
.Estilo16 {	font-size: 18px;
	font-weight: bold;
}
-->
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*/
}.Estilo17 {font-size: 12px}
--> 
</style>
<!--DIV STYLE="position:absolute; top:-20px; left:30px">
<img src="img/sihteolsd.gif"/></DIV-->  	
<DIV STYLE="position:absolute; top:350px; left:1000px">
<?php

//echo "<img src='logos/".$_SESSION['base'].".gif' width='120' height='120'/>";
 ?>
</DIV>
<body onLoad="movCap({idObj:'loadAse'});">

<!--div align="left">
<a href="menu_PR.php"/><img src="logos/WER.gif" align="center"/></a>
</div-->
<div align="center">
<?php

if (isset($_POST['mirror'])){
echo 'hola';
}
?>
  <form name="form1" method="post" action="">
    <table width="775" border="0" align="center">
		<tr>
		  <th colspan="2"><span class="Estilo5">CHART DE OCUPACI&Oacute;N X NOMBRE</span></th>
	  </tr>
		<tr>
		  <th colspan="2"><span class="Estilo5">
          <input name="asignado" type="submit" style="background:#FF00CC" value=" ASIGNAR" size="50"/>
          <span class="Estilo17">FEC  LLEGADA</span>
          <input name="a1" type="text" size="8" id="a1"/>
			  <input name="img_1"  value=" ... " id="img_1" type="image" src="logos/cal4.jpg"/>
		        <script type="text/javascript">
				  	Calendar.setup(
    					{
      						inputField  : "a1",        // ID of the input field
      						ifFormat    : "%d/%m/%Y",    // the date format
      						button      : "img_1"      // ID of the button
    					}
  					);
				</script>
          <span class="Estilo17">FEC  SALIDA</span> 
          <input name="a2" type="text" size="8" id="a2"/>
		  <input name="img_2"  value=" ... " id="img_2" type="image" src="logos/cal4.jpg"/>
		        <script type="text/javascript">
				  	Calendar.setup(
    					{
      						inputField  : "a2",        // ID of the input field
      						ifFormat    : "%d/%m/%Y",    // the date format
      						button      : "img_2"      // ID of the button
    					}
  					);
				</script>
          <span class="Estilo17">HAB</span>
          <input name="a3" type="text" size="4" id="a3"/>
          <span class="Estilo17">HUESPED</span>
          <input name="a4" type="text" size="10" id="a4"/>
        </span></th>
	  </tr>
		<tr>
		  <th colspan="2"><span class="Estilo5">
          <input name="denegar" type="submit" style="background:#FF00CC" value="DENEGAR" size="50"/>
          <span class="Estilo17">FEC  LLEGADA</span>
          <input name="b1" type="text" size="8" id="b1"/>
			  <input name="img_4"  value=" ... " id="img_4" type="image" src="logos/cal4.jpg"/>
		        <script type="text/javascript">
				  	Calendar.setup(
    					{
      						inputField  : "b1",        // ID of the input field
      						ifFormat    : "%d/%m/%Y",    // the date format
      						button      : "img_4"      // ID of the button
    					}
  					);
				</script>
          <span class="Estilo17">HAB</span>
          <input name="b3" type="text" size="4" id="b3"/>
       
        </span></th>
	  </tr>
		
      <tr>
        <th width="482"> <input name="r1" type="checkbox" value="ffecllegada" tabindex="1">
        PERIODO</th>
        <th width="283"><input name="r1" type="checkbox" value="ncto" tabindex="2">
        HABITACI&Oacute;N</th>
      </tr>
      <tr>
        <td><div align="center">
          <input name="t1" type="text" class="thcons" id="t1" size="10"  readonly onBlur="valFecha(this)"
			  <?php
 
			  if(isset($_POST['t1'])){
			  	echo 'value="'.$_POST['t1'].'"'; 
			  }else{
			  	echo 'value="'.date('d/m/Y').'"'; 
			  }
			  ?>
			  >
		      &nbsp;
		      <input name="reset2"  value=" ... " id="bot1" type="image" src="logos/cal4.jpg"/>
		        <script type="text/javascript">
				  	Calendar.setup(
    					{
      						inputField  : "t1",        // ID of the input field
      						ifFormat    : "%d/%m/%Y",    // the date format
      						button      : "bot1"      // ID of the button
    					}
  					);
				</script>
		        <span class="Estilo16">/</span>
		        <input name="t2" type="text" class="thcons" id="t2" size="10" readonly onBlur="valFecha(this)" value="<?php
$tmt = mktime($mes, $dia, $anio); $eft = $tmt + 604800 ;  $fecha = date("d/m/Y", $eft); echo $fecha;?>"			 				
		  <?php
 
			  	if(isset($_POST['t2'])){
			  		echo 'value="'.$_POST['t2'].'"'; 
			  	}else{
			  		echo 'value="'.date('d/m/Y').'"'; 
			  	}
			  	?>
			 	 >
		         &nbsp;
		         <input name="reset" value=" ... " id="bot2" type="image" src="logos/cal4.jpg"/>
				<script type="text/javascript">
				  	Calendar.setup(
    					{
      						inputField  : "t2",        // ID of the input field
      						ifFormat    : "%d/%m/%Y",    // the date format
      						button      : "bot2"      // ID of the button
    					}
  					);
				</script>
                <select name="selran" id="selran">
                  <option value="">Seleccione Rancho</option>
                  <?php
 
			$sql = mysqli_query($con ,"SELECT * FROM valeryus05 order by descripcion");
			if(isset($_REQUEST['selran']))
				$selRancho=$_REQUEST['selran'];
			else
				$selRancho='';	
			while($row=mysqli_fetch_array($sql)){
				if($row['id_ranchos']==$selRancho)
					echo '<option value="'.$row['descripcion'].'" selected>'.$row['descripcion'].'</option>';
				else
					echo '<option value="'.$row['descripcion'].'">'.$row['descripcion'].'</option>';				
			}
			?>
                </select>
        </div></td>
        <td><div align="center">
          <input name="s3" type="text" id="s3" onBlur="may(this)" size="15"/>
        <input name="tesecorral" type="text" id="tesecorral"></div></td>
      </tr>
      <tr>
        <td colspan="2"><div align="center">
		  <input name="Submit" type="submit" class="original" value="Buscar" />
        </div></td>
      </tr>
    </table>
	<table align="center" >
	<?php

	$ruum=mysqli_fetch_array(mysqli_query($con ,"select * from valeryus05 where n_reg='$q'"));
	//SELECT 
		//distinct(dgger_cajerosd.tip_pag) as tip 
		//FROM 
		//dgger_cajerosj 
		//inner join dgger_cajerosd on dgger_cajerosj.n_rec=dgger_cajerosd.n_rec
		//inner join dgpemema on dgger_cajerosj.pedido=dgpemema.fol_ven
		//where 
		//dgpemema.fec_ven between '$fecha_inicial' and '$fecha_final' 
		//and dgger_cajerosj.cancelado='0' order by dgger_cajerosd.tip_pag
	$atr_hab=mysqli_query($con ,"SELECT 
	                      distinct(valeryus080.nparte1_det) as aTrIbUtOs
						  from 
						  valeryus08 
						  INNER JOIN valeryus080 on valeryus08.n_reg=valeryus080.nparte1
						  where valeryus08.ntipo='".$ruum['descripcion']."' order by valeryus080.nparte1_det");
	$i=0;
	while ($AtR2=mysqli_fetch_array($atr_hab)){
	$tiOAtr=mysqli_fetch_array(mysqli_query($con ,"select * from fatributos where n_reg='".$AtR2['aTrIbUtOs']."'"));
	$Atr[]=$AtR2['aTrIbUtOs'];
	echo "<tr>
	<td><input type='checkbox' value='".$AtR2['aTrIbUtOs']."' name='r1[$i]'/></td>
	<td>".$tiOAtr["tpdescrip"]."</td>
	</tr>";
	$i++;
	}
	
	
	?>
	<?php

	  $sql_valeryus05=mysqli_query($con ,"SELECT * FROM valeryus05 where clavetp<>'MTA'");
	 
	  
	 
	  
	  echo '<table border="0" width="190">';
			

		echo "
		<tr>
			<td class=\"encCorr\" width=\"50\"><input type=\"checkbox\" value=\"\" onclick=\"checkAllBox(this.checked)\">Sel.</td>
			
		</tr>";
         $i = 1; 
		 while ($dt_valeryus05=mysqli_fetch_array($sql_valeryus05)){
			
			echo "
			<tr>";
			
			?>
			
			 <td><input name="d[$i]" type="checkbox" value="<?php
echo "".$dt_valeryus05["n_reg"]."";?>" tabindex="5" <?php
if($_POST["d".$i]=="".$dt_valeryus05["n_reg"]."") echo 'checked';?>/></td>
			
			<?php

			echo '<td class="granTotAb"><input name="bot[]" id="bot[]" type="checkbox" value="'. $dt_valeryus05['n_reg'].'">&nbsp;</td>';	
			echo "	<td><input type=\"checkbox\" value=" .$dt_valeryus05['n_reg']." name=\"checorr[]\" $checked></td>
				<td>".$dt_valeryus05['clavetp']."</td>
				<td>$dt_valeryus05".['descripcion']."</td>
			</tr>";			
		$i++;
		}
		echo "</table>";
		?>
  </form>
</div>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="" >
  <input name="botf1" type="hidden" value="
  <?php
 
  if(!isset($_POST['t1'])){
  	echo date('d/m/Y');
  }else{
  	echo $_POST['t1'];
  }
  ?>">
      <input name="botf2" type="hidden" value="
  <?php
 
  if(!isset($_POST['t1'])){
  	echo date('d/m/Y');
  }else{
  	echo $_POST['t2'];
  }
  ?>">
  <?php

	if(isset($_POST['t1'])){
		$fec = $_POST['t1'];
		include('DF20000.php');
			$ffecllegada = $f_m;
		$fec = $_POST['t2'];
		include('DF20000.php');
			$ffecsalida = $f_m;
		
	}
	?>
  	  <style type="text/css" >
    #bot1 {
    border: 0 0 0 0;
    padding: 0;
    text-align: center;
    }
    
    #bot1 a{
    background-image:url(images/bg_menu_1.png);
    height:30px;
    width:100px;
    background-position: center top;
    display: block;
    color: #990000;
    text-decoration: none;
    padding-top: 5px;
    background-repeat: no-repeat;
    font-weight: bold;
    }
    #bot1 a:hover{
    background-image: url(images/bg_menu_2.png);
    }
    #bot1 a:focus{
    background-image:url(images/bg_menu_3.png);
    }
    </style>
	<?php

	  
	   for ($i=1;$i<=10;$i++){ 
	  echo "ddd".$_POST["checorr" . $i]."<BR>";
	   echo "ddd".$_POST["bot" . $i]."<BR>";
	    echo "ddd".$_POST["r2" . $i]."<BR>";
	  }
	  
	  
	  if ($_POST['bot']!=''){

$i=0; 
foreach($_POST['bot'] as $id) 
{ 
$idc[$i]=$id; 
}
}
	  ?>
	  
	  
	  <table width="713" border='1'>
	  
     <tr>
	 <?php

	 $array=mysqli_query($con ,"select * from valeryus05 where descripcion<>'MAESTRA' AND n_reg<>'$q'");
	   while ($cuartos=mysqli_fetch_array($array)){
	     echo "<td><div align='center'><span id='bot1'><a href='rec_checkin_CH".$cuartos['n_reg'].".php?num=".$cuartos['n_reg']."'>  "         .$cuartos['descripcion']."</a></span></div></td>";  }		  
	 ?>
	 
	 </tr>
	 
	  <tr>
	  
	      <th  colspan="60"> <div align="center">
        </div></th>
      </tr>
      <tr>
        <?php

	  $room=mysqli_fetch_array(mysqli_query($con ,"select * from valeryus05 where n_reg='$q'"));
	  ?>
        <th  colspan="60"><span class="Estilo2 Estilo3">CHART DE OCUPACI&Oacute;N X NOMBRE <?php
echo "(".$room['descripcion'].")";?></span></th>
	  </tr>
	
	     <tr>
        <th   width="104"><div align="center">HABITACI&Oacute;N</div>          </th>        <div align="center"></div>                
      <th width="593" colspan="60">FECHA
	     </tr>
	     <tr>
		 <th>&nbsp; </th>
	       
	           <?php

			   if(isset($_POST['t1'])){
		$fec = $_POST['t1'];
		include('DF20000.php');
			$ffecllegada = $f_m;
		$fec = $_POST['t2'];
		include('DF20000.php');
			$ffecsalida = $f_m;
			
	 while ( dateCmp($ffecllegada,$ffecsalida)<=0)
	 {
	 echo "<th> ".whatDay($ffecllegada)." ".chfecha($ffecllegada,'Y-m-d','dd')." </th>";
	 
	 	$ffecllegada=addDay($ffecllegada,1); 
		
	 	 }
		 }
	 ?>        
        </tr>
<?php

if (trim($_POST['r1'])!=''){
		foreach($_POST['r1'] as $i=>$AtR2['aTrIbUtOs']){
		
		//$dataBus="nparte1_det='".$AtR2['aTrIbUtOs']."'";
		//$WHERE=implode(" AND ",$dataBus);
		//echo "".$WHERE."";
		$dataBus[]="valeryus080.nparte1_det='".$AtR2['aTrIbUtOs']."'";
		//echo "nparte1_det='".$AtR2['aTrIbUtOs']."'";
		//echo "".$dataBus."";
		}
		
		$contador = count($dataBus);
		
		echo $contador;
		
		if ($contador='1'){
		//echo '1';
		$szc="SELECT * FROM valeryus08 inner join valeryus080 on valeryus08.n_reg=valeryus080.nparte1 where nparte1_det='".$AtR2['aTrIbUtOs']."' and valeryus08.ntipo='".$room['descripcion']."' order by valeryus08.ncto";
		//echo "".$szc."";
		$sql=mysqli_query($con ,$szc);
		}elseif ($contador>'1'){
		//for ($d=0; $d<= $contador-1; $d++){
                       	       
		 //$data[] = "SELECT * FROM valeryus08 inner join valeryus080 on valeryus08.n_reg=valeryus080.nparte1 where nparte1_det='".$AtR2['aTrIbUtOs']."' and valeryus08.ntipo='".$room['descripcion']."' order by valeryus08.ncto";
						   
		 ///}          
		}
		
	//	$WHERE=implode(" and ",$dataBus);
	//	echo "".$WHERE."";
	
	
	
	
	//	$szc="SELECT * FROM valeryus08 inner join valeryus080 on valeryus08.n_reg=valeryus080.nparte1 where ($WHERE) and valeryus08.ntipo='".$room['descripcion']."'order by valeryus08.ncto";
	//	echo "".$szc."";
	//	$sql=mysqli_query($con ,$szc);
	
	
		
		}else{
		$sql=mysqli_query($con ,"SELECT * FROM valeryus08 where ntipo='".$room['descripcion']."'order by ncto");
		}
		
		//$sql=mysqli_query($con ,"SELECT * FROM valeryus08 
		
		//where  and valeryus08.ntipo='".$room['descripcion']."' order by valeryus08.ncto");
		
?>		
        
	<?php

	echo "zzzzzzzzz".$_POST['r1']."<BR>";
	echo "xxxxxxxxx".$_POST['r2']."";
	
	

	
	 if(isset($_POST['t1'])){
	 
	 $i=0; 
foreach($_POST['d'] as $id) 
{ 
echo $idc[$i]=$id;
 //echo "--->".$idc[$i]."<br>";
	 }
	 /*for ($i=1;$i<=5;$i++){ 
	echo "".$i."xxxxxxxxx".$_POST['r2'.$i]."<br>";
	}*/
	while($reg = mysqli_fetch_array($sql))
	{
	$fec = $_POST['t1'];
		include('DF20000.php');
			$ffecllegada = $f_m;
		$fec = $_POST['t2'];
		include('DF20000.php');
			$ffecsalida = $f_m;
		    echo "<tr>";
			?>
			<td style='background-color:<?php
echo "".$reg['ocupado']."" ?>;' onClick="envia('valeryus60100.php?ncto=<?php
echo $reg['ncto'] ?>&&tipo=<?php
 echo $reg['ntipo']?>','_self')"><div align='center' style=' '><?php
echo "" . $reg["ncto"] ." | ".$reg["ntipo"]. ""; ?></div></td>
			<?php

	$i ++;
	 while ( dateCmp($ffecllegada,$ffecsalida)<=0)
	 {

	 $sqb=mysqli_query($con ,"SELECT * FROM valeryus19 where ffecllegada <= '$ffecllegada' and  ffecsalida>='$ffecllegada' and fnumcto= '".$reg['ncto']."'");
	 echo "<td onclick='$varible_clase->agregar();' onDblClick='cambiar_color_over(this)' id='mirror'>&nbsp";
		while ($reb= mysqli_fetch_array($sqb)) {
	 		echo "<div style='background:#b1d8ff; color:#000000; font-size:12px'>". $reb["fapellido"] ."|</div>";
	 	}
		

	$sqb3=mysqli_query($con ,"SELECT * FROM valeryus29 where ffecllegada <= '$ffecllegada' and  ffecsalida>='$ffecllegada' and fnumcto= '".$reg['ncto']."'");
	 
		while ($reb3= mysqli_fetch_array($sqb3)) {
	 		?>
			<div style='background:#FF00CC;  ; font-size:12px'><?php
echo "".$reb3["fnombre"]."";?></div>
	 	<?php

		}	
	 //	$ffecllegada=addDay($ffecllegada,1); 
	//	}	 	 
//		echo "</td>";
	//				echo "</tr>";	
	//}
	
	 $sqb2=mysqli_query($con ,"SELECT * FROM valeryus19 where ffecllegada <= '$ffecllegada' and  fecha_real>='$ffecllegada' and fmuncto= '".$reg['ncto']."'");
// echo "<td>&nbsp";
		while ($reb2= mysqli_fetch_array($sqb2)) {
	 		echo "<div style='background:#FF9933; color:#000000; font-size:12px'>". $reb2["fapellido"] ."|</div>";
	 	}
	 	$ffecllegada=addDay($ffecllegada,1); 
		}	 	 
		echo "</td>";
					echo "</tr>";	
	}

	
	//	echo "<td> <div align='center'>kak3</div></td>";

	mysqli_close($con);
	
}


	//523-->250 ?>  
  </table> 
  </form>
</div>
</body>
</html>