<? session_start();
include("header.php");
require_once("comun/conex_ver.php");
require_once("comun/conexion3.php");
require_once("comun/funciones.php");

$booking_interteam = $_GET[booking_interteam];
$id = $_GET[id];
$id_bl = $_GET[id_bl];
$referencia = $_GET[referencia];
$referencia_cliente = $_GET[referencia_cliente];

$link_impo=con_impo();
$link =con_ver(); 

$viaje=data($link_impo,"select * from datosexpint where referencia_interteam = '".$referencia_cliente."'");

 
$partida = data($link,"select * from detailcargaexpint where id = '".$id."'");
//echo 'partida '."select * from detailcargaexpint where id = '".$id."'<br>";
if($id_bl==0){
	$bl = data($link,"select * from hblexpint where tipo='MBL' and booking = '".$booking_interteam."' and referencia = '".$referencia_cliente."'");
}else{
	$bl = data($link,"select * from hblexpint where idhbl = '".$id_bl."'");
}
//echo "select * from hblexpint where idhbl = '".$id_bl."'";
$tipo_bl = $bl[tipo];	

$dimensiones = mysqli_query($link,"select * from dimensiones where id_partida = '".$id_bl."' ");
//echo "select * from dimensiones where booking = '".$bookingno."' and id_partida = '".$id."' ";
while($rd=mysqli_fetch_array($dimensiones)){
	$numero_bultos[]=$rd[numero_bultos];
	$largo[]=$rd[largo];
	$ancho[]=$rd[ancho];
	$alto[]=$rd[alto];
}
?> 
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
	<!--[if IE 7]>
	<link rel="stylesheet" type="text/css" href="style-ie.css" />
	<![endif]-->
    
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/validator.js"></script>
<script type="text/javascript" src="js/funciones.js"></script>
<script type="text/javascript" src="js/autocomplete/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/autocomplete/jquery.autocomplete.css" media="all" />
<script src="js/windowfiles/dhtmlwindow.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="js/windowfiles/dhtmlwindow.css" media="all" />
<SCRIPT type="text/javascript" src="../../../js/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<link type="text/css" rel="stylesheet" href="../../../js/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" media="screen"></LINK>

<script>
function preguntar(inst1,dato){

eliminar=confirm("Borra el registro? " + dato);

if (eliminar)

window.location.href = inst1; 

}

</script>   
<div align="justify" style="line-height:18px;margin-top:-20px; position:absolute; height:100% ">
<form id="forma" name="forma" action="destinoguarda.php?referencia_cliente=<?=$_GET[referencia_cliente]?>&referencia=<?=$_GET[referencia]?>&booking=<?=$_GET[booking]?>" method="post" >

