<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
  <xsl:template match="/">
   <html>
    <head>

<title>GUÍA AÉREA</title>
<script>
<xsl:comment><![CDATA[
function hoy()
{
  var fechaActual = new Date();
  dia = fechaActual.getDate();
  mes = fechaActual.getMonth() +1;
  anno = fechaActual.getYear();
  if (dia <10) dia = "0" + dia;
  if (mes <10) mes = "0" + mes;
  var Hours;
  var Mins;
  var Time;
  Hours = fechaActual.getHours();
  if (Hours < 10) {
  Hours = "0" + Hours;
  }
  Mins = fechaActual.getMinutes();
  if (Mins < 10) {
  Mins = "0" + Mins;
  }
  fechaHoy = dia + "/" + mes + "/" + anno + " " + Hours + ":" + Mins;
  return fechaHoy;
}

function positivoNegativo(valor)
{
 var son;
 if (valor == 'S'){
    son = 'SI';
 }
 if (valor == 'N'){
    son = 'NO';
 }
 return son;
}
   ]]></xsl:comment>
</script>


</head>
<body style="margin:0;" bgColor="#FFFFFF">
<br/>
<table align="center" border="0" width="100%" cellPadding="0" cellSpacing="0">
  <tr>  
    <td width="10%"><img src="../../src/img/logo_gobierno_chile_115x128.gif" height="70" width="60"> </img></td>
    <td width="30%">Gobierno de Chile <br/>Servicio Nacional de Aduanas</td>
    <td width="50%"><font face="arial" size="6"><b><center>GUÍA AÉREA</center></b></font></td>
    <td width="10%" align="right"><img src="../../src/img/logo_aduanas_chile_207x265.gif" height="70" width="60"> </img></td>
  </tr>
</table>
<br/>
<table border="1" width="100%" bordercolor="#000000" cellPadding="0" cellSpacing="0">
  <tr bgcolor="#DDDDDD">
      <td width="25%"><font size="1"><b>Emisor</b></font></td><td width="40%" colspan="2"><font size="1"><b>Guía Aérea</b></font></td><td width="35%" colspan="2"><font size="1"><b>Manifiesto</b></font></td>
  </tr>
  <tr>
      <td rowspan="3" valign="top"><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="emisor" select="nombre"/> <xsl:if test="$emisor = 'EMI'"> <xsl:value-of select="nombres"/><br/>[<xsl:value-of select="tipo-id"/>]&#160;<xsl:value-of select="valor-id"/> </xsl:if> </xsl:for-each></font></td><td colspan="2"><font size="1"><xsl:value-of select="Documento/numero-referencia"/></font></td><td colspan="2"><font size="1"><xsl:for-each select="Documento/Referencias/referencia"> <xsl:variable name="refMfto" select="tipo-referencia"/> <xsl:if test="$refMfto = 'REF'"> <xsl:value-of select="numero"/></xsl:if> </xsl:for-each></font></td>
  </tr>
  <tr bgcolor="#DDDDDD">
      <td width="25%"><font size="1"><b>Fecha Emisión</b></font></td><td width="20%"><font size="1"><b>Fecha Zarpe</b></font></td><td width="20%"><font size="1"><b>Sentido</b></font></td><td width="10%"><font size="1"><b>Vuelo</b></font></td>
  </tr>
  <tr>
      <td><font size="1"><xsl:for-each select="Documento/Fechas/fecha"> <xsl:variable name="fecEM" select="nombre"/> <xsl:if test="$fecEM = 'FEM'"> <xsl:value-of select="valor"/></xsl:if> </xsl:for-each></font></td><td><font size="1"><xsl:for-each select="Documento/Fechas/fecha"> <xsl:variable name="fecZA" select="nombre"/> <xsl:if test="$fecZA = 'FZARPE'"> <xsl:value-of select="valor"/></xsl:if> </xsl:for-each></font></td><td><font size="1"><xsl:variable name="sent" select="Documento/OpTransporte/optransporte/sentido-operacion"/>[<xsl:value-of select="$sent"/>]&#160;<xsl:if test="$sent='I'">Ingreso</xsl:if><xsl:if test="$sent='S'">Salida</xsl:if></font></td><td><font size="1"><xsl:value-of select="Documento/OpTransporte/optransporte/viaje"/></font></td>
  </tr>
