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

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

/*echo 'id '.$id.'<br>';
echo 'id bl '.$id_bl.'<br>';
echo 'referencia '.$referencia.'<br>';
echo 'referencia_cliente '.$referencia_cliente.'<br>';
echo 'booking no '.$bookingno.'<br>';*/

con_ver();
$bl = data("select * from hblexpint where idhbl = '".$id_bl."' and idhbl>10000");
$fd=$bl[finaldestination];

$tipo_bl = $bl[tipo];

if(trim($referencia_cliente)=='') $referencia_cliente = $bl[referencia];	


con_impo();
$bl1 = data("SELECT D.referencia_interteam, D.pod, D.pod_country, D.vessel, D.voyage
FROM datosexpint D
INNER JOIN bookingexpint B ON D.files = B.files
AND B.booking_interteam LIKE '".$bl[booking]."' AND B.booking_interteam<>'' and D.id>8500
LIMIT 10");
/*echo "SELECT D.referencia_interteam, D.pod, D.pod_country, D.vessel, D.voyage
FROM datosexpint D
INNER JOIN bookingexpint B ON D.files = B.files
AND B.booking_interteam LIKE '".$bl[booking]."' AND B.booking_interteam<>''
LIMIT 10";*/
if(trim($referencia_cliente)=='') {
	$referencia_cliente = $bl1[referencia_interteam];
}

con_ver();


$viaje=data("select * from datosbooking where referencia_cliente = '".$referencia_cliente."' and referencia_cliente<>''");


$partida = data("select * from detailcargaexpint where id_bl = '".$id_bl."'");

//echo "select * from detailcargaexpint where id_bl = '".$id_bl."'";

	

$dimensiones = mysql_query("select * from dimensiones where id_partida = '".$id_bl."' ");
if(mysql_num_rows($dimensiones)<1){
$dimensiones = mysql_query("select * from dimensiones where booking = '".$bl[booking]."' ");	 
}
$total=0;
while($rd=mysql_fetch_array($dimensiones)){
	$numero_bultos[]=$rd[numero_bultos];
	$largo[]=$rd[largo];
	$ancho[]=$rd[ancho];
	$alto[]=$rd[alto];
	$volumen[]=number_format(($rd[largo]/100) * ($rd[alto]/100) * ($rd[ancho]/100) * $rd[numero_bultos],3);
	$total+=($rd[largo]/100) * ($rd[alto]/100) * ($rd[ancho]/100) * $rd[numero_bultos];
}

 
if($referencia=='' and $referencia_cliente!=''){
	$referencia=busquedaB("select referencia_lpv from datosbooking where referencia_cliente='".$referencia_cliente."'","referencia_lpv");
	if(trim($referencia)==''){
	$referencia=busquedaB("select referencia from referencias_veracruz where referencia_cliente='".$referencia_cliente."'","referencia");	
	}
}

/*if($referencia_cliente=='' and $referencia!=''){
	$referencia_cliente=busquedaB("select referencia_cliente from datosbooking where referencia_lpv='".$referencia."'","referencia_cliente");
	if(trim($referencia_cliente)==''){
	$referencia_cliente=busquedaB("select referencia_cliente from referencias_veracruz where referencia='".$referencia_cliente."'","referencia_cliente");
	}
}
*/

if($booking_interteam!=''){
	//$referencia_cliente=busquedaB("select referencia from hblexpint  where booking='".$booking_interteam."' and referencia<>''","referencia");
	 
		if($referencia_cliente!=''){
			$referencia=busquedaB("select referencia_lpv from datosbooking where referencia_cliente='".$referencia_cliente."'","referencia_lpv");
			if(trim($referencia)==''){
				$referencia=busquedaB("select referencia from referencias_veracruz where referencia_cliente='".$referencia_cliente."'","referencia");	
			}
		}
}
	

?> 
<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>
$().ready(function() {
    $("#referencia2").autocomplete("lista_de_referencias_veracruz.php", {
		width: 260,
		matchContains: true,
		selectFirst: false
	});
	 
	$("#referencia2").result(function(event, data, formatted) {
		//alert(data[0]);alert(data[2]);
		$("#referencia2").val(data[1]);
		$("#referencia").val(data[2]);
	});
				  });


function fix(fixNumber, decimalPlaces)
{
var div = Math.pow(10,decimalPlaces);
fixNumber = Math.round(fixNumber * div) / div;
return fixNumber.toFixed(3);
}
function guardar_dimensiones()() {
	var laDatos = valores_forma(document.forma);
		//if(confirm('Confirma el registro de este MASTER BL?')) {
		//loadin('','saving_bl','Wait');
		//alert($('#idE').val()); &h_id="+$('#h_id').val()+
		$.post( "guarda_dimensiones.php?id_bl="+$('#id_bl').val()+"&booking="+$('#booking').val(),
				$(laDatos),
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});
	
}
function Guardar() {
	
		if($('#booking').val()==''){
			alert('Ingrese el booking');
			document.getElementById('booking').focus();
			return;
		}
	
		/*if($('#tarja').val()==''){
			alert('Ingrese la tarja');
			document.getElementById('tarja').focus();
			return;
		}*/
		
		if(document.getElementById('status_cambiado').options[document.getElementById('status_cambiado').selectedIndex].value=='' 
		&& document.getElementById('status').value!='OK'){
			alert('Seleccione el status de la revisión');
			document.getElementById('status_cambiado').focus();
			return;
		}
		
		/*if($('#shipper_file').val()==''){
			alert('Ingrese el valor de shipper file o referencia unica');
			document.getElementById('shipper_file').focus();
			return;
		}*/
	if( !(document.getElementById('hora').value*1>=0 && document.getElementById('hora').value*1<=23)){
			alert('Ingrese una hora correcta con el formato de 24 horas');
			document.getElementById('hora').focus();
			return;
	}
	
	if( !(document.getElementById('minutos').value*1>=0 && document.getElementById('minutos').value*1<=59)){
			alert('Ingrese minutos correctos de 0 a 59');
			document.getElementById('minutos').focus();
			return;
	}
			
	if($('#shipper1').val()==''){
		alert('Ingrese el nombre de Shipper');
		document.getElementById('shipper1').focus();
		return;
	}

	if($('#shipper2').val()==''){
		alert('Ingrese la dirección de Shipper');
		document.getElementById('shipper2').focus();
		return;
	}

	if($('#shipper3').val()==''){
		alert('Ingrese PO Box/City & Country de Shipper');
		document.getElementById('shipper3').focus();
		return;
	}
	
	if($('#shipper4').val()==''){
		alert('Ingrese el RFC de Shipper');
		document.getElementById('shipper4').focus();
		return;
	}

	if($('#shipper5').val()==''){
		alert('Ingrese CTC de Shipper');
		document.getElementById('shipper5').focus();
		return;
	}
	
	if($('#shipper6').val()==''){
		alert('Ingrese el teléfono de Shipper');
		document.getElementById('shipper6').focus();
		return;
	}
 
	if($('#consignee1').val()==''){
		alert('Ingrese el nombre de Consignee');
		document.getElementById('consignee1').focus();
		return;
	}

	if($('#consignee2').val()==''){
		alert('Ingrese la dirección de Consignee');
		document.getElementById('consignee2').focus();
		return;
	}
	
	if($('#consignee3').val()==''){
		alert('Ingrese PO Box/City & Country de Consignee');
		document.getElementById('consignee3').focus();
		return;
	}
	
	if($('#consignee4').val()==''){
		alert('Ingrese el RFC de Consignee');
		document.getElementById('consignee4').focus();
		
		return;
	}
	if($('#consignee5').val()==''){
		alert('Ingrese CTC de Consignee');
		document.getElementById('consignee5').focus();
		
		return;
	}
	if($('#consignee6').val()==''){
		alert('Ingrese el teléfono de Consignee');
		document.getElementById('consignee6').focus();
			
		return;
	}

 

	if($('#notify1').val()==''){
		alert('Ingrese el nombre de Notify');
		document.getElementById('notify1').focus();
			
		return;
	}
	
	if($('#notify2').val()==''){
		alert('Ingrese la dirección de Notify');
		document.getElementById('notify2').focus();
			
		return;
	}
	if($('#notify3').val()==''){
		alert('Ingrese PO Box/City & Country de Notify');
		document.getElementById('notify3').focus();
			
		return;
	}
	if($('#notify4').val()==''){
		alert('Ingrese el RFC de Notify');
		document.getElementById('notify4').focus();
			
		return;
	}
	if($('#notify5').val()==''){
		alert('Ingrese CTC de Notify');
		document.getElementById('notify5').focus();
			
		return;
	}
	if($('#notify6').val()==''){
		alert('Ingrese el teléfono de Notify');
		document.getElementById('notify6').focus();
		return;
	}

	
	var laDatos = valores_forma(document.forma);
		//if(confirm('Confirma el registro de este MASTER BL?')) {
		//loadin('','saving_bl','Wait');
		//alert($('#idE').val()); &h_id="+$('#h_id').val()+
		$.post( "guarda_bl2.php?id="+$('#id_bl').val()+"&email=<?=$_SESSION[email]?>",
				$(laDatos),
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});
		//}

}
</script>   

