<?php
	include("stilos/config.inc.php");
	include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  
  include("Funciones.php");
  include("funcion/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">
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<script type="text/javascript" src="js/ajaxtrans.js"></script>
<script type="text/javascript" src="ajax_listaviaje.js"></script>
<script language="JavaScript"> 
function PrintManifiesto(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=yes"
			var ventana = window.open(sURL,"Manifieto",par)
			ventana.focus();
}
</script>
<script language="JavaScript"> 
function PrintPlanViaje(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=yes"
			var ventana = window.open(sURL,"PlanViaje",par)
			ventana.focus();
}
</script>
<script language="JavaScript"> 
function print_plan(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,"plan",par)
			ventana.focus();
} 
</script>
<script>
function saludo(){
alert('holas');
}
</script>
</head>
<body bgcolor="<?=$c_fondo['fondo']?>">
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr valign="top" >
    <td height="25" colspan="4">
    <div align="left" ></div></td>
  </tr>
  <tr class="lblCampo" >
    <td colspan="4"><div align="center">
        <table width="899" 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="849" background="../estilo_tabla/parte_sup_cen.gif" valign="bottom">
			<div align="left" class="lblTitulo" >Buscar Plan </div>			</td>
            <td width="25"><img src="../estilo_tabla/parte_sup_der.gif" width="25" height="25" border="0" usemap="#Map"></td>
          </tr>
          <tr>
            <td width="25" background="../estilo_tabla/parte_med_izq.gif">&nbsp;</td>
            <td width="849" height="86" background="../estilo_tabla/parte_med_cen.gif"><div align="center">
              
                <table width="845" border="0" cellspacing="0" cellpadding="0">
				
                  <tr>
                    <td height="15"><div align="center"><span class="lblForm"> </span></div></td>
                  </tr>
                  <tr>
                    <td height="15">
                      <div align="center" class="lblForm">
                        <form name="form1" method="post" action="">
                          <table width="674" border="0" align="left" cellpadding="0" cellspacing="0">
                            <tr>
                              <td><div align="center">Via</div></td>
                              <td><div align="center"></div></td>
                              <td><div align="center">Fecha Inicial </div></td>
                              <td><div align="center">Fecha Final</div></td>
                              <td>&nbsp;</td>
                            </tr>
                            <tr>
                              <td width="78"><div align="center">
                                  <select name="via" id="via">
                                    <option value="0">Elija</option>
                                    <option value="A" <? if($via=='A'){?> selected <? }?>>Aerea</option>
                                    <option value="F" <? if($via=='F'){?> selected <? }?>>Fluvial</option>
                                  </select>
                              </div></td>
                              <td width="50"><div id="transporte" align="left"></div></td>
                              <td width="175"><div align="center">
                                  <table width="134" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td width="67"><div align="left">
                                          <input name="fecha_ini" type="text" id="fecha_ini" onKeyUp=fn(this.form,this) value="<?=$fecha_ini?>" 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.fecha_ini');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                                    </tr>
                                  </table>
                              </div></td>
                              <td width="169"><div align="center">
                                  <table width="134" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td width="67"><div align="left">
                                          <input name="fecha_fin" type="text" onKeyUp=fn(this.form,this) value="<?=$fecha_fin?>" 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.fecha_fin');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                                    </tr>
                                  </table>
                              </div></td>
                              <td width="202"><div align="right">
                                  <input type="submit" name="Submit" value="Buscar" style="<?=$stylo['st2']?>" class="botira">
                              </div></td>
                            </tr>
                          </table>
                                                </form>
                      </div></td>
                  </tr>
				  <? 
  
					  if($fecha_ini!=''){ 
				    				
														
					$resultado=$objPer->getListaPlan($via,extraerfechamysql($fecha_ini),extraerfechamysql($fecha_fin));				
				   
                  while($filas=$objPer->NextRow($resultado))
                   {
				   
				   ?>
                  <tr>
                    <td><div align="center" id="lista1">
					
                      
                      <table width="849" border="1" align="left" cellpadding="0" cellspacing="0" bordercolor="<?=$bordetabla?>" bgcolor="<?=$c_fondo['fondo tabla']?>" style="<?=$stylo['tabla']?>">
                        <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                          <td width="157"><div align="center">AERONAVE</div></td>
                          <td width="144"><div align="center">RUTA</div></td>
                          <td width="37"><div align="center">N&ordm; PAX </div></td>
                          <td width="30"><div align="center">PESO KG </div></td>
                          <td width="253"><div align="center">Descripcion </div></td>
                          <td width="70"><div align="center">CODIGO RUTA </div></td>
                          <td width="70"><div align="center">FECHA SALIDA </div></td>
                          <td width="70"><div align="center">FECHA LLEGADA</div></td>
                        </tr>
                        <tr valign="top" class="lblForm" >
                          <td class="lblForm"><div align="center"> <? echo $filas['mat_trans']."-".$filas['model_trans']; ?> </div></td>
                          <td class="lblForm"><div align="center"></div></td>
                          <td class="lblForm"><div align="center"></div></td>
                          <td class="lblForm"><div align="center"></div></td>
                          <td class="lblForm"><div align="left"></div></td>
                          <td class="lblForm"><div align="center"></div></td>
                          <td class="lblForm"><div align="center"></div></td>
                          <td class="lblForm"><div align="center"></div></td>
                        </tr>
						<?
						$rs=$objPer->getListaPlanRuta($filas['mat_trans'],extraerfechamysql($fecha_ini),extraerfechamysql($fecha_fin));
				   		while($row=$objPer->NextRow($rs)){
						
						?>
                        <tr valign="top" class="lblForm" >
                          <td class="lblForm">&nbsp;</td>
                          <td class="lblForm"><div align="left">
                            <?
							$rs1=$objPer->getListaPlanRuta1($row['cod_ruta']);
				   			while($row1=$objPer->NextRow($rs1)){
						  echo $row1['de'].",".$row1['para']."<br>";
						  }
						  ?>
                          </div></td>
                          <td class="lblForm"><div align="center">
						  <?
						  $rs2=$objPer->getListaPlanRutaPax($row['cod_ruta']);
						  $row2=$objPer->NextRow($rs2);
						  echo $row2['numpax'];
						  ?>
						  </div></td>
                          <td class="lblForm"><div align="center"><?=$row2['pesocarga'];?></div></td>
                          <td class="lblForm"><div align="left">
						  <?
						  
							$rs3=$objPer->getListaPlanRuta2($row['cod_ruta']);
				   			while($row3=$objPer->NextRow($rs3)){
						  echo $row3['obser']."<br>";
						  }
						  
						  ?>
						  </div></td>
                          <td class="lblForm"><div align="center"><?=$row['cod_ruta']?></div></td>
                          <td class="lblForm"><div align="center">
                            <?=extraerfechanormal($row['fechasalida'])?>
                          </div></td>
                          <td class="lblForm"><div align="center">
                            <?=extraerfechanormal($row['fechallegada'])?>
                          </div></td>
                        </tr>
						<?
						}$objPer->Liberar($rs);
						?>
                        <tr valign="top" class="lblForm" >
                          <td colspan="8" class="lblForm"><div align="left"></div></td>
                        </tr>
                      </table>
                      
                    </div></td>
                  </tr>
				  <? 
			}
			$objPer->Liberar($resultado); 
			}  
			?>
                  <tr>
                    <td><div align="left"></div></td>
                  </tr>
                  <tr>
                    <td><div align="center"> 
					<a href="#" onClick="print_plan('p_print_plan.php?fecha_ini=<?=$fecha_ini?>&fecha_fin=<?=$fecha_fin?>&matricula=<?=$matricula?>&via=<?=$via?>',800,600)">
  Imprimir Plan<?=$via?>
  <img src="../imagenes/imprimir.gif" alt="Imprimir Manifiesto" width="15" height="15" border="0">
  </a>
					</div></td>
                  </tr>
				 
				  <tr>
                    <td><div align="center">
                      
                    </div></td>
                  </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>
    </div></td>
  </tr>
  <tr valign="top" class="lblCampo" >
    <td colspan="4">
      <div align="center"> </div></td>
  </tr>
</table>

<map name="Map">
  <area shape="rect" coords="2,5,22,21" href="fondo.php">
</map>
</body>

</html>