</table>
<br/>
<table align="center" border="1" width="100%" cellPadding="0" cellSpacing="0" bordercolor="#000000">
  <tr bgcolor="#DDDDDD">
      <td colspan="4"><font size="1"><b>PARTICIPANTES</b></font></td>
  </tr>
  <tr>
      <td colspan="2" width="50%"><font size="1"><b>Emisor Documento</b></font></td><td colspan="2" width="50%"><font size="1"><b>Consignante</b></font></td>
  </tr>
  <tr>
      <td width="25%"><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="emido" select="nombre"/> <xsl:if test="$emido = 'EMIDO'"> <xsl:value-of select="nombres"/></xsl:if> </xsl:for-each></font></td><td width="25%"><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="emido2" select="nombre"/> <xsl:if test="$emido2 = 'EMIDO'"> [<xsl:value-of select="tipo-id"/>]&#160;<xsl:value-of select="valor-id"/> </xsl:if> </xsl:for-each></font></td>
      <td width="25%"><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="cnte" select="nombre"/> <xsl:if test="$cnte = 'CNTE'"> <xsl:value-of select="nombres"/></xsl:if> </xsl:for-each></font></td><td width="25%"><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="cnte2" select="nombre"/> <xsl:if test="$cnte2 = 'CNTE'"> [<xsl:value-of select="tipo-id"/>]&#160;<xsl:value-of select="valor-id"/> </xsl:if> </xsl:for-each></font></td>
  </tr>
  <tr>
      <td colspan="2"><font size="1"><b>Consignatario</b></font></td><td colspan="2"><font size="1"><b>Consignante</b></font></td>
  </tr>
  <tr>
      <td><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="cons" select="nombre"/> <xsl:if test="$cons = 'CONS'"> <xsl:value-of select="nombres"/></xsl:if> </xsl:for-each></font></td><td><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="cons2" select="nombre"/> <xsl:if test="$cons2 = 'CONS'"> [<xsl:value-of select="tipo-id"/>]&#160;<xsl:value-of select="valor-id"/> </xsl:if> </xsl:for-each></font></td>
      <td><font size="1">&#160;</font></td><td><font size="1">&#160;</font></td>
  </tr>
  <tr>
      <td colspan="2"><font size="1"><b>Compañía Aérea</b></font></td><td colspan="2"><font size="1"><b>Notify</b></font></td>
  </tr>
  <tr>
      <td><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="caer" select="nombre"/> <xsl:if test="$caer = 'CAER'"> <xsl:value-of select="nombres"/></xsl:if> </xsl:for-each></font></td><td><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="caer2" select="nombre"/> <xsl:if test="$caer2 = 'CAER'"> [<xsl:value-of select="tipo-id"/>]&#160;<xsl:value-of select="valor-id"/> </xsl:if> </xsl:for-each></font></td>
      <td><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="noti" select="nombre"/> <xsl:if test="$noti = 'NOTI'"> <xsl:value-of select="nombres"/></xsl:if> </xsl:for-each>&#160;</font></td><td><font size="1"><xsl:for-each select="Documento/Participaciones/participacion"> <xsl:variable name="noti2" select="nombre"/> <xsl:if test="$noti2 = 'NOTI'"> [<xsl:value-of select="tipo-id"/>]&#160;<xsl:value-of select="valor-id"/> </xsl:if> </xsl:for-each>&#160;</font></td>
  </tr>
</table>
<br/>
<table align="center" border="1" width="100%" cellPadding="0" cellSpacing="0" bordercolor="#000000">
  <tr bgcolor="#DDDDDD">
      <td colspan="2" width="50%"><font size="1"><b>Locaciones</b></font></td><td colspan="4" width="50%"><font size="1"><b>Cargos</b></font></td>
  </tr>
  <tr>
      <td width="25%"><font size="1"><b>Puerto Embarque</b></font></td>
      <td width="25%"><font size="1"><xsl:for-each select="Documento/Locaciones/locacion"> <xsl:variable name="pemb" select="nombre"/> <xsl:if test="$pemb = 'PE'"> <xsl:value-of select="codigo"/></xsl:if> </xsl:for-each>&#160;</font></td>
      <td width="13%"><font size="1"><b>Valor Flete</b></font></td>
      <td width="12%"><font size="1"><xsl:value-of select="Documento/Cargos/cargo/monto"/>&#160;</font></td>
      <td width="13%"><font size="1"><b>Moneda</b></font></td>
      <td width="12%"><font size="1"><xsl:value-of select="Documento/Cargos/cargo/moneda"/>&#160;</font></td>
  </tr>
  <tr>
      <td><font size="1"><b>Puerto Desembarque</b></font></td>
      <td><font size="1"><xsl:for-each select="Documento/Locaciones/locacion"> <xsl:variable name="pdemb" select="nombre"/> <xsl:if test="$pdemb = 'PD'"> <xsl:value-of select="codigo"/></xsl:if> </xsl:for-each>&#160;</font></td>
      <td><font size="1"><b>Condición Pago</b></font></td>
      <td colspan="3"><font size="1"><xsl:variable name="condpago" select="Documento/Cargos/cargo/cond-pago"/>[<xsl:value-of select="Documento/Cargos/cargo/cond-pago"/>]&#160;<xsl:if test="$condpago = 'P'">Prepaid</xsl:if><xsl:if test="$condpago = 'C'">Collect</xsl:if></font></td>
  </tr>
</table>
<br/>