<input type="hidden" id="email_2" name="email_2" value="<?=$_SESSION[email]?>" />
<input type="hidden" id="referencia" name="referencia" value="<?=$_GET[referencia]?>" />
<input type="hidden" id="referencia_cliente" name="referencia_cliente" value="<?=$_GET[referencia_cliente]?>" />
<input type="hidden" id="booking" name="booking" value="<?=$_GET[booking]?>" />
<span style="color:#00AF4B">&nbsp;Registro de destinos &raquo;</span><br />
<table width="921" style="line-height:22px"  >
  
  <tr>
    <td colspan="2"  >    
      <input align="left" type="submit"  value="Guardar destino"  style="border:none; margin-left:-8px;background-color:transparent;color:#00AF4B;text-decoration:underline;font-family:Arial, Helvetica, sans-serif; font-size:14px"> &nbsp;&nbsp;
      <a id="regresar" style="cursor:default;color:#00AF4B;text-align:center;text-decoration:underline;" 
      
	  <? if($_GET[referencia]!=''){ ?>
       href="registro_mbl_navieras.php?referencia=<?=$_GET[referencia]?>&interteam=1">Regresar</a>
	  <? }elseif($_GET[referencia_cliente]!=''){ ?>
      href="registro_mbl_navieras.php?referencia_cliente=<?=$_GET[referencia_cliente]?>&interteam=1">Regresar</a>
      <? } elseif($_GET[booking]!='') { ?>
      href="registro_mbl_navieras.php?booking=<?=$_GET[booking]?>&interteam=1">Regresar</a>
      <? } ?>
      <? if($_GET[referencia_cliente]=='' and $_GET[referencia]=='' and $_GET[booking]==''){ ?> 
       href="registro_mbl_navieras.php">Regresar</a>
      </a>
      <? } ?>
    </tr>
  
   
  <tr>
    <td><b>DESTINO</b></td>
    <td><input type="text" class="aa" name="destino" id="destino" size="40" value=""  /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="226"><b>SHIPPER</b></td>
    <td>&nbsp;</td>
  </tr>
  
  <tr>
    <td width="226">NAME</td>
    <td><input type="text" class="aa" name="shipper1" id="shipper1" size="40" value="<?=$bl[shipper]?>"  /></td>
  </tr>
  
  <tr>
    <td>ADDRESS</td>
    <td><input type="text" class="aa" name="shipper2" id="shipper2" size="40" value="<?=$bl[shipper2]?>" /></td>
  </tr>
  <tr>
    <td>PO BOX, CITY &amp; COUNTRY</td>
    <td><input type="text" class="aa" name="shipper3" id="shipper3" size="40" value="<?=$bl[shipper3]?>" /></td>
  </tr>
  <tr>
    <td>RFC</td>
    <td><input type="text" class="aa" name="shipper4" id="shipper4" size="40" value="<?=$bl[shipper4]?>" /></td>
  </tr>
  <tr>
    <td>CTC</td>
    <td><input type="text" class="aa" name="shipper5" id="shipper5" size="40" value="<?=$bl[shipper5]?>" /></td>
  </tr>
  <tr>
    <td>PHONE</td>
    <td><input type="text" class="aa" name="shipper6" id="shipper6" size="40" value="<?=$bl[shipper6]?>" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td id="t_nombre"><b>CONSIGNEE</b></td>
    <td>&nbsp;</td>
    </tr>
  <tr>
    <td>NAME      </td>
    <td><input type="text" class="aa" name="consignee1" id="consignee1" size="40" value="<?=$bl[consignee]?>" /></td>
    </tr>
  <tr>
    <td>ADDRESS</td>
    <td><input type="text" class="aa" name="consignee2" id="consignee2" size="40" value="<?=$bl[consignee2]?>" /></td>
  </tr>
  <tr>
    <td>PO BOX, CITY &amp; COUNTRY</td>
    <td><input type="text" class="aa" name="consignee3" id="consignee3" size="40" value="<?=$bl[consignee3]?>" /></td>
  </tr>
  <tr>
    <td>RFC</td>
    <td><input type="text" class="aa" name="consignee4" id="consignee4" size="40"  value="<?=$bl[consignee4]?>"/></td>
  </tr>
  <tr>
    <td>CTC</td>
    <td><input type="text" class="aa" name="consignee5" id="consignee5" size="40" value="<?=$bl[consignee5]?>" /></td>
  </tr>
  <tr>
    <td width="226">PHONE</td>
    <td><input type="text" class="aa" name="consignee6" id="consignee6" size="40" value="<?=$bl[consignee6]?>" /></td>
  </tr>
   
  <tr>
    <td colspan="2" >&nbsp;</td>
  </tr>
  <tr>
    <td id="t_nombre"><b>NOTIFY </b>
      <input name="chk_copy" id="chk_copy" type="checkbox" title="Copy from consignee"  
      onclick="if(this.checked){
      $('#notify1').val($('#consignee1').val());
      $('#notify2').val($('#consignee2').val());
      $('#notify3').val($('#consignee3').val());
      $('#notify4').val($('#consignee4').val());
      $('#notify5').val($('#consignee5').val());
      $('#notify6').val($('#consignee6').val());
      }else{
      $('#notify1').val('');
      $('#notify2').val('');
      $('#notify3').val('');
      $('#notify4').val('');
      $('#notify5').val('');
      $('#notify6').val('');
      }" /></td>
    <td>&nbsp;</td>
    </tr>
  <tr>
    <td>NAME</td>
    <td><input type="text" class="aa" name="notify1" id="notify1" size="40" value="<?=$bl[notify]?>" /></td>
    </tr>
  <tr>
    <td>ADDRESS</td>
    <td><input type="text" class="aa" name="notify2" id="notify2" size="40" value="<?=$bl[notify2]?>" /></td>
    </tr>
  <tr>
    <td>PO BOX, CITY &amp; COUNTRY</td>
    <td><input type="text" class="aa" name="notify3" id="notify3" size="40" value="<?=$bl[notify3]?>" /></td>
    </tr>
  <tr>
    <td>RFC</td>
    <td><input type="text" class="aa" name="notify4" id="notify4" size="40" value="<?=$bl[notify4]?>" /></td>
    </tr>
  <tr>
    <td>CTC</td>
    <td><input type="text" class="aa" name="notify5" id="notify5" size="40" value="<?=$bl[notify5]?>" /></td>
    </tr>
  <tr>
    <td>PHONE</td>
    <td><input type="text" class="aa" name="notify6" id="notify6" size="40" value="<?=$bl[notify6]?>" /></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
 
 <!-- <tr>
    <td><b>CARGO</b></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>MARKS</td>
    <td><input type="text" class="aa" name="marks" id="marks" size="40" value="<?=$partida[markandnos]?>" /></td>
  </tr>
  <tr>
    <td>QUANTITY</td>
    <td><input type="text" class="aa" name="quantity" id="quantity" size="40" value="<?=$partida[bulk]?>" /></td>
  </tr>
  <tr>
    <td valign="top">TYPE OF BULKS</td>
    <td><input type="text" class="aa" name="type_of_bulks" id="type_of_bulks" size="40" value="<?=$partida[type_of_bulks]?>" /></td>
  </tr>
  <tr>
    <td valign="top">DESCRIPTION OF GOODS<BR /> DECLARED BY SHIPPER <img align="absbottom" src="images/info_gray.png" title="Por favor escriba en inglés la descripción de la mercancía, dado que las compañías navieras sólo aceptan este idioma para esta descripción. // Please write in english language the description of goods, as Shipping Lines only accept english for this description." alt="" onMouseover="ddrivetip('Por favor escriba en inglés la descripción de la mercancía, dado que las compañías navieras sólo aceptan este idioma para esta descripción. // Please write in english language the description of goods, as Shipping Lines only accept english for this description.','yellow', 300)"
