<?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);
 //$cod_man;
 
 $rso=$objPer->getManObser($cod_ruta,$numorigen1,$numdestino1);
 $rowo=$objPer->NextRow($rso);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>.:: Reporte de Manifiestos ::.</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 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;}
.Estilo1 {font-weight: bold}
.Estilo2 {font-size: 12px; font-style: normal; line-height: 22px; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif;}
.Estilo3 {font-weight: bold}
</style>
</head>
<body onLoad="print();">
<table width="784" border="0" cellspacing="0" cellpadding="0" id="Exportar_a_Excel">
  <tr>
    <td></td>
    <td  valign="bottom">&nbsp;</td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td  valign="bottom"><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">MANIFIESTO DE TRANSPORTE <? if($via=='A'){ echo "AEREO";}elseif($via=='F'){ echo "FLUVIAL";}?></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>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td height="20"  valign="bottom"><div align="left"></div></td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td  valign="bottom"><div align="left">
      <table width="724" border="0" cellspacing="0" cellpadding="0">
        <tr class="lblCampo">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td colspan="2">&nbsp;</td>
          <td>&nbsp;</td>
          <td><div align="right">Manifiesto <span class="lblParrafo">N&ordm;<? echo $row['cod_man']?></span> </div></td>
        </tr>
        <tr class="lblCampo">
          <td width="95"><div align="left"><strong>TRANSPORTE</strong></div></td>
          <td width="150"><div align="left"><span class="lblCampo"><? echo $row['mat_trans']?>/<? echo $row['tipo_trans']?></span></div></td>
          <td width="96"><div align="right"><strong>FECHA SALIDA  </strong></div></td>
          <td width="9"><div align="left" class="lblParrafo"></div></td>
          <td width="76"><div align="left"><? echo extraerfechanormal($row['fecha_ruta']);?></div></td>
          <td width="100"><div align="right"><strong>FECHA LLEGADA </strong></div></td>
          <td width="8"><div align="left"></div></td>
          <td width="190"><div align="left"><? echo extraerfechanormal($row['testimado_ruta']);?></div></td>
        </tr>
        <tr class="lblCampo">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td><div align="right"></div></td>
          <td><div align="left">:</div></td>
          <td><div align="left"></div></td>
          <td><div align="right"></div></td>
          <td><div align="left">:</div></td>
          <td><div align="left"></div></td>
        </tr>
      </table>
    </div></td>
    <td></td>
  </tr>
  <tr>
    <td width="13"></td>
    <td width="728"  valign="bottom">
      <div align="left" class="lblTitulo" ></div></td>
    <td width="43"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td height="100" valign="top">
    <div align="left">
      <table width="721" border="1" cellspacing="0" cellpadding="0" style="<?=$stylo['tabla']?>" bordercolor="<?=$bordetabla1?>">
        <tr class="lblCampo" >
          <td width="24" rowspan="2"><div align="center" ><strong>#</strong></div></td>
          <td colspan="2"><div align="center"><strong>TRIPULANTE</strong></div></td>
          <td width="92" rowspan="2"><div align="center"><strong>COMPANIA</strong></div></td>
          <td width="82" rowspan="2"><div align="center"><strong>ORIGEN</strong></div></td>
          <td width="101" rowspan="2"><div align="center"><strong>DESTINO</strong></div></td>
          <td colspan="3"><div align="center"><strong>PESO EN KG </strong></div></td>
        </tr>
        <tr class="lblCampo">
          <td width="205"><div align="center"><strong>APELLIDOS Y NOMBRES </strong></div></td>
          <td width="81"><div align="center"><strong>DNI/DOC</strong></div></td>
          <td width="34"><div align="center"><strong>Tripulante</strong></div></td>
          <td width="38"><div align="center"><strong>Equipaje </strong></div></td>
          <td width="44"><div align="center"><strong>Subtotal</strong></div></td>
        </tr>
        <?
		  $n1=0;
		  $resultadot=$objPer->getTripuDatos($cod_man,$via);	
          while($filast=$objPer->NextRow($resultadot)){
		  $n1++;
		  ?>
        <tr class="lblCampo">
          <td><div align="center"><? echo $n1;?></div></td>
          <td><div align="left"><? echo $filast['nombres'];?></div></td>
          <td><div align="left"><? echo $filast['dociden_per'];?></div></td>
          <td><div align="left"><? echo $filast['razon_emp'];?></div></td>
          <td><div align="left"><? echo $filast['origen'];?></div></td>
          <td><div align="left"><? echo $filast['destino'];?></div></td>
          <td><div align="center"></div></td>
          <td><div align="center"></div></td>
          <td><div align="center"> </div></td>
        </tr>
        <? 
		}
		$objPer->Liberar($resultadot);  
		?>
      </table>
    </div></td>
    <td >&nbsp;</td>
  </tr>
  <tr class="lblCampo">
    <td></td>
    <td>&nbsp;</td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td height="610" valign="top"><div align="left"> 
        <table width="721" border="1" cellspacing="0" cellpadding="0" style="<?=$stylo['tabla']?>" bordercolor="<?=$bordetabla1?>">
          <tr class="lblCampo">
            <td width="22" rowspan="2"><div align="center" ><strong>#</strong></div></td>
            <td colspan="2"><div align="center"><strong>PASAJEROS</strong></div></td>
            <td width="89" rowspan="2"><div align="center"><strong>COMPANIA</strong></div></td>
            <td width="103" rowspan="2"><div align="center"><strong>CENTRO DE COSTO </strong></div></td>
            <td width="46" rowspan="2"><div align="center"><strong>ORIGEN</strong></div></td>
            <td width="51" rowspan="2"><div align="center"><strong>DESTINO</strong></div></td>
            <td colspan="3"><div align="center"><strong>PESO EN KG </strong></div></td>
          </tr>
          <tr class="lblCampo">
            <td width="203"><div align="center"><strong>APELLIDOS Y NOMBRES </strong></div></td>
            <td width="59"><div align="center"><strong>DNI/DOC</strong></div></td>
            <td width="38"><div align="center"><strong>Pasajero</strong></div></td>
            <td width="38"><div align="center"><strong>Equipaje </strong></div></td>
            <td width="50"><div align="center"><strong>Subtotal</strong></div></td>
          </tr>
          <?
		$n3=0;
		  $resultadop=$objPer->getPassDatosViajeUnido($cod_man,$via);	
          while($filasp=$objPer->NextRow($resultadop)){
		  $n3++;
		  ?>
          <tr class="lblCampo">
            <td><div align="center"><? echo $n3;?></div></td>
            <td><div align="left"><? echo $filasp['nombres'];?></div></td>
            <td><div align="left"><? echo $filasp['dociden_per'];?></div></td>
            <td><div align="left"><? echo $filasp['razon_emp'];?></div></td>
            <td><div align="center"><? echo $filasp['ccosto'];?></div></td>
            <td><div align="left">
			<? 
			$rspta=$objPer->getPassTotalAsc($cod_man,$filasp['dociden_per']);
			$filapta=$objPer->NextRow($rspta);
			echo $filapta['origen'];
			?>
			</div></td>
            <td><div align="left">
			<? 
			
			$rspt=$objPer->getPassTotal($cod_man,$filasp['dociden_per']);
			$filapt=$objPer->NextRow($rspt);
			$totalper = $objPer->totalrows($rspt);
			
			$rspd=$objPer->getPassDestino($cod_man,$filasp['dociden_per'],$filapt['numdestino']);
			$filapd=$objPer->NextRow($rspd);
			
			echo $filapd['destino'];
			?>
			</div></td>
            <td><div align="center"> <? echo $pesopass=$filasp['peso_mpass'];
		  $pesopasst=$pesopasst+$pesopass;
		  ?> </div></td>
            <td><div align="center"> <? echo $pesoeq=$filasp['pesoeq_mpass'];
		  $pesoeqt=$pesoeqt+$pesoeq;
		  ?> </div></td>
            <td><div align="center">
                <? 
		  echo $pesosubt=$pesopass+$pesoeq;
		  $pesot=$pesot+$pesosubt;
		  ?>
            </div></td>
          </tr>
          <? 
		}
		$objPer->Liberar($resultadop);  
		?>
          <tr class="lblCampo">
            <td colspan="7"><div align="right" class="Estilo1"><span class="Estilo2">1</span> Total </div></td>
            <td><div align="center"><? echo $pesopasst;?></div></td>
            <td><div align="center"><? echo $pesoeqt;?></div></td>
            <td><div align="center"><? echo $pesot;?></div></td>
          </tr>
        </table>
            <br>
            <table width="722" border="1" cellspacing="0" cellpadding="0" style="<?=$stylo['tabla']?>" bordercolor="<?=$bordetabla1?>">
        <tr class="lblCampo">
          <td width="23" rowspan="2"><div align="center" ><strong>Item</strong></div></td>
          <td colspan="2"><div align="center"><strong>MATERIALES</strong></div></td>
          <td width="78" rowspan="2"><div align="center"><strong>COMPANIA</strong></div></td>
          <td width="113" rowspan="2"><div align="center"><strong>CENTRO DE COSTO </strong></div></td>
          <td width="48" rowspan="2"><div align="center"><strong>ORIGEN</strong></div></td>
          <td width="46" rowspan="2"><div align="center"><strong>DESTINO</strong></div></td>
          <td colspan="3"><div align="center"><strong>PESO EN KG </strong></div></td>
        </tr>
        <tr class="lblCampo">
          <td width="196"><div align="center"><strong>DESCRIPCION</strong></div></td>
          <td width="76"><div align="center"><strong>N&ordm; Guia </strong></div></td>
          <td width="29"><div align="center"><strong>Bultos</strong></div></td>
          <td width="44"><div align="center"><strong>Unidad</strong></div></td>
          <td width="47"><div align="center"><strong>Subtotal</strong></div></td>
        </tr>
		<?
		$n2=0;
		  $resultadom=$objPer->getCargaDatosViajeUnido($cod_man,$via);	
          while($filasm=$objPer->NextRow($resultadom)){
		  $n2++;
		  ?>
        <tr class="lblCampo">
          <td><div align="center"><? echo $n2;?></div></td>
          <td><div align="left"><? echo $filasm['des_w'];?></div></td>
          <td><div align="left">
		  <? 
		  echo$filasm['guia_w'];
		  ?>
		  </div></td>
          <td><div align="left"><? echo $filasm['compania'];?></div></td>
          <td><div align="center"><? echo $filasm['ccosto'];?></div></td>
          <td><div align="left"><? echo $filasm['origen'];?></div></td>
          <td><div align="left">
		  <? 
		  $rsct=$objPer->getCargaTotal($cod_man,$filasm['des_w'],$filasm['compania']);
			$filact=$objPer->NextRow($rsct);
			$totalcar = $objPer->totalrows($rsct);
			
			$rscd=$objPer->getCargaDestino($cod_man,$filasm['des_w'],$filact['numdestino'],$filasm['compania']);
			$filacd=$objPer->NextRow($rscd);
			
			echo $filacd['destino'];
		  ?>
		  </div></td>
          <td><div align="center"><? echo $cantw=$filasm['cant_w'];
		  $cantwt=$cantwt+$cantw;
		  ?></div></td>
          <td><div align="center"><? echo $filasm['tipounidad'];?></div></td>
          <td><div align="center">
            <? echo $pesow=$filasm['peso_w'];
		  $pesowt=$pesowt+$pesow;
		  ?>
          </div></td>
        </tr>
		<? 
		}
		$objPer->Liberar($resultadom);  
		?> 
        <tr class="lblCampo">
          <td colspan="7"><div align="right" class="Estilo3"><span class="Estilo2">2</span> Total </div></td>
          <td><div align="center"><? echo $cantwt;?></div></td>
          <td><div align="center"></div></td>
          <td><div align="center"><? echo $pesowt;?></div></td>
        </tr>
        <tr class="lblCampo">
          <td colspan="7"><div align="right" class="lblParrafo">1+2 Total </div></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td><div align="center" class="lblParrafo"><? echo $pesot+$pesowt;?></div></td>
        </tr>
      </table>
      <br>
    </div></td>
    <td></td>
  </tr>
  
  <tr>
    <td></td>
    <td height="73" valign="top"><div align="left">
      <table width="722" border="1" cellspacing="0" cellpadding="0" style="<?=$stylo['tabla']?>" bordercolor="<?=$bordetabla1?>">
        <tr class="lblCampo">
          <td><strong>COMENTARIOS : </strong></td>
          </tr>
        <tr class="lblCampo">
          <pre>
        <td><div align="left"><? echo $row['obser'];?></div>
		</td>
		</pre>
        </tr>
      </table>
    </div></td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td><div align="left">
      <table width="724" border="0" cellspacing="0" cellpadding="0">
        <tr class="lblCampo">
          <td width="323"><div align="left">Representante por Perenco </div></td>
          <td width="61">&nbsp;</td>
          <td width="319"><div align="right">Responsable por Transporte </div></td>
          <td width="21">&nbsp;</td>
        </tr>
        <tr class="lblCampo">
          <td><div align="left"><span class="lblParrafo"><? echo $row['repre']?></span></div></td>
          <td>&nbsp;</td>
          <td><div align="right"><span class="lblParrafo"><? echo $row['respon']?></span></div></td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </div></td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td><div align="right"><? //echo $page+1?> <? //echo $totalpage?></div></td>
    <td><div align="left">
	
	</div></td>
  </tr>
</table>
<!--<form action="ficheroExcel.php" method="post" target="_blank" id="FormularioExportacion">
<img src="imagen/export_to_excel.gif" width="15" height="15" class="botonExcel" /></p>
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</form> -->
<map name="MapMap">
  <area shape="rect" coords="3,4,23,21" href="fondo.php">
</map>
</body>
</html>