<table align="center" border="1" width="100%" cellPadding="0" cellSpacing="0" bordercolor="#000000">
  <tr bgcolor="#DDDDDD">
      <td colspan="7" width="50%"><font size="1"><b>ITEMS</b></font></td>
  </tr>
  <tr>
    <td width="5%" align="center"><font size="1"><b>N°</b></font></td>
    <td width="15%" align="center"><font size="1"><b>Carga Peligrosa</b></font></td>
    <td width="10%" align="center"><font size="1"><b>Bultos</b></font></td>
    <td width="10%" align="center"><font size="1"><b>Peso Bruto</b></font></td>
    <td width="10%" align="center"><font size="1"><b>Volumen</b></font></td>
    <td width="40%" align="center"><font size="1"><b>Descripción</b></font></td>
    <td width="10%" align="center"><font size="1"><b>Cantidad</b></font></td>
  </tr>
  <xsl:for-each select="Documento/Items/item">
  <tr>
    <td width="5%" valign="top"><font size="1">&#160;<xsl:value-of select="numero-item"/></font></td>
    <td width="15%" valign="top"><font size="1">&#160;[<xsl:value-of select="carga-peligrosa"/>]&#160;<script>document.write(positivoNegativo("<xsl:value-of select="carga-peligrosa"/>"))</script></font></td>
    <td width="10%" valign="top"><font size="1">&#160;<xsl:value-of select="cantidad"/></font></td>
    <td width="10%" valign="top"><font size="1">&#160;<xsl:value-of select="peso-bruto"/>&#160;<xsl:value-of select="unidad-peso"/></font></td>
    <td width="10%" valign="top"><font size="1">&#160;<xsl:value-of select="volumen"/>&#160;<xsl:value-of select="unidad-volumen"/></font></td>
    <td width="40%" valign="top"><font size="1">&#160;<xsl:value-of select="ProdItem/proditem/descripcion"/>&#160;</font></td>
    <td width="10%" valign="top"><font size="1">&#160;<xsl:value-of select="ProdItem/proditem/cantidad"/>&#160;<xsl:value-of select="ProdItem/proditem/unidad-medida"/></font></td>
  </tr>
  </xsl:for-each>
</table>

<br/>

<table align="center" border="1" width="100%" cellPadding="0" cellSpacing="0" bordercolor="#000000">
  <tr>
    <td width="12%" valign="top" bgcolor="#DDDDDD"><font size="1"><b>Total Bultos</b></font></td>
    <td width="13%" valign="top"><font size="1">&#160;<xsl:value-of select="Documento/total-bultos"/></font></td>
    <td width="12%" valign="top" bgcolor="#DDDDDD"><font size="1"><b>Total Peso</b></font></td>
    <td width="13%" valign="top"><font size="1">&#160;<xsl:value-of select="Documento/total-peso"/>&#160;<xsl:value-of select="Documento/unidad-peso"/></font></td>
    <td width="12%" valign="top" bgcolor="#DDDDDD"><font size="1"><b>Total Volumen</b></font></td>
    <td width="13%" valign="top"><font size="1">&#160;<xsl:value-of select="Documento/total-volumen"/>&#160;<xsl:value-of select="Documento/unidad-volumen"/></font></td>
    <td width="12%" valign="top" bgcolor="#DDDDDD"><font size="1"><b>Parcial</b></font></td>
    <td width="13%" valign="top"><font size="1">&#160;[<xsl:value-of select="Documento/parcial"/>]&#160;<script>document.write(positivoNegativo("<xsl:value-of select="Documento/parcial"/>"))</script></font></td>
  </tr>
</table>
<br/>
<table align="center" border="1" width="100%" cellPadding="0" cellSpacing="0" bordercolor="#000000">
  <tr bgcolor="#DDDDDD">
    <td align="left" colspan="3"><font size="1"><b>TRANSBORDOS</b></font></td>
  </tr>
  <tr>
    <td><font size="1">&#160;<b>N°</b></font></td>
    <td><font size="1">&#160;<b>IATA</b></font></td>
    <td><font size="1">&#160;<b>LUGAR</b></font></td>
  </tr>
  <xsl:for-each select="Documento/Transbordos/transbordo">
    <tr>
      <td><font size="1">&#160;</font></td>
      <td><font size="1">&#160;<xsl:value-of select="cod-lugar"/></font></td>
      <td align="left"><font size="1">&#160;</font></td>
    </tr>
  </xsl:for-each>
</table>
<br/>
<table align="center" border="1" width="100%" cellPadding="0" cellSpacing="0" bordercolor="#000000">
  <tr bgcolor="#DDDDDD">
    <td align="left" colspan="2"><font size="1"><b>OBSERVACIONES</b></font></td>
  </tr>
  <tr>
    <td><font size="1">&#160;<b>Tipo</b></font></td>
    <td><font size="1">&#160;<b>Descripción</b></font></td>
  </tr>
  <xsl:for-each select="Documento/Observaciones/observacion">
    <tr>
      <td><font size="1">&#160;<xsl:value-of select="nombre"/></font></td>
      <td align="left"><font size="1">&#160;<xsl:value-of select="contenido"/></font></td>
    </tr>
  </xsl:for-each>
</table>
<br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

