<?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="800" 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="750" background="../estilo_tabla/parte_sup_cen.gif" valign="bottom">
      <div align="left" class="lblTitulo" >CONTROL HORAS DE VUELOS - RELATORIO</div></td>
    <td width="25"><img src="../estilo_tabla/parte_sup_der.gif" width="25" height="25" border="0" usemap="#MapMap"></td>
  </tr>
  <tr>
    <td width="25" background="../estilo_tabla/parte_med_izq.gif">&nbsp;</td>
    <td width="750" height="86" background="../estilo_tabla/parte_med_cen.gif"><div align="center">
        <table width="740" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="15"><div align="center"></div></td>
          </tr>
          <tr>
            <form action="cvp_costos_kamov.php?fecha1=<? echo $fecha1?>&fecha2=<? echo $fecha2?>&matricula=<? echo $matricula?>" method="post" name="form1">
              <td height="15">
                <div align="left" class="lblForm">
                  <table width="736" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="57"><div align="right">Tipo : </div></td>
                      <td width="203"><div align="left">
                          <select name="matricula" id="select2" onkeyup=fn(this.form,this)>
                            <option value="0" <? if($mat_trans=="0"){?> selected <? }?>>Ninguno</option>
                            <? 
						echo $objPer->getCboHeliTrans($matricula);
						?>
                          </select>
                      </div></td>
                      <td width="59"><div align="right">Fechas : </div></td>
                      <td width="198"><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="145">Monto:
                      <input name="monto" type="text" id="monto" value="<?=$monto?>" size="15"></td>
                      <td width="74"><div align="left">
                          <input type="submit" name="Submit" value="Buscar" style="<?=$stylo['st2']?>" class="botira">
                      </div></td>
                    </tr>
                  </table>
              </div></td>
            </form>
          </tr>
          <tr>
            <td><div align="center">
                <table width="707" 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"><div align="center">N&ordm;</div></td>
                    <td width="70"><div align="center">Origen</div></td>
                    <td width="65">
                      <div align="center">PS</div></td>
                    <td width="52"><div align="center">PB</div></td>
                    <td width="44"><div align="center">P/D</div></td>
                    <td><div align="center">T.V.C.</div></td>
                    <td width="72"><div align="center">% centro Costo </div></td>
                    <td width="68"><div align="center">$</div></td>
                    <td width="70"><div align="center">$/CC</div></td>
                    <td width="179"><div align="center">Centro de Costo </div></td>
                  </tr>
                  <?
					 if($monto!=""){ 
				    $regxpag=50;
					if(!isset($pagina)){
					$pagina=0;
					}					
					$regini=$pagina*$regxpag;
					if($matricula!='0'){
					$resultado=$objPer->getCCosto();				
					}
					//getListaHVHelixTipo(extraerfechamysql($fecha1),extraerfechamysql($fecha2),$matricula)
                  while($filas=$objPer->NextRow($resultado))
                   {
				   
				   $resultadocosto=$objPer->getListaHVHelixTipoCosto(extraerfechamysql($fecha1),extraerfechamysql($fecha2),$matricula,$filas['centrocosto']);
				   $n++;
				   ?>
                  <tr valign="top" class="lblForm" >
                    <td class="lblForm">
                      <div align="center"> <? echo $n; ?> </div></td>
                    <td class="lblForm"><div align="left"> </div>
                        <div align="center">
                          <?php 
					  if($filas['centrocosto']=='PP67F001-1-503' || $filas['centrocosto']=='PP67F001-1-202'){
					  echo 'Paiche';
					  }elseif($filas['centrocosto']=='PP67F001-2-503' || $filas['centrocosto']=='PP67F001-2-202'){
					  echo 'Dorado';
					  }elseif($filas['centrocosto']=='PP67F001-3-503' || $filas['centrocosto']=='PP67F001-3-202'){
					  echo 'Piraņa';
					  }
					  ?>
                        </div></td>
                    <td class="lblForm">
                      <div align="center">
                        <?php 
					 $th=0;
					 $pst=0;
					 $pbt=0;
					 $dista=0;
					 
				   		while($filacosto=$objPer->NextRow($resultadocosto)){
						
						$resultadocostos=$objPer->getListaHVHelixTipoCosto1($filacosto['cod_dch']); 
						$filacostos=$objPer->NextRow($resultadocostos);
					
						if($filas['centrocosto']==$filacostos['centrocosto']){
							
							$thp=calcular_tiempo_trasnc($filacostos['htierra_dch'],$filacostos['haire_dch']);							
							$th=$th+$thp;
							$hvt=$hvt+$thp;								
						}						  
					  }
					  $objPer->Liberar($resultadocosto);
					  
					  if($filas['centrocosto']){
							echo $pst;
							}
					?>
</div></td>
                    <td class="lblForm"><div align="center">
                      <?php 
					   if($filas['centrocosto']){
							echo $pbt."/".$dista;
							} 
					  ?>
					</div></td>
                    <td class="lblForm"><div align="center">
                      <?php 	
					  
					  		if($filas['centrocosto']){
							echo $tp_sbd;
							} 
					     
					?>
                    </div></td>					
                    <td width="48">
                      <div align="center">
                        <?php 	
					  
					  		if($filas['centrocosto']){
							echo $th;
							} 
					     
					?>
</div></td>

                    <td>
					  <div align="center">
					  <? 
					  if($filas['centrocosto']){
					  		if($_SESSION['totalhv']!=0){
							//echo $porcentaje=round((($th/$_SESSION['totalhv'])*100),2);
							echo $porcentaje=number_format(($th/$_SESSION['totalhv'])*100,3,'.',' ');
							//echo $porcentaje=number_format(($tp_sbd/$_SESSION['totalpassdistancia'])*100,3,'.',' ');
							}
							}					  
					  ?>
					  </div></td>
                    <td><div align="center"><?=$monto?></div></td>
                    <td><div align="center">
					<?
					//echo ($porcentaje/100)*$monto;
					echo number_format(($porcentaje/100)*$monto,3,'.',' ');
					$totalm=$totalm+($porcentaje/100)*$monto;
					?>
					</div></td>
                    <td><div align="center"><?php echo $filas['centrocosto']; ?></div></td>
                  </tr>
                  
                  <? 
			}
			$objPer->Liberar($resultado); 
			} 
			?>  
			    <tr valign="top" class="lblForm" >
                    <td class="lblForm"><div align="right"></div></td>
                    <td class="lblForm">&nbsp;</td>
                    <td class="lblForm">&nbsp;</td>
                    <td class="lblForm">&nbsp;</td>
                    <td class="lblForm"><div align="center"><? echo $_SESSION['totalpassdistancia']=$totp_sbd?></div></td>
                    <td class="lblForm"><div align="center">
					<? echo $_SESSION['totalhv']=$hvt?>
					</div></td>
                    <td><div align="center"></div></td>
                    <td>&nbsp;</td>
                    <td><div align="center">
					<? 
					//echo $totalm;
					echo number_format($totalm,3,'.',' ');
					?>
					</div></td>
                    <td>&nbsp;</td>
			    </tr>
			    <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"><div align="center">
				  <?
				  echo calcular_horas_formato_inversa1($_SESSION['totalhv']);
				  ?>
				  </div></td>
			      <td>&nbsp;</td>
			      <td>&nbsp;</td>
			      <td>&nbsp;</td>
			      <td>&nbsp;</td>
			      </tr>
                </table>
            </div></td>
          </tr>
          <tr class="lblCampo">
            <td>&nbsp;</td>
          </tr>
          <tr>
		  <form name="form2" method="post" action="cvp_chv_tipo_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('cvp_costo_chv_print.php?fecha1=<? echo $fecha1?>&fecha2=<? echo $fecha2?>&matricula=<? echo $matricula?>&monto=<?=$monto?>',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="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>