onMouseout="hideddrivetip()" /></td>
    <td><input type="text" class="aa" name="description" id="description" size="40" value="<?=$partida[cargo]?>" /></td>
  </tr>
  <tr>
    <td align="left">NUMBER OF PIECES CONTAINED</td>
    <td><input type="text" class="aa" name="no_piezas" id="no_piezas" size="40"  value="<?=$partida[number_of_pieces]?>"/></td>
  </tr>
  <tr>
    <td>GROSS WEIGHT KGS.</td>
    <td><input type="text" class="aa" name="gross_weight" id="gross_weight" size="40" value="<?=$partida[weight]?>" /></td>
  </tr>
  <tr>
    <td>NET WEIGHT KGS.</td>
    <td><input type="text" class="aa" name="net_weight" id="net_weight" size="40" value="<?=$partida[netweight]?>" /></td>
  </tr>
  <tr>
    <td>VOLUME</td>
    <td><input type="text" class="aa" name="volume" id="volume" size="40" value="<?=$partida[measurement]?>" /></td>
  </tr>
  <tr>
    <td>HARMONIZED CODE</td>
    <td><input type="text" class="aa" name="harmonized_code" id="harmonized_code" size="40" value="<?=$partida[harmonized_code]?>" /></td>
  </tr>
  <tr>
    <td>CUSTOMER OWN AMS</td>
    <td><input type="text" class="aa" name="ams" id="ams" size="40" value="<?=$partida[ams]?>" /></td>
  </tr>-->
 
   <tr>
       <td colspan="2">
       </td>
    </tr>
 </table>

<?
$result = mysqli_query($link,"SELECT * FROM destinos_mbl order by destino");
?>
<table align="left" width="70%"  class="tablas_con_bordes_" style="font-family:Arial, Helvetica, sans-serif; font-size:11px" >

<TR class='yellow'>
<TD style='text-align:center'><strong><font size="1" face="Arial, Helvetica, sans-serif">Destino</font></strong></TD>
<TD style='text-align:center'><strong><font size="1" face="Arial, Helvetica, sans-serif">Cambiar</font></strong></TD>
<TD style='text-align:center'><strong><font size="1" face="Arial, Helvetica, sans-serif">Borrar</font></strong></TD>
</TR>

<?
 while ($row = mysqli_fetch_array($result)){
?>

<TR class='comun'>
<TD style='text-align:left'><font size="1" face="Arial, Helvetica, sans-serif"><?=$row["destino"]?></font></TD> 
<TD style='text-align:center'><font size="1" face="Arial, Helvetica, sans-serif"><a href="destinocambio.php?referencia=<?=$_GET[referencia]?>&booking=<?=$_GET[booking]?>&referencia_cliente=<?=$_GET[referencia_cliente]?>&id=<?=$row["id"]?>&& txt=<?=$row["id"]?>">Cambiar</a></font></TD> 
<TD style='text-align:center'><font size="1" face="Arial, Helvetica, sans-serif"><a href="javascript:preguntar('destinoborra.php?id=<?=$row["id"]?>&& txt=<?=$row["id"]?>&referencia=<?=$_GET[referencia]?>&booking=<?=$_GET[booking]?>&referencia_cliente=<?=$_GET[referencia_cliente]?>','')">Borrar</a></font></TD> 
</TR>

<?
   }
?>

<TR class='comun'>
<TD colspan="3">&nbsp;&nbsp;</TD> 
</TR>
<TR class='comun'>
<TD colspan="3">&nbsp;&nbsp;</TD> 
</TR>
</table>   

  
</form>
 
</div>