<style>
#dhtmltooltip{
position: absolute;
width: 150px;
border: 2px solid black;
padding: 2px;
background-color: lightyellow;
visibility: hidden;
z-index: 100;
/*Remove below line to remove shadow. Below line should always appear last within this CSS*/
filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
}
</style>
<div id="dhtmltooltip"></div>
<? include("tooltip.php");?>

<form id="forma" name="forma" action='avisos/index.php?referencia_cliente=<?=$_GET[referencia_cliente]?>&referencia=<?=$_GET[referencia]?>&booking=<?=$bookingno?>' >

<input type="hidden" id="email_2" name="email_2" value="<?=$_SESSION[email]?>" />
<span style="color:#00AF4B">&nbsp;Modificaci&oacute;n de BL &raquo;</span><br />
<table width="921" style="line-height:22px"  >
 
  <tr>
    <td colspan="2">
      
      <a onclick="Guardar()" style="color:#00AF4B;text-align:center;text-decoration:underline;">Guardar BL</a>&nbsp;&nbsp;&nbsp;&nbsp;
      
      <? if($_GET[bookingno]!=''){?>
            <a id="regresar" style="cursor:auto;color:#00AF4B;text-align:center;text-decoration:underline;" href="avisos/index.php?booking=<?=$bookingno?>">Regresar</a>
      <? }elseif($_GET[referencia]!=''){ ?>
      <a id="regresar" style="cursor:auto;color:#00AF4B;text-align:center;text-decoration:underline;" href="avisos/index.php?referencia=<?=$referencia?>">Regresar</a>
      <? }elseif($_GET[referencia_cliente]!=''){ ?>
      <a id="regresar" style="cursor:auto;color:#00AF4B;text-align:center;text-decoration:underline;" href="avisos/index.php?referencia_cliente=<?=$referencia_cliente?>">Regresar</a>
      <? } ?>
      
      <? if($_GET[bookingno]=='' and $_GET[referencia]=='' and $_GET[referencia_cliente]==''){?>
        <a id="regresar" style="cursor:auto;color:#00AF4B;text-align:center;text-decoration:underline;" href="avisos/index.php">Regresar</a>
      <? } ?>
      
    </tr>
  <tr>
    <td><b>DIMENSIONES</b></td>

    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><table width="348" border="1" id="dataTable">
      <tr align="center" style="font-size:12px">
        <td width="19"><div align="left"></div></td>
        <td width="51"><div align="left">N. bultos</div></td>
        <td width="45"><div align="left">Largo</div></td>
        <td width="73"><div align="left">Ancho</div></td>
        <td width="53"><div align="left">Alto</div></td>
        <td width="67"><div align="left">Volumen</div></td>
      </tr>
      
      <script>
	  function calculos(){
		  var tot=0;
		  for(k=0;k<10;k++){
			  if(document.getElementById('largo['+k+']')){
					  if(document.getElementById('largo['+k+']').value*1!=0 && 
					  document.getElementById('ancho['+k+']').value*1!=0 && 
					  document.getElementById('alto['+k+']').value*1!=0 && 
					  document.getElementById('numero_bultos['+k+']').value*1!=0){
						  
					  document.getElementById('volumen['+k+']').value=(document.getElementById('largo['+k+']').value*1/100)*
					  (document.getElementById('ancho['+k+']').value*1/100)*
					  (document.getElementById('alto['+k+']').value*1/100)*
					  document.getElementById('numero_bultos['+k+']').value*1;
					   
					  tot+=document.getElementById('volumen['+k+']').value*1;
					   document.getElementById('volumen['+k+']').value=fix(document.getElementById('volumen['+k+']').value,3);
					  }
			  }
		  }
		  document.getElementById('spanTotal').innerHTML=fix(tot,3);
			
	  }
	  </script>
      <tr>
        <td align="center"><div align="left">1</div></td>
        <td align="center"><div align="left">
          <input type="text" name="numero_bultos[0]" onblur="calculos()" style="text-align:right" id="numero_bultos[0]" size="5" value="<?=$numero_bultos[0]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="largo[0]" id="largo[0]" onblur="calculos()" size="5" style="text-align:right" value="<?=$largo[0]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="ancho[0]" id="ancho[0]" onblur="calculos()" size="5" style="text-align:right"value="<?=$ancho[0]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="alto[0]" id="alto[0]" onblur="calculos()" size="5" style="text-align:right" value="<?=$alto[0]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="volumen[0]" id="volumen[0]" size="5" style="text-align:right"  value="<?=$volumen[0]?>"/>
        </div></td>
      </tr>
      <tr>
        <td align="center"><div align="left">2</div></td>
        <td align="center"><div align="left">
          <input type="text" name="numero_bultos[1]" onblur="calculos()" id="numero_bultos[1]" style="text-align:right" size="5" value="<?=$numero_bultos[1]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="largo[1]" onblur="calculos()" id="largo[1]" size="5" style="text-align:right" value="<?=$largo[1]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="ancho[1]" onblur="calculos()" id="ancho[1]" size="5" style="text-align:right" value="<?=$ancho[1]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="alto[1]" onblur="calculos()" id="alto[1]" size="5" style="text-align:right"  value="<?=$alto[1]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="volumen[1]" id="volumen[1]" size="5"  style="text-align:right" value="<?=$volumen[1]?>"/>
        </div></td>
      </tr>
      <tr>
        <td align="center"><div align="left">3</div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="numero_bultos[2]" style="text-align:right" id="numero_bultos[2]" size="5" value="<?=$numero_bultos[2]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="largo[2]" id="largo[2]" style="text-align:right" size="5" value="<?=$largo[2]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="ancho[2]" id="ancho[2]" style="text-align:right" size="5" value="<?=$ancho[2]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="alto[2]" id="alto[2]" style="text-align:right" size="5"  value="<?=$alto[2]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="volumen[2]" id="volumen[2]"  size="5" style="text-align:right" value="<?=$volumen[2]?>"/>
        </div></td>
      </tr>
      <tr>
        <td align="center"><div align="left">4</div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="numero_bultos[3]" style="text-align:right" id="numero_bultos[3]" size="5" value="<?=$numero_bultos[3]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="largo[3]" style="text-align:right" id="largo[3]" size="5" value="<?=$largo[3]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="ancho[3]" style="text-align:right" id="ancho[3]" size="5" value="<?=$ancho[3]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" name="alto[3]" style="text-align:right" id="alto[3]" size="5"  value="<?=$alto[3]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" size="5" name="volumen[3]" id="volumen[3]" style="text-align:right" value="<?=$volumen[3]?>"/>
        </div></td>
      </tr>
      <tr>
        <td align="center"><div align="left">5</div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" style="text-align:right" name="numero_bultos[4]" id="numero_bultos[4]" size="5" value="<?=$numero_bultos[4]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" style="text-align:right" name="largo[4]" id="largo[4]" size="5" value="<?=$largo[4]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" style="text-align:right" name="ancho[4]" id="ancho[4]" size="5" value="<?=$ancho[4]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" onblur="calculos()" style="text-align:right" name="alto[4]" id="alto[4]" size="5"  value="<?=$alto[4]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="volumen[4]" id="volumen[4]" style="text-align:right" size="5"  value="<?=$volumen[4]?>"/>
        </div></td>
      </tr>
      
      
      <? if(count($numero_bultos)>5 ){ 
	  //echo 'cantidad '.count($numero_bultos);
	  $be=6;
	  for($q=5;$q<count($numero_bultos);$q++){
	  ?>
      <tr>
        <td align="center"><div align="left">
          <?=$be?>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="numero_bultos[<?=$q?>]" id="numero_bultos[<?=$q?>]" size="5" style="text-align:right"  value="<?=$numero_bultos[$q]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="largo[<?=$q?>]" id="largo[<?=$q?>]" size="5" style="text-align:right"  value="<?=$largo[$q]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="ancho[<?=$q?>]" id="ancho[<?=$q?>]" size="5" style="text-align:right"  value="<?=$ancho[$q]?>" />
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="alto[<?=$q?>]" id="alto[<?=$q?>]" size="5" style="text-align:right"   value="<?=$alto[$q]?>"/>
        </div></td>
        <td align="center"><div align="left">
          <input type="text" name="volumen[<?=$q?>]" id="volumen[<?=$q?>]"  style="text-align:right"  size="5"  value="<?=$volumen[$q]?>"/>
        </div></td>
      </tr>
     <? $be++; } } ?>
      
    </table>
      <br />
    VOLUMEN TOTAL: <span id="spanTotal"><?=number_format($total,3)?></span>
    </td>
    </tr>
 
  <tr>
    <td colspan="2">
    Ingrese el numero de bultos para poder guardar cada linea de dimensiones<br />
    <input type="button" class="" value="Agregar linea" onclick="addRow1('dataTable');" />
    
    </td>
  </tr>
  
  
   <? if($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') {?>
   <tr>
     <td colspan="2"><span style="color:green; font-style:italic">**Webservice Golmex** <?=$bl[ultimo_update_golmex]?></span></td>
   </tr>
   <? } ?>
  <tr>
    <td>ID BL</td>
    <td><input type="text" class="aa" name="id_bl" id="id_bl" size="40" value="<?=$bl[idhbl]?>"/></td>
  </tr>
   <tr>
    <td>TIPO BL</td>
    <td>
    <select name="tipo_bl" id="tipo_bl"  style="width:262PX" class="aa">
    <option value="" <?= $tipo_bl=='' ? 'selected="selected"' : ''?>>[Seleccionar]</option>
    <option value="MBL" <?= $tipo_bl=='MBL' ? 'selected="selected"' : ''?>>MBL</option>
    <option value="HBL" <?= $tipo_bl=='HBL' ? 'selected="selected"' : ''?>>HBL</option>
    </select>
    </td>
  </tr>
  <tr>
    <td width="226" id="t_nombre">BOOKING</td>
    <td width="683"><input type="text" class="aa" name="booking" id="booking" size="40" value="<?=$bl[booking]?>"/></td>
    
    </tr>
 
  <tr>
    <td width="226" id="t_nombre">REFERENCIA CLIENTE</td>
    <td><input type="text" class="aa" name="referencia" id="referencia" size="40" value="<?=$referencia_cliente=='' ? trim($bl1[referencia_interteam]) : trim($referencia_cliente)?>"/></td>
  </tr>
  
  <tr >
    <td id="t_nombre2">REFERENCIA PUERTO</td>
    <td>
 
    <input type="text" class="aa" name="referencia2" id="referencia2" size="40" value="<?=$referencia?>" /></td>
  </tr>
 
  <tr style="display:none">
    <td width="226" id="t_nombre">SHIPPER FILE </td>
    <td><input type="text" class="aa" name="shipper_file" id="shipper_file" size="40" value="<?=$referencia_cliente?>"/></td>
  </tr>
  <tr>
    <td >STATUS </td>
    <td ><input type="text" class="aa" name="status" id="status" size="40" readonly="readonly" value="<?=$bl[status]?>"/></td>
  </tr>
  <tr>
    <td>CAMBIAR STATUS </td>
    <td>
    <select name="status_cambiado" id="status_cambiado" style="width:262PX" class="aa">
    <option <?=$bl[status]=='' ? 'selected = "selected"' : ''?> value="">[Seleccionar]</option>
    <option <?=$bl[status]=='NUEVO' ? 'selected = "selected"' : ''?> value="NUEVO">NUEVO</option>
    <option <?=$bl[status]=='REVISANDO' ? 'selected = "selected"' : ''?> value="REVISANDO">REVISANDO</option>
    <option <?=$bl[status]=='OK' ? 'selected = "selected"' : ''?> value="OK">OK</option>
    <option <?=$bl[status]=='FUERA DE TIEMPO' ? 'selected = "selected"' : ''?> value="FUERA DE TIEMPO">FUERA DE TIEMPO</option>
    <option <?=$bl[status]=='ROLADO' ? 'selected = "selected"' : ''?> value="ROLADO">ROLADO</option>
    <option <?=$bl[status]=='CANCELADO' ? 'selected = "selected"' : ''?> value="CANCELADO">CANCELADO</option>
    </select>
    </td>
  </tr>
  
  <tr>
    <td >REGISTRADO POR</td>
    <td ><input type="text" class="aa" name="registrado_por" id="registrado_por" size="40" value="<?=$bl[registrado_por]?>" /></td>
  </tr>
  <!--<tr>
    <td>PEDIMENTO NO</td>
    <td><input type="text" class="aa" name="pedimento_no" id="pedimento_no" size="40" value="<?=$bl[pedimento_no]?>"  /></td>
  </tr>-->
    <tr>
     <td>CORREO AGENCIA ADUANAL</td>
     <td><input type="text" class="aa" name="correo_agencia_aduanal" id="correo_agencia_aduanal" size="40" value="<?=$bl[correo_agente_aduanal]?>" /></td>
   </tr>
   <tr>
    <td><a onclick='dhtmlwindow.open("ClientesBox", "iframe", "email_request_correccion.php?registrado_por=<?=$bl[registrado_por]?>&tipo_bl=<?=$tipo_bl?>&booking=<?=$bl[booking]?>&idbl=<?=$bl[idhbl]?>", "ENVIAR EMAIL AL AA, REQUEST DE CORRECCION", 
