<?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; 
  /* $rsc=$objPer->getManDatos($cod_man,$via);
  $row=$objPer->NextRow($rsc); */
  
  $rsc=$objPer->getRutasTrans($cod_ruta);
  $rowc=$objPer->NextRow($rsc);

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>.:: Plan de Vuelo ::.</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">
</head>
<body onLoad="print();">
<table width="790" border="0" cellspacing="0" cellpadding="0">
  <tr class="lblTituloReporte">
    <td>&nbsp;</td>
  </tr>
  <tr class="lblTituloReporte">
    <td><div align="left">
      <table width="728" border="0" cellpadding="0" cellspacing="0">
        <tr class="lblCampo" valign="top">
          <td width="193" valign="top">&nbsp;</td>
          <td width="325" valign="bottom"><div align="center" class="lblParrafo">          </div></td>
          <td width="210"><div align="right"><img src="../imagenes/logo_perenco.GIF" width="180" height="70" border="0"></div></td>
        </tr>
      </table>
    </div></td>
  </tr>
  <tr class="lblTituloReporte">
    <td><div align="center">Plan de Viaje N&ordm; <?=substr($cod_ruta,1,5)?>
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="110">&nbsp;</td>
          <td width="590">&nbsp;</td>
        </tr>
        <tr class="lblTituloReporte">
          <td><div align="left">Fecha</div></td>
          <td><div align="left"><?=extraerfechanormal($rowc['fecha_ruta']);?></div></td>
        </tr>
        <tr class="lblTituloReporte">
          <td><div align="left">Transporte</div></td>
          <td><div align="left"><?=$rowc['model_trans']."-".$rowc['mat_trans'];?></div></td>
        </tr>
        <tr class="lblTituloReporte">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr class="lblTituloReporte">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </div></td>
  </tr>
  <tr class="lblCampo">
    <td><div align="center"></div></td>
  </tr>
  <tr>
    <td><div align="center">
      <table width="703" border="0" cellspacing="0" cellpadding="0">
        <tr class="lblCampo">
          <td width="703"><div align="center">
            <table width="700" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="300" valign="bottom">
                    <div align="center" class="lblTituloReporte">SUBEN</div></td><td width="100" valign="top"><div align="center">
                    </div></td>
                <td width="300"><div align="center" class="lblTituloReporte">BAJAN</div></td>
              </tr>
              <tr>
                <td colspan="3" valign="bottom"><div align="center"><hr align="left" size="1" color="#000000"></div></td>
                </tr>
              
              <tr >
                <td valign="top"><div align="left">
                  <table width="298" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><div align="left">
                        <table width="298" border="1" cellpadding="0" cellspacing="0" bordercolor="<?=$bordetabla?>" bgcolor="<?=$c_fondo['fondo tabla']?>" style="<?=$stylo['tabla']?>">
						<tr>
                            <td><div align="center">Personal</div></td>
                            <td><div align="center">Emp</div></td>
                            <td><div align="center">Destino</div></td>
                          </tr>
                          <?
				$n1=0;
			  $rspi=$objPer->getManPassO($cod_man,$via,1);
			  while($rowpi=$objPer->NextRow($rspi)){
			  $n1++;
			  ?>
                          <tr>
                            <td width="189"><div align="left">
                                <?=$n1." ".$rowpi['nombres'];?>
                            </div></td>
                            <td width="54"><div align="center">
                              <?=$rowpi['razon_emp'];?>
                            </div></td>
                            <td width="47"><div align="left">
                                <?
					echo $rowpi['numdestino'];
					$pesoper=$pesoper+$rowpi['peso_mpass'];
					?>
                            </div></td>
                          </tr>
                          <?
			  }$objPer->Liberar($rspi);
			  ?>
                        </table>
                      </div></td>
                    </tr>
                    <tr>
                      <td><div align="left">
                        <table width="298" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                          <?
				$nc1=0;
			  $rsci=$objPer->getCargaO($cod_man,$via,1);
			  while($rowci=$objPer->NextRow($rsci)){
			  $nc1++;
			  ?>
                          <tr>
                            <td width="189"><div align="left">
                                <?=$nc1." ".$rowci['des_w'];?>
                            </div></td>
                            <td width="54"><div align="center">
                              <?=$rowci['compania'];?>
                            </div></td>
                            <td width="47"><div align="left">
                                <?
				  echo $rowci['numdestino'];
				 $pesocarga=$pesocarga+$rowci['peso_w'];
				  ?>
                            </div></td>
                          </tr>
                          <?
			  }$objPer->Liberar($rsci);
			  ?>
                        </table>
                      </div></td>
                    </tr>
                  </table>
                  </div></td>
                <td width="100" valign="middle"><div align="center">
                  <table width="49" border="1" cellspacing="0" cellpadding="0">
                    <?
				$rsri=$objPer->getRutaIni($cod_ruta);
				$rowri=$objPer->NextRow($rsri);
				?>
                    <tr>
                      <td width="45"><div align="center">
                          <?
					echo $rowri['de']."<br>";
					echo "Salida ".$rowri['hs']."<br>";					
					echo ($pesoper+$pesocarga)." Kg";
					?>
                      </div></td>
                    </tr>
                  </table>
                </div></td>
                <td><div align="left"></div></td>
              </tr>
              <tr valign="top">
                <td>&nbsp;</td>
                <td valign="top"><div align="center"><img src="../imagenes/flecha_abajo.jpg" width="20" height="20"></div></td>
                <td>&nbsp;</td>
              </tr>
              
            </table>
          </div></td>
          </tr>
        <tr class="lblCampo">
          <td><div align="center">
              <table width="700" border="0" cellspacing="0" cellpadding="0">
			  <tr>
                    <td colspan="3" valign="bottom"><div align="center">
					<hr align="left" size="1" color="#000000">
                    </div></td>
                  </tr>
                <?
				$pesototaltrans=0;
		$rsrutas=$objPer->getRutasDifIni01($cod_ruta);	
		while($rowr=$objPer->NextRow($rsrutas)){
		?>
                
                
                <tr>
                  <td width="300" valign="bottom"><div align="left">
                    </div></td>
                  <td width="100" valign="bottom"><div align="center">
                    </div></td>
                  <td width="300" valign="bottom"><div align="left">
                    </div></td>
                </tr>
                
                <tr>
                  <td valign="top"><div align="left">
                    <table width="298" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td><div align="left">
                          <table width="298" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
						  <tr>
                              <td><div align="center">Personal</div></td>
                              <td><div align="center">Emp</div></td>
                              <td><div align="center">Destino</div></td>
                            </tr>
                            <?
						$n2=0;
						$pesoper1=0;
			  $rsps=$objPer->getManPassO12($cod_man,$via);
			  while($rowps=$objPer->NextRow($rsps)){
			 
			  if(($rowr['numdestino']+1)==$rowps['numorigen']){
			   $n2++;		  
			  ?>
                            <tr>
                              <td width="189"><div align="left">
                                  <?=$n2." ".$rowps['nombres'];
								  $docu=$rowps['dociden_per'];?>
                              </div></td>
                              <td width="54"><div align="center">
                                <?=$rowps['razon_emp'];?>
                              </div></td>
                              <td width="47">
                                <?
						echo $rowps['numdestino'];
						$pesoper1=$pesoper1+$rowps['peso_mpass'];
						?>
                              </td>
                            </tr>
			  <?						
							}else{
							echo $docu='';							
							}
			  }$objPer->Liberar($rsps);
			  ?>
                          </table>
                        </div></td>
                      </tr>
                      <tr>
                        <td><div align="left">
                          <table width="298" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
						  
                            <?
						$nc2=0;
						$pesocarga1=0;
						
			  $rscs=$objPer->getCargaO1($cod_man,$via);
			  while($rowcs=$objPer->NextRow($rscs)){
			  if(($rowr['numdestino']+1)==$rowcs['numorigen']){
			  $nc2++;				  	   		  
			  ?>
                            
                            <tr>
                              <td width="189"><div align="left">
                                  <?
								  echo $nc2." ".$rowcs['des_w'];								 
								  $compania=$rowcs['compania'];
								  $guia_w=$rowcs['guia_w'];								  
								  ?>
                              </div></td>
                              <td width="54"><div align="center">
                                <?=$rowcs['compania'];?>
                              </div></td>
                              <td width="47">
                                <?
						echo $rowcs['numdestino'];
						$pesocarga1=$pesocarga1+$rowcs['peso_w'];
						
						?>
                              </td>
                            </tr>
                            <?
							}else{
							echo $compania='';	
							$guia_w='';						
							}			
			  }$objPer->Liberar($rscs);
			  
			  
			  ?>
                          </table>
                        </div></td>
                      </tr>
                    </table>
                    </div></td>
                  <td width="100" valign="middle"><div align="center">
                    <table width="49" border="1" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="45"><div align="center">
                            <?
							$rsodh=$objPer->getRutasOriDesH($cod_ruta,$rowr['numdestino']+1,$rowr['numdestino']+1);
							$rowodh=$objPer->NextRow($rsodh);
							  echo $rowr['para']."<br>";
							  echo "llegada ".$rowr['hl']."<br>";
							  echo "Salida ".$rowodh['hs']."<br>";
							  echo $pesototaltrans=($pesoper1+$pesocarga1)." Kg";
							  ?>
                        </div></td>
                      </tr>
                    </table>
                  </div></td>
                  <td valign="top"><div align="left">
                    <table width="298" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td><div align="left">
                          <table width="298" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
						  <tr>
                              <td><div align="center">Personal</div></td>
                              <td><div align="center">Emp</div></td>
                              <td><div align="center">Procedencia</div></td>
                            </tr>
                            <?
						$n3=0;
						
			  $rspb=$objPer->getManPassD12($cod_man,$via,$rowr['numdestino']);
			  while($rowpb=$objPer->NextRow($rspb)){
			  $n3++;
			  
			  $rspb1=$objPer->getManPassD13($cod_man,$via,$rowpb['dociden_per'],$rowr['numdestino']);			 
			  while($rowpb1=$objPer->NextRow($rspb1)){
			  
			  if($rowr['numdestino']==$rowpb1['numdestino']){
			  ?>
                            <tr>
                              <td width="189"><div align="left">
                                  <?=$n3." ".$rowpb1['nombres'];
								  ?>
                              </div></td>
                              <td width="54"><div align="center">
                                <?=$rowpb1['razon_emp'];?>
                              </div></td>
                              <td width="47"><div align="left">
                                  <?=$rowpb1['numorigen']?>
                              </div></td>
                            </tr>
                            <?
							}
							}$objPer->Liberar($rspb1);
			  }$objPer->Liberar($rspb);
			  ?>
                          </table>
                        </div></td>
                      </tr>
                      <tr>
                        <td><div align="left">
                          <table width="298" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                            <?
						$nc3=0;
			  $rscb=$objPer->getCargaD1($cod_man,$via,$rowr['numdestino']);
			  while($rowcb=$objPer->NextRow($rscb)){
			  $nc3++;
			  $rscb1=$objPer->getCargaD12($cod_man,$via,$rowcb['guia_w'],$rowcb['compania'],$rowr['numdestino']);
			  while($rowcb1=$objPer->NextRow($rscb1)){
			  if($rowr['numdestino']==$rowcb1['numdestino']){
			  ?>
                            <tr>
                              <td width="189"><div align="left">
                                  <?=$nc3." ".$rowcb['des_w'];?>
                              </div></td>
                              <td width="54"><div align="center">
                                <?=$rowcb['compania'];?>
                              </div></td>
                              <td width="47"><div align="left">
                                  <?=$rowcb['numorigen']?>
                              </div></td>
                            </tr>
                            <?
							}
							}$objPer->Liberar($rscb1);
			  }$objPer->Liberar($rscb);
			  ?>
                          </table>
                        </div></td>
                      </tr>
                    </table>
                    </div></td>
                </tr>
                <tr>
                  <td valign="top"><div align="left">
                    </div></td>
                  <td valign="top"><div align="center"><img src="../imagenes/flecha_abajo.jpg" width="20" height="20"></div></td>
                  <td valign="top">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="3" valign="top"><div align="center"><hr align="left" size="1" color="#000000"></div></td>
                  </tr>
                
                <? }$objPer->Liberar($rsrutas); ?>
              </table>
          </div></td>
        </tr>
        <tr class="lblCampo">
          <td><div align="center">
            </div></td>
        </tr>
      </table>
    </div></td>
  </tr>
  <tr valign="bottom">
    <td height="100"><div align="center">
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="281">&nbsp;</td>
          <td width="138">&nbsp;</td>
          <td width="281">&nbsp;</td>
        </tr>
        <tr>
          <td><div align="center"><hr align="left" size="1" color="#000000"></div></td>
          <td>&nbsp;</td>
          <td><div align="center"><hr align="left" size="1" color="#000000"></div></td>
        </tr>
        <tr>
          <td><div align="center">Representante por PERENCO </div></td>
          <td>&nbsp;</td>
          <td><div align="center">Responsable de Transporte </div></td>
        </tr>
      </table>
    </div></td>
  </tr>
</table>
<map name="MapMap">
  <area shape="rect" coords="3,4,23,21" href="fondo.php">
</map>
</body>
</html>

