<?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;
  
?>
<!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 language="JavaScript"> 
<!--
function print_1(sURL,x,y) {
if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=yes,"
			par = par + "menubar=no,toolbar=no,status=no"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
}
//--> 
</script>
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<script language="javascript" type="text/javascript">
  function volver(){
     window.location="fondo.php";
                   }
</script>
</head>

<body background="../imagenes/fondo.jpg">
<table width="1100" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><div align="center">
      <table width="1080" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="25"><img src="../estilo_tabla/parte_sup_izq.gif" width="25" height="25"></td>
          <td width="1030" background="../estilo_tabla/parte_sup_cen.gif" valign="bottom">
            <div align="left" class="lblTitulo" >Controles de Vuelos y Costos Op. </div></td>
          <td width="25"><img src="../estilo_tabla/parte_sup_der.gif" width="25" height="25" border="0" usemap="#MapMapMap"></td>
        </tr>
        <tr>
          <td width="25" background="../estilo_tabla/parte_med_izq.gif">&nbsp;</td>
          <td width="1030" height="86" background="../estilo_tabla/parte_med_cen.gif"><div align="center">
              <table width="1020" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="15"><div align="center"></div></td>
                </tr>
                <tr>
                  <form action="p_control_vuelos.php" method="post" name="form1">
                    <td height="15">
                      <div align="left" class="lblForm">
                        <table width="990" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td>&nbsp;</td>
                            <td><div align="center">Centro Costo </div></td>
                            <td>&nbsp;</td>
                            <td><div align="center">Transporte</div></td>
                            <td>&nbsp;</td>
                            <td>Fechas</td>
                            <td>&nbsp;</td>
                          </tr>
                          <tr valign="top">
                            <td width="19"><div align="right"></div></td>
                            <td width="401"><div align="left">
                                <select name="centrocosto" size="5" multiple id="select2" onkeyup=fn(this.form,this)>
                                  <option value="0" <? if($centrocosto=="0"){?> selected <? }?>>....:Seleccione:....</option>
                                  <?=$objPer->getCboCCostoV($centrocosto);?>
                                </select>
                            </div></td>
                            <td width="23"><div align="right"></div></td>
                            <td width="230"><div align="left">
                              <select name="mat_trans" id="select" onkeyup=fn(this.form,this)>
                                <option value="0" <? if($mat_trans=="0"){?> selected <? }?>>Todos</option>
                                <?=$objPer->getCboTransPerCar($mat_trans);?>
                              </select>
                            </div></td>
                            <td width="22"><div align="right"></div></td>
                            <td width="218"><div align="left">
                              <table width="197" height="19" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td width="108"><div align="left">
                                      <table width="87" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td width="67"><div align="left">
                                              <input name="fecha1" type="text" class="lblCampo" id="fecha15" value="<? echo $fecha1?>" size="12" maxlength="10" title="FORMATO dd/mm/AA">
                                          </div></td>
                                          <td width="10">&nbsp;</td>
                                          <td width="109"><div align="left"> <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fecha1');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                                        </tr>
                                      </table>
                                  </div></td>
                                  <td width="144"><div align="left">
                                      <table width="87" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td width="67"><div align="left">
                                              <input name="fecha2" type="text" class="lblCampo" id="fecha25" value="<? echo $fecha2?>" size="12" maxlength="10" title="FORMATO dd/mm/AA">
                                          </div></td>
                                          <td width="10">&nbsp;</td>
                                          <td width="109"><div align="left"> <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fecha2');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0" > </a> </div></td>
                                        </tr>
                                      </table>
                                  </div></td>
                                </tr>
                              </table>
                                </div></td>
                            <td width="77"><div align="left">
                                <input type="submit" name="Submit" value="Buscar" style="<?=$stylo['st2']?>" class="botira">
                            </div></td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                            <td><div align="left">
                            </div></td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                          </tr>
                        </table>
                    </div></td>
                  </form>
                </tr>
                <tr>
                  <td><div align="left">
                      <table width="1018" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
					  <?
					  
					  if($mat_trans=='0'){$resultado=$objPer->getCCTotal($centrocosto,extraerfechamysql($fecha1),extraerfechamysql($fecha2));					
					  }else{$resultado=$objPer->getCCxTrans($centrocosto,$mat_trans,extraerfechamysql($fecha1),extraerfechamysql($fecha2));}
                      while($filas=$objPer->NextRow($resultado)){
					  
					  ?>
                        <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                          <td colspan="11"><div align="left"><?=$filas['mat_trans']?></div></td>
                          <td colspan="2">&nbsp;</td>
                          <td colspan="5">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                          <td>&nbsp;</td>
                          <td width="53">&nbsp;</td>
                          <td colspan="2"><div align="center">Ruta</div></td>
                          <td>&nbsp;</td>
                          <td>Arranca</td>
                          <td colspan="2"><div align="center">TVC</div></td>
                          <td width="44">Apaga</td>
                          <td width="34">TVC</td>
                          <td width="34">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>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                          <td width="17" rowspan="2"><div align="center">N&ordm;</div></td>
                          <td rowspan="2"><div align="center">Fecha</div></td>
                          <td width="44" rowspan="2">Origen</td>
                          <td width="46" rowspan="2">Destino</td>
                          <td width="41" rowspan="2">Piloto</td>
                          <td width="39" rowspan="2">Hora / Minuto</td>
                          <td width="59">Decola</td>
                          <td width="37">Aterri.</td>
                          <td rowspan="2">Hora / Minuto</td>
                          <td rowspan="2">Hora / Minuto</td>
                          <td rowspan="2">Hora / Minuto</td>
                          <td width="42" rowspan="2"><div align="center">Lugar</div></td>
                          <td width="42" rowspan="2"><div align="center">Glns</div></td>
                          <td width="40" rowspan="2"><div align="center">N&ordm; Pax</div></td>
                          <td width="46" rowspan="2"><div align="center">Pax Kg </div></td>
                          <td width="51" rowspan="2"><div align="center">Carga Kg </div></td>
                          <td width="50" rowspan="2"><div align="center">Total Kg</div></td>
                          <td width="51" rowspan="2"><div align="center">Costo</div></td>
                          <td width="166" rowspan="2"><div align="center">Obser.</div></td>
                          <td width="40" 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="37">Hora / Minuto</td>
                        </tr>
                        <?
					$horat=0;
					$horatec=0;
				    $totalnumper=0;
					$tpesopass=0;
					$tpesocarga=0;
					$pesototaltrans=0;
					$totalcombus=0;
					$n=0;
					$rs=$objPer->getCCostoxTransTipo($centrocosto,$filas['mat_trans'],extraerfechamysql($fecha1),extraerfechamysql($fecha2));				
					
                  while($row=$objPer->NextRow($rs))
                   {
				   
				   
				   /*$rstime=$objPer->getTimeViaje($filas['fecha_man'],$matricula); */
				   ?>
                        <tr valign="top" class="lblForm" >
                          <td class="lblForm">
                            <div align="center"> <? echo ++$n; ?> </div></td>
                          <td class="lblForm"><div align="center"><?=substr(extraerfechanormal($row['fecha_mpass']),0,5);?>
                          </div>                              </td>
                          <td class="lblForm">                              <div align="left">
                            <?=$row['origen']?>
                          </div></td>
                          <td class="lblForm"><div align="left">
                            <?=$row['destino']?>
                          </div></td>
						  
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm"><div align="center">
						  <?
						  $rsh=$objPer->getCCostoxTransHoras($row['cod_ruta'],$row['origen'],$row['destino']);
						  $rowh=$objPer->NextRow($rsh);
						  echo $rowh['har'];
						  ?>
						  </div></td>
                          <td class="lblForm"><div align="center"><?=$rowh['hs'];?></div></td>
                          <td class="lblForm"><div align="center">
                            <?=$rowh['hl'];?>
                          </div></td>
                          <td class="lblForm"><div align="center">
                            <?=$rowh['hap'];?>
                          </div></td>
                          <td class="lblForm"><div align="center">
                            <?
							echo calcular_horas_formato_inversa1($rowh['tvcom']);
							$horat=$horat+$rowh['tvcom'];
							?>
                          </div></td>
                          <td class="lblForm"><div align="center">
                            <?
							echo calcular_horas_formato_inversa1($rowh['tvtec']);
							$horatec=$horatec+$rowh['tvtec'];
							?>
                          </div></td>
                          <td class="lblForm"><div align="center">
						  <?
						  if($rowh['factu']=='SI'){ echo $row['origen'];}
						  ?>
                          </div></td>
                          <td class="lblForm"><div align="center">
                            <?=$tcombus=$rowh['combus']; $totalcombus=$totalcombus+$tcombus;?>
                          </div></td>
                          <td class="lblForm"><div align="center">
                            <?
					/* $rspaxviaje=$objPer->getListaNumPaxViaje($filas['fecha_man'],$matricula);
					$rowpaxviaje=$objPer->NextRow($rspaxviaje);
					echo $rowpaxviaje['numpax'];
					$tnumpax=$tnumpax+$rowpaxviaje['numpax']; */
					?>
                            <?=$tnumper=$row['numpax']; $totalnumper=$totalnumper+$tnumper;?>
                          </div></td>
                          <td class="lblForm"><div align="center">
                            <?=$pesopasajero=$row['pesoper']; $tpesopass=$tpesopass+$pesopasajero;?>
</div></td>
                          <td>
                            <div align="center">
                              <?
					/* $rscargaviaje=$objPer->getCargaViaje($filas['fecha_man'],$matricula);
					$rowcargaviaje=$objPer->NextRow($rscargaviaje);
					echo $rowcargaviaje['carga_int'];
					$tcarga_int=$tcarga_int+$rowcargaviaje['carga_int']; */
					?>
                              <?
							  if($row['pesocar']!=''){ $pesocarga=$row['pesocar']; }else{ $pesocarga=0;}
							  echo $pesocarga;
							  $tpesocarga=$tpesocarga+$pesocarga;
							  ?>
</div></td>
                          <td><div align="center">
                            <?php 
				 /*  while($rowtime=$objPer->NextRow($rstime)){		
				  
				  	$rstime=$objPer->getTimeViaje1($rowtime['cod_ruta']);			
					$rowtime1=$objPer->NextRow($rstime);
						if($filas['fecha_man']==$rowtime1['fecha_ruta']){
					
					$thp=calcular_tiempo_trasnc($rowtime['hora_apag'],$rowtime['hora_arra']);	
					echo dif($rowtime['hora_apag'],$rowtime['hora_arra']);				
					
					}
				}	$objPer->Liberar($rstime);
					$th=$th+$thp;  */
					
					?>
                            <?							  
							  echo $pesototal=$pesocarga+$pesopasajero;
							  $pesototaltrans=$pesototaltrans+$pesototal;
							  ?>
</div></td>
                          <td><div align="center">
						  <?=$rowh['tvcom']*$row['tarifah']."/".$rowh['tvtec']*$row['tarifah'];?>
                          </div></td>
                          <td><div align="center">
                            <?=$rowh['obser'];?>
                          </div></td>
                          <td><div align="center">
                          </div></td>
                        </tr>
                        <? 
			}
			$objPer->Liberar($rs); 
			
			?>
                        
                        <tr valign="top" class="lblForm" >
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm"><div align="center">
						  <?
						  echo calcular_horas_formato_inversa1($horat);
						  ?>
						  </div></td>
                          <td class="lblForm"><div align="center">
                            <?
						  echo calcular_horas_formato_inversa1($horatec);
						  ?>
                          </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><div align="center">
                          </div></td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                       <? }$objPer->Liberar($resultado);?> 
                      </table>
                  </div></td>
                </tr>
                <tr class="lblCampo">
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <form name="form2" method="post" action="p_reportitinerrario_aereo_print.php">
                    <td><div align="center">
                        <table width="450" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="104"><div align="right">
                                <input type="button" name="Submit2" value=".:Imprimir:." style="<?=$stylo['st2']?>" class="botira" onClick="javascript:print_1('p_report_controlvuelos_print.php?fecha1=<?=$fecha1?>&fecha2=<?=$fecha2?>&mat_trans=<?=$mat_trans?>&centrocosto=<?=$centrocosto?>',800,600)">
                            </div></td>
                            <td width="93">&nbsp; </td>
                            <td width="104"><div align="left">
                                <input type="button" name="Submit2" value=".:    Salir    :." style="<?=$stylo['st2']?>" class="botira" onClick="volver();">
                            </div></td>
                          </tr>
                        </table>
                    </div></td>
                  </form>
                </tr>
              </table>
          </div></td>
          <td background="../estilo_tabla/parte_med_der.gif">&nbsp;</td>
        </tr>
        <tr>
          <td><img src="../estilo_tabla/parte_inf_izq.gif" width="25" height="25"></td>
          <td background="../estilo_tabla/parte_inf_cen.gif">&nbsp;</td>
          <td><img src="../estilo_tabla/parte_inf_der.gif" width="25" height="25"></td>
        </tr>
      </table>
      <map name="MapMapMap">
        <area shape="rect" coords="2,5,22,21" href="fondo.php">
      </map>
    </div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<map name="MapMap">
  <area shape="rect" coords="2,5,22,21" href="fondo.php">
</map>
<map name="Map">
  <area shape="rect" coords="2,5,22,21" href="fondo.php">
</map>
</body>

</html>