"left=0,top=0,width=950px,height=600px,resize=1,scrolling=1,center=0", "recal")' style="color:#009; text-decoration:underline">ENVIAR E-MAIL</a></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>VESSEL/VOYAGE</td>
    <td><input type="text" class="aa" name="vessel" id="vessel" size="40" disabled="disabled" value="<?=trim($bl1[vessel])=='' ? trim($viaje[vessel]) : trim($bl1[vessel]).' '.trim($bl1[voyage])  ?>"  /></td>
  </tr>
 
  <tr>
    <td>PORT OF LOADING</td>
    <td><input type="text" class="aa" name="pol" id="pol" size="40" disabled="disabled" value="VERACRUZ, VERACRUZ" /></td>
  </tr>
  <tr>
    <td>FINAL DESTINATION</td>
    <td><input type="text" class="aa" name="final_destination" id="final_destination" size="40" disabled="disabled" value="<?=$fd?>" /></td>
  </tr>
  <tr>
    <td>PORT OF DISCHARGE</td>
    <td><input type="text" class="aa" name="pod" id="pod" size="40" disabled="disabled" value="<?=$viaje[pod]=='' ? $bl1[pod].', '.$bl1[pod_country] : $viaje[pod].', '.$viaje[pod_country]?>" /></td>
  </tr>
  	
 
    
  <tr>
    <td >PEDIMENTO</td>
    <td ><input type="text" class="aa" name="pedimento" id="pedimento" size="40" value="<?=$bl[pedimento]?>" maxlength="100"/></td>
  </tr>
  <tr>
    <td >CONSECUTIVO</td>
    <td ><input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> name="tarja" id="tarja" size="40" value="<?=$bl[tarja]?>" /></td>
  </tr>
  <tr>
    <td  valign="top">TARJA RECEPCION</td>
    <td ><input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> name="tarja_recepcion" id="tarja_recepcion" size="40" value="<?=$bl[tarja_recepcion]?>"   /></td>
  </tr>
  
  
  <tr>
    <td  valign="top">TARJA AVERIA</td>
    <td ><input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> name="tarja_averia" id="tarja_averia" size="40" value="<?=$bl[tarja_averia]?>"  /></td>
  </tr>
  <tr>
    <td  valign="top">BULTOS AVERIADOS</td>
    <td ><input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> name="bultos_averiados" id="bultos_averiados" size="40" value="<?=$bl[bultos_averiados]?>"  /></td>
  </tr>
  <tr>
    <td  valign="top">TIPO DE AVERIA</td>
    <td ><input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> name="tipo_averia" id="tipo_averia" size="40" value="<?=$bl[tipo_averia]?>"  /></td>
  </tr>
  <tr>
    <td  valign="top">FECHA DE RECEPCION</td>
    <td ><input type="text" ondblclick="this.value=''" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> class="aa" name="fecha_recepcion" id="fecha_recepcion" size="40" value="<?=$bl[fecha_recepcion]?>"  onClick="displayCalendar(document.getElementById('fecha_recepcion'),'yyyy-mm-dd',this)" readonly="readonly" /></td>
  </tr>
  <tr>
    <td  valign="top">HORA REGISTRO INGRESO</td>
    <?
	$tmp=explode(':',$bl[hora_registro_ingreso]);
	$hora=$tmp[0];$minutos=$tmp[1];
	?>
    <td ><input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> onkeypress="if(this.value.length==2){document.getElementById('minutos').focus();}" name="hora" onMouseover="ddrivetip('Ingrese la hora en formato de 24 horas ','yellow', 330)" onMouseout="hideddrivetip()" id="hora" size="2" value="<?=$hora?>" maxlength="2"  />:<input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> name="minutos" id="minutos" size="2" value="<?=$minutos?>" maxlength="2"  /></td>
  </tr>
  <tr>
    <td  valign="top">FECHA DE CONSOLIDACION</td>
    <td ><input type="text" ondblclick="this.value=''" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> class="aa" name="fecha_salida" id="fecha_salida" size="40" value="<?=$bl[fecha_salida]?>"  onclick="displayCalendar(document.getElementById('fecha_salida'),'yyyy-mm-dd',this)" readonly="readonly" /></td>
  </tr>
  <tr>
    <td  valign="top">POSICION EN ALMACEN</td>
    <td ><input type="text" class="aa" <?=($bl[ultimo_update_golmex]!='0000-00-00 00:00:00' and $bl[ultimo_update_golmex]!='') ? 'style="border:1px solid green"' : ''?> name="posicion_almacen" id="posicion_almacen" size="40" value="<?=$bl[posicion_almacen]?>" /></td>
  </tr>
  <tr>
    <td  valign="top">COMENTARIOS</td>
    <td >
      <textarea cols="42" rows="5" id="comentarios" name="comentarios" class="aa"><?=$bl[comentarios]?></textarea>
      </td>
  </tr>
  <tr>
    <td colspan="2" >&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> 
    <? $q_embalajes = mysql_query("select * from embalajes order by nombre_embalaje");
	   ?>
       <select class="aa" name="type_of_bulks" id="type_of_bulks" />
       <option value=""></option>
       <?
	   while($rq_embalajes=mysql_fetch_array($q_embalajes)){
	   ?>
       <option value="<?=$rq_embalajes[nombre_embalaje]?>"><?=$rq_embalajes[nombre_embalaje]?></option>
       
       <? } ?>
       <option value="<?=$partida[type_of_bulks]?>" selected="selected"><?=$partida[type_of_bulks]?></option>
       </select>
    
    </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> 
      <textarea class="aa" name="description" id="description"   cols="45" rows="5"><?=$partida[cargo]?></textarea>
      
      </td>
  </tr>
  <tr>
    <td  valign="top">IMO</td>
    <td ><input type="text" class="aa" name="imo" id="imo" size="40" value="<?=$partida[imo]?>" onMouseover="ddrivetip('INGRESAR EL NUMERO DE IMO, SI SON VARIOS SEPARAR CON COMAS','yellow', 300)"
onMouseout="hideddrivetip()" /></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  valign="top">CORRECCIONES INDICADAS</td>
    <td ><textarea cols="42" rows="5" id="correcciones" name="correcciones" class="aa"><?=$partida[correcciones]?></textarea></td>
  </tr>
 
 </table>

<br />
  
</form>
 
