<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DF30000.inc");
include("DFJQUERY.inc");
include("JQUERY.inc");
$f_m="";
$nr=0;
?>
<html>
<HEAD> <meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8">
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>

</HEAD>

<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="377" border="0">
	<tr>
	  <th colspan="2"><span class="Estilo23">REPORTE DE ENTRADAS (POR DIA) </span> </th>
	  </tr>
	<tr>
	  <td width="157"> <div align="right" class="Estilo24">
	    <div align="left"><span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /> FECHA DE ENTRADA</span></div>
	  </div></td>
	  <td width="210"><input name="r1" type="radio" value="f" id="f" tabindex="5"/>
	   <?php $varfec=(isset($_POST['fec']))?$_POST['fec']:date('d/m/Y');?>
          <input name="fec" type="text" class="emplea date" id="fec" size="9" maxlength="20" value="<?=$varfec?>"
			<?php

				if(isset($_POST['fec'])){ //este es el truco
					echo 'value="' . $_POST['fec'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?>onkeypress="return soloNumeros(event)"
		/>
         
   	    </td>
	</tr>
	<tr>
	  <td colspan="2" height="25">	  </td>
	  </tr>
      <tr>
        <td colspan="2">
            <div align="center">
              
              <input name="Submit" type="button" class="original" onClick="openpage('aud_entradas_PR.php','_self')" value="Buscar"/>
			  <input name="bot4" type="button" class="bot_WsW" onClick="openpage('aud_entradas_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 valeryus19 WHERE ffecllegada='".$dt_empres['fec_alta']."' and cancelado='0'");
	@$prono=mysqli_fetch_array(mysqli_query($con ,"select count(*) as total, SUM(fnumadu) AS adultos, SUM(fnummenor) AS menores from valeryus19 where status = 'huesped' and ffecllegada='".$dt_empres['fec_alta']."'"));
	?>
    <div style="height:450px; overflow:scroll; width:1150;" align="center">
	<table>
      <tr>
        <th><div align="center">FEC. DE LLEGADA</div></th>
		<th><div align="center">FEC. DE SALIDA.</div></th>
		<th><div align="center">FOLIO</div></th>
        <th><div align="center">CLIENTE</div></th>
		<th><div align="center">HAB.</div></th>
		<th><div align="center">TIPO</div></th>
		
		<th><div align="center">ADUL</div></th>
		<th><div align="center">MEN</div></th>
		
		<th><div align="center">AGENCIA</div></th>
		<th><div align="center">FORMA DE PAGO</div></th>
		<th><div align="center">SALDO</div></th>
		<th><div align="center">MERCADO</div></th>		
		<th><div align="center">SEGMENTO</div></th>				

	  </tr>
	<?php

	 // --->
	  	$fec = ( (isset($_POST['fec']))?$_POST['fec']:"" );/*$_POST['fec'];*/
		include('DF20000.php');
		$fecha_inicial = $f_m;
		
	  // -->
	if(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 cancelado='0' order by ffecllegada");
		@$prono=mysqli_fetch_array(mysqli_query($con ,"select count(*) as total, SUM(fnumadu) AS adultos, SUM(fnummenor) AS menores from valeryus19 where ffecllegada='$fecha_inicial' and cancelado='0'"));
		
	}
	
	while($reg = mysqli_fetch_array($result))
	{
	  	
		$nr = $nr + 1;
		$v1 = $nr / 2;
		$v2 = (int) ($nr / 2);
		  if($v1 == $v2){
			$col ="";
		   }else{
			$col ="";
		   }
		
		echo "<tr>";
		if ($reg["fnumcto"]!='' || $reg["fnumcto"]!='0'){
		$reg["fnumcto"]=$reg["fmuncto"];
		}else{
		$reg["fnumcto"]=$reg["fnumcto"];
		}
		if ($reg["status"]=='HUESPED' or $reg["status"]=='HISTORICO'){
		$fec1=$reg["ffecllegada"];
		include('DF20000.php');
		echo "<td style='#C60636'> <div align='center'><strong>" . $f_f . "&nbsp</strong></div></td>";
		$fec1=$reg["ffecsalida"];
		include('DF20000.php');
		echo "<td style='#C60636'> <div align='center'><strong>" . $f_f . "&nbsp</strong></div></td>";
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["n_reg"] . "&nbsp;</strong></div></td>";
		echo "<td style='#C60636'> <div align='left'><strong> &nbsp;". $reg["fapellido"] . ' '. $reg["fnombre"] . "&nbsp;</strong></div></td>";
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["fnumcto"] . "&nbsp;</strong></div></td>";
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["ftipocto"] . "&nbsp;</strong></div></td>";
		
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["fnumadu"] . "&nbsp;</strong></div></td>";
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["fnummenor"] . "&nbsp;</strong></div></td>";
		
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["fcodagen"] . "&nbsp;</strong></div></td>";
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["fformpago"] . "&nbsp;</strong></div></td>";
		echo "<td style='#C60636'> <div align='center'><strong>$" .  number_format($reg['suma'], 2, '.', ',') . "</strong></div></td>";
		
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["fcodmeca"] . "&nbsp;</strong></div></td>";
		echo "<td style='#C60636'> <div align='center'><strong>" . $reg["codseg"] . "&nbsp;</strong></div></td>";	
		echo "</tr>";
		echo "<tr>";
		echo "<th><div align='center'><strong>NOTAS&nbsp;</strong></div></th>";				
		echo "<td colspan='13' style='#C60636'> <div align='left'><strong>&nbsp;" . $reg["fnorasvip"] . "&nbsp;</strong></div></td></tr>";
		}else{
		$fec1=$reg["ffecllegada"];
		include('DF20000.php');
		echo "<td style='".$col."'> <div align='center'><strong>" . $f_f . "&nbsp</strong></div></td>";
		$fec1=$reg["ffecsalida"];
		include('DF20000.php');
		echo "<td style='".$col."'> <div align='center'><strong>" . $f_f . "&nbsp</strong></div></td>";
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["n_reg"] . "&nbsp;</strong></div></td>";
		echo "<td style='".$col."'> <div align='left'><strong> &nbsp;". $reg["fapellido"] . ' '. $reg["fnombre"] . "&nbsp;</strong></div></td>";
		
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["fnumcto"] . "&nbsp;</strong></div></td>";
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["ftipocto"] . "&nbsp;</strong></div></td>";
		
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["fnumadu"] . "&nbsp;</strong></div></td>";
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["fnummenor"] . "&nbsp;</strong></div></td>";
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["fcodagen"] . "&nbsp;</strong></div></td>";
		
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["fformpago"] . "&nbsp;</strong></div></td>";
		echo "<td style='".$col."'> <div align='center'><strong>$" .  number_format($reg['suma'], 2, '.', ',') . "</strong></div></td>";
		
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["fcodmeca"] . "&nbsp;</strong></div></td>";
		echo "<td style='".$col."'> <div align='center'><strong>" . $reg["codseg"] . "&nbsp;</strong></div></td>";	
		echo "</tr>";
		echo "<tr>";
		echo "<th><div align='center'><strong>NOTAS&nbsp;</strong></div></th>";				
		echo "<td colspan='13'> <div align='left'><strong>&nbsp;" . $reg["fnorasvip"] . "&nbsp;</strong></div></td></tr>";
		
		}
		//echo "<tr><td  colspan='13'  height='5' style='background:#000099'></td></tr>";

	    	}
	    echo "<tr><th colspan='2'><div align='center' style=' '><strong>FOLIOS :</strong></div></th>
                  <th colspan='3'><div align=\"center\" style=' '><strong>".$prono['total']."</strong></div></th>
                  <th><div align='center' style=' '><strong>PERSONAS :</strong></div></th>
	              <th><div align=\"center\" style=' '><strong>".$prono['adultos']."</strong></div></th>
	              <th><div align=\"center\" style=' '><strong>".$prono['menores']."</strong></div></th>
 				 <th colspan='5'><div align=\"center\" style=' '><strong> &nbsp;</strong></div></th>		 								
	          </tr>";
	mysqli_close($con);
	?>
    </table>
	</div>
  </form>
</div>
</body>
</html>