<?php
  include("stilos/config.inc.php");
  include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  include("funcion/funciones.php");
  include("Funciones.php");
  session_start();
  $objPer=new clsPer;
 $rsdato=$objPer->getTransTipoBitacoraCab($mat_trans,extraerfechamysql($fecha1));				
 $rowdato=$objPer->NextRow($rsdato);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><MMString:LoadString id="insertbar/formsHidden" /></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">

<link href="Estilos.css" rel="stylesheet" type="text/css">

<link href="stilos/Estilos.css" rel="stylesheet" type="text/css">

<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script language="javascript">
$(document).ready(function() {
	$(".botonExcel").click(function(event) {
		$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
		$("#FormularioExportacion").submit();
});
});
</script>
<style type="text/css">
.botonExcel{cursor:pointer;}
</style>
<script language="javascript" type="text/javascript">
  function volver(){
     window.location="fondo.php";
                   }
</script>
</head>

<body onLoad="print()">
<table width="1020" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="15" class="lblTitulo">&nbsp;</td>
    <td height="15" class="lblTitulo">&nbsp;</td>
  </tr>
  <tr>
    <td width="385" height="15" ><div align="left"></div></td>
    <td width="635"><div align="left">
    </div></td>
  </tr>
  <tr>
    <td height="15" colspan="2"><div align="left"></div></td>
  </tr>
  <tr>
    <td colspan="2"><div align="left">
        <table width="859" border="0" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>" id="Exportar_a_Excel">
          <tr valign="top">
            <td width="176" rowspan="4"><img src="../imagenes/logo_perenco.GIF" width="150" height="54"></td>
            <td colspan="7" class="lblTitulo"><div align="left">PERENCO PERU LIMITED SUC. DEL PERU </div></td>
          </tr>
          <tr valign="top" class="lblCampo">
            <td width="342"><div align="left">Fecha</div></td>
            <td width="341" colspan="4"><div align="left"><?=extraerfechanormal($rowdato['fecha_mpass'])?></div></td>
          </tr>
          <tr valign="top" class="lblCampo">
            <td><div align="left">Piloto</div></td>
            <td colspan="4"><div align="left">
              <?=$rowdato['nom_per'].",".$rowdato['appat_per']." ".$rowdato['apmat_per'];?>
            </div></td>
          </tr>
          <tr valign="top" class="lblCampo">
            <td><div align="left">Aeronave</div></td>
            <td colspan="4"><div align="left">
              <?=$rowdato['mat_trans']?>
            </div></td>
          </tr>
          <tr valign="top">
            <td><div align="left" class="lblTitulo">BITACORAS DE VUELO </div></td>
            <td><div align="left" class="lblCampo">Empresa</div></td>
            <td colspan="4"><div align="left">
              <?=$rowdato['cia_ant']?>
            </div></td>
          </tr>
          <tr valign="top">
            <td>
              <div align="left"></div>              </td>
            <td colspan="7"><div align="left">
            </div></td>
          </tr>
          <tr valign="top">
            <td colspan="8"><div align="left">
              <table width="859" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                  <td width="17">&nbsp;</td>
                  <td colspan="2"><div align="center">Ruta</div></td>
                  <td width="61">Arranca</td>
                  <td colspan="2"><div align="center">TVC</div></td>
                  <td width="60">Apaga</td>
                  <td width="60">TVC</td>
                  <td width="60">Tv A/A </td>
                  <td colspan="2"><div align="center">Recarga JP-1</div></td>
                  <td colspan="4"><div align="center">Pax y Carga </div></td>
                  <td width="150">&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                  <td rowspan="2"><div align="center">N&ordm;</div></td>
                  <td width="36" rowspan="2">Origen</td>
                  <td width="38" rowspan="2">Destino</td>
                  <td rowspan="2">Hora / Minuto</td>
                  <td width="60">Decola</td>
                  <td width="34">Aterri.</td>
                  <td rowspan="2">Hora / Minuto</td>
                  <td rowspan="2">Hora / Minuto</td>
                  <td rowspan="2">Hora / Minuto</td>
                  <td width="32" rowspan="2"><div align="center">Lugar</div></td>
                  <td width="31" rowspan="2"><div align="center">Glns</div></td>
                  <td width="25" rowspan="2"><div align="center">N&ordm; Pax</div></td>
                  <td width="31" rowspan="2"><div align="center">Pax Kg </div></td>
                  <td width="40" rowspan="2"><div align="center">Carga Kg </div></td>
                  <td width="41" rowspan="2"><div align="center">Total Kg</div></td>
                  <td rowspan="2"><div align="center">Obser.</div></td>
                  <td width="47" rowspan="2"><div align="center">Prog.</div></td>
                </tr>
                <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                  <td>Hora / Minuto</td>
                  <td width="34">Hora / Minuto</td>
                </tr>
                <?
					$horat=0;
					$horatec=0;
				    $totalnumper=0;
					$tpesopass=0;
					$tpesocarga=0;
					$pesototaltrans=0;
					$totalcombus=0;
					$n=0;
					$rs=$objPer->getTransTipoBitaCab($mat_trans,extraerfechamysql($fecha1));	//getTransTipoFecha			
					
                  while($row=$objPer->NextRow($rs))
                   {			   
				   ?>
                <tr valign="top" class="lblForm" >
                  <td class="lblForm">
                    <div align="center"> <? echo ++$n; ?> </div></td>
                  <td class="lblForm">
                    <div align="left">
                      <?=$row['de']?>
                  </div></td>
                  <td class="lblForm"><div align="left">
                      <?=$row['para']?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?
						  /* $rsh=$objPer->getCCostoxTransHoras($row['cod_ruta'],$row['origen'],$row['destino']);
						  $rowh=$objPer->NextRow($rsh); */
						  echo $row['har'];
						  ?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?=substr($row['hs'],0,5);?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?=substr($row['hl'],0,5);?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?=substr($row['hap'],0,5);?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?
							echo substr($row['tvhm'],0,5);
							if($row['programado']=='S'){
							$horav=$horav+$row['tvcomh'];
							$minutov=$minutov+$row['tvcomm'];
							}
							?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?
							echo substr($row['tvthm'],0,5);
							if($row['programado']=='S'){
							$horatec=$horatec+$row['tvtech'];
							$minutotec=$minutotec+$row['tvtecm'];
							}
							?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?
						  if($row['de']!='' && $row['combus']!=0){ echo $row['de'];}
						  ?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?=$tcombus=$row['combus']; $totalcombus=$totalcombus+$tcombus;?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                    <?
					$rsper=$objPer->getTransTipoBitaPer($row['cod_ruta'],$row['numorigen'],$row['numdestino']);
					$rowper=$objPer->NextRow($rsper);
					echo $tnumper=$rowper['numpax'];					
					$totalnumper=$totalnumper+$tnumper;
					?>
                  </div></td>
                  <td class="lblForm"><div align="center"><? echo $pesopasajero=$rowper['kgpax']; $tpesopass=$tpesopass+$pesopasajero;?></div></td>
                  <td>
                    <div align="center">
                      <?
					$rscar=$objPer->getTransTipoBitaCar($row['cod_ruta'],$row['numorigen'],$row['numdestino']);
					$rowcar=$objPer->NextRow($rscar);
					echo $pesocarga=$rowcar['kgcarga'];
					$tpesocarga=$tpesocarga+$pesocarga; 
					?>
                    </div></td>
                  <td><div align="center">
                    <?							  
							  echo $pesototal=$pesocarga+$pesopasajero;
							  $pesototaltrans=$pesototaltrans+$pesototal;
							  ?>
                  </div></td>
                  <td>
                    <div align="center">
                      <?=$row['obser'];?>
                  </div></td>
                  <td><div align="center">
                      <?=$row['programado'];?>
                  </div></td>
                </tr>
                <? 
			}
			$objPer->Liberar($rs); 
			
			?>
                <tr valign="top" class="lblForm" >
                  <td colspan="7" class="lblForm"><div align="center">TOTALES --&gt; </div></td>
                  <td class="lblForm"><div align="center">
                      <?
						  echo nimutotohora($horav,$minutov);
						  ?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?
						  echo nimutotohora($horatec,$minutotec);
						  ?>
                  </div></td>
                  <td class="lblForm"><div align="center"></div></td>
                  <td class="lblForm"><div align="center">
                      <?=$totalcombus?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?=$totalnumper?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?=$tpesopass?>
                  </div></td>
                  <td class="lblForm"><div align="center">
                      <?=$tpesocarga?>
                  </div></td>
                  <td><div align="center">
                      <?=$pesototaltrans;?>
                  </div></td>
                  <td>&nbsp; </td>
                  <td>&nbsp;</td>
                </tr>
              </table>
            </div></td>
          </tr>
        </table>
    </div></td>
  </tr>
  <tr class="lblCampo">
    <td colspan="2">&nbsp;</td>
  </tr>
</table>
<form action="ficheroExcel.php" method="post" target="_blank" id="FormularioExportacion">
<p>Exportar a Excel  <img src="imagen/export_to_excel.gif" class="botonExcel" /></p>
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</form>
<map name="MapMapMap">
  <area shape="rect" coords="2,5,22,21" href="fondo.php">
</map>
</body>

</html>

