<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DF30000.inc");
include ("varfun.php");
include("JQUERY.inc");
$f_m="";
$tothb=0;

$Totaf=0;
?>
<html>
<HEAD> <meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8">
<style type="text/css">
<!--
.Estilo23 {font-size: 14px}
.Estilo24 {font-size: 10px}
.Estilo25 {font-weight: bold; font-family: Verdana, Helvetica;}
-->
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*/
}.Estilo27 {
	font-size: 10px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
--> 
</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="Estilo23">REPORTE DE COMPAÑIAS</span></th>
	  </tr>
	<tr>
	  <td><div align="right"><span class="Estilo27"><span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /> PERIODO</span></span></div></td>
	 <?php
          $fec=(isset($_POST['fec']))?$_POST['fec']:date('d/m/Y');
          ?>  
          <td>
	    <strong>De:</strong>
        <input name="fec" type="text" class="emplea datefrom" 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"/>
        -->
        <strong> A:</strong>
        <input name="fec2" type="text" class="emplea dateto" id="fec2" size="9" maxlength="20" value="<?=date("d/m/Y")?>"
			<?php

				if(isset($_POST['fec2'])){ //este es el truco
					echo 'value="' . $_POST['fec2'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?> onkeypress="return soloNumeros(event)"
		/>
        <!--<input name="bot12" id="bot1" type="image" value="Cal" src="logos/cal4.jpg" /></td>
	  --></tr>
	
	<tr>
	  <td> <div align="right" class="Estilo24"></div></td>
	  <td>
          </td>
	</tr>
      <tr>
        <td colspan="2">
            <div align="center">
              <a style="text-decoration:underline;cursor:pointer;" href="menu_PR.php"/></a>
              <input name="Submit" type="button" class="original" onClick="openpage('ger_empresas_PR.php','_self')" value="Buscar"/>
			  <!--input name="bot4" type="button" class="bot_WsW" onClick="envia('ger_empresas_IM.php','_self')" value="Imprimir "/-->
		  </div></td>  </tr>  
	 </table>  
  </form> </div>
<div align="center">
  <form method="post" action="" >
    <?php

	@$result = mysqli_query($con ,"SELECT distinct(fcodgrupo) FROM valeryus19 WHERE status = 'HISTORICO' AND fcodgrupo <>''");
	?>
    <table width="60%"   align="center" bordercolor=" " bordercolordark=" ">
	<tr><th colspan="15">&nbsp;</th>
	</tr>
      <tr>
        <th width="33%"><div align="center">EMPRESA</div></th>
		<th width="8%"><div align="center">PAX</div></th>
		<th width="9%"><div align="center">CTOS</div></th>
		<th width="24%"><div align="center">FEC DE LLEGADA</div></th>
		<th width="26%"><div align="center">TARIFA</div></th>
	  </tr>
	<?php

	 // --->
	//if(!isset($_POST['fec']))$_POST['fec']=""; 
		//if(!isset($_POST['fec2']))$_POST['fec2']="";
	  	$fec = (isset($_POST['fec']))?$_POST['fec']:"";
		include('DF20000.php');
		$fecha_inicial = $f_m;
	
		$fec = (isset($_POST['fec2']))?$_POST['fec2']:"";
		include('DF20000.php');
		$fecha_final = $f_m;
	  // -->
     $vars=(isset($_POST['Submit']))?$_POST['Submit']:"";
	      if ($vars==''){
	  	  $result = mysqli_query($con ,"SELECT distinct(fcodgrupo) FROM valeryus19 WHERE status = 'HISTORICO' AND fcodgrupo<>'' AND ffecllegada BETWEEN '".$fecha_inicial."' AND '".$fecha_final."' order by ffecllegada");
   	      	
	      }
		
//	$tohb1=mysqli_num_rows($tothb);
	include("DE10000.php");
	
	$nocuarto=0;
	while($reg = mysqli_fetch_array($result))
	{
		//echo "select *, sum(fnumadu) as pax, count(fnumcto) as ctos from valeryus19 where fcodgrupo='".$reg['fcodgrupo']."' order by ffecllegada";
	  	echo "<tr>";
		$compa=mysqli_query($con ,"select *, sum(fnumadu) as pax, count(fnumcto) as ctos from valeryus19 where fcodgrupo='".$reg['fcodgrupo']."' order by ffecllegada");
		
                while ($empresa=mysqli_fetch_array($compa)){
		echo "<td> <div align='left'><strong> &nbsp;". $empresa["fapellido"] . ' '. $empresa["fnombre"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $empresa["pax"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $empresa["ctos"] . "&nbsp;</strong></div></td>";
		$fec1=$empresa["ffecllegada"];
                $f_f="";
		include('DF20000.php');
               $fn=$f_f;
		echo "<td> <div align='center'><strong>" . $fn . "&nbsp</strong></div></td>";
		}
		//if(!isset($reg['ftotal']))$reg['ftotal']="";
                $varm=(isset($reg['ftotal']))?$reg['ftotal']:"";
		echo "<td> <div align='center'><strong>$" .  number_format(floatval($varm), 2, '.', ',') . "</strong></div></td>";
		$Totaf+=$varm;
	    	}
	    
	mysqli_close($con);
	?>
    </table> </form>  </div>  </body>  </html>
 