<?
require_once("../comun/conex_ver.php");
require_once("../comun/conexion3.php");

//require_once("../comun/funciones.php")
function valorate($valor){
	$valor = trim(str_replace("'","\'",$valor));
	return $valor;
}



$booking = $_GET[booking];
con_impo();
$qry3=mysql_query("select booking_interteam from booking_canceled where booking_interteam='".$booking."'");
$cancelado=0;	
if(mysql_num_rows($qry3)>0){
$cancelado=1;	
}
con_ver();
//echo 'booking 0.'.$booking ;
$query=mysql_query("select * from detailcargaexpint where `bookingno` = '".$booking."' and id_bl in (select idhbl from hblexpint where registrado_por = '".$_GET[registrado_por]."' or registrado_por = '".strtoupper($_GET[registrado_por])."' or registrado_por = '".strtolower($_GET[registrado_por])."' ) ORDER BY id,tipo_bl");

 
if(mysql_num_rows($query)==0 or trim($booking)=='') return;
//echo "select * from detailcargaexpint where `bookingno` = '".$booking."' ORDER BY tipo_bl,id";

?>
<br />
<? //echo 'BOOKING: '.$booking;?>
<table class="cargas" width="150%">
  <tr>
  <TD>ID</TD>
  <td>Booking</td>
  <td><div style="width:140px">Fecha y hora de registro</div></td>
    <td>Status</td>
    <td><div style="width:140px">Fecha y hora de revisión</div></td>
    <td style="display:none">Art&iacute;culo 23 </td>
 
    <td><?=$cancelado==1 ? 'No disponible' : 'Modificar'?> </td>
    <td><?=$cancelado==1 ? 'No disponible' : 'Borrar'?></td>
    <td>Imprimir BL</td>
    <td>Marks</td>
    <td>Contenedor</td>
    <td>Dim</td>
    <td>Tipo</td>
  </tr>
  

   <? while($row=mysql_fetch_array($query)){
	   $qry = mysql_query("select * from hblexpint where idhbl = '".$row[id_bl]."'");
	   //echo "select * from hblexpint where idhbl = '".$row[id_bl]."'";
	   $rQ=mysql_fetch_array($qry);
	   $fechaRegistro=$rQ[fechaRegistro]; 
	   $fecha_revision=$rQ[fecha_revision]; 
				
	   $referencia_cliente = $rQ[referencia];
 	$comentarios=$rQ[comentarios];
	   if(mysql_num_rows($qry)>0){
			if($referencia_cliente==''){
				$referencia_cliente_ = mysql_query("select referencia_cliente from booking_ssl where booking_ssl = '".$booking."'"); 
				$ref_cliente = mysql_fetch_array($referencia_cliente_);
				$referencia_cliente = $ref_cliente[0];
 
	 	    }
	   }
	   
	      /* 20.7 datos del contenedor */
	    $qryContenedor = mysql_query("select * from datosbooking where referencia_cliente = '".$referencia_cliente."' and referencia_cliente<>''");
		$rqryContenedor=mysql_fetch_array($qryContenedor);
		$tipoContenedor=$rqryContenedor[tipo];
		$dimensionContenedor=$rqryContenedor[dimension];
		$numeroContenedor=$rqryContenedor[contenedor];
		/* fin 20.7 */
	
	$correo_agente_aduanal=$rQ[correo_agente_aduanal];	
	   $shipper=$rQ[shipper];$shipper2=$rQ[shipper2];$shipper3=$rQ[shipper3];$shipper4=$rQ[shipper4];$shipper5=$rQ[shipper5];$shipper6=$rQ[shipper6];
	   $consignee=$rQ[consignee];$consignee2=$rQ[consignee2];$consignee3=$rQ[consignee3];$consignee4=$rQ[consignee4];$consignee5=$rQ[consignee5];$consignee6=$rQ[consignee6];
	   $notify=$rQ[notify];$notify2=$rQ[notify2];$notify4=$rQ[notify4];$notify3=$rQ[notify3];$notify5=$rQ[notify5];$notify6=$rQ[notify6];
	   $referencia = $rQ[referencia];
	   //echo $shipper;
	   $finaldestination = $rQ[finaldestination];
	   $export_reference = $rQ[export_reference];
	   
	   $status=$rQ[status];//$registrado_por=$rQ[registrado_por];
	   
	   $tarja=$rQ[tarja];
	   	      $pedimento=$rQ[pedimento];
	   $cargo_vacio = $rQ[cargo_vacio];
	    $ID = $rQ[idhbl];
		$reg_por_hbl=$rQ[registrado_por];
		
		$descripcion_espanol_articulo_23=$rQ[descripcion_espanol_articulo_23];  
		$tipo_mercancia_articulo_23= $rQ['tipo_mercancia_articulo_23'];
		$regimen_articulo_23=$rQ['regimen_articulo_23'];
		$factura_articulo_23 = $rQ['factura_articulo_23'];
		$imo_articulo_23 = $rQ['imo_articulo_23'];
		$un_articulo_23 = $rQ['un_articulo_23'];
		$transportista_articulo_23=$rQ['transportista_articulo_23'];
		$nombre_del_chofer_articulo_23= $rQ['nombre_del_chofer_articulo_23'];
		$no_licencia_articulo_23=$rQ['no_licencia_articulo_23'];
		$placas_articulo_23 = $rQ['placas_articulo_23'];
		$economico_articulo_23 = $rQ['economico_articulo_23'];
		
	   // DATOS DEL MBL
	   
$qry1 = mysql_query("select * from hblexpint where booking = '".$booking."' and tipo = 'MBL'");
	   $rQ1=mysql_fetch_array($qry1);
	   $correo_agente_aduanalM=$rQ1[correo_agente_aduanal];
	    $shipperM=$rQ1[shipper];$shipper2M=$rQ1[shipper2];$shipper3M=$rQ1[shipper3];$shipper4M=$rQ1[shipper4];$shipper5M=$rQ1[shipper5];$shipper6M=$rQ1[shipper6];
	   $consigneeM=$rQ1[consignee];$consignee2M=$rQ1[consignee2];$consignee3M=$rQ1[consignee3];$consignee4M=$rQ1[consignee4];$consignee5M=$rQ1[consignee5];$consignee6M=$rQ1[consignee6];
	   $notifyM=$rQ1[notify];$notify2M=$rQ1[notify2];$notify4M=$rQ1[notify4];$notify3M=$rQ1[notify3];$notify5M=$rQ1[notify5];$notify6M=$rQ1[notify6];
	   $statusM=$rQ1[status];//$registrado_porM=$rQ1[registrado_por];
	   $idhblM=$rQ1[idhbl]; 
	   $finaldestinationM = $rQ1[finaldestination]; 
	   $export_referenceM = $rQ1[export_reference]; 
	   $reg_por_mbl=$rQ1[registrado_por];
	   
	   $cargo_vacioM = $rQ1[cargo_vacio];
	   
	   $qry2 = mysql_query("select * from detailcargaexpint where id_bl ='".$idhblM."'");
	   $rQ2=mysql_fetch_array($qry2);
	   
	   if(mysql_num_rows($qry2)>0){
		    $correccionesM=$rQ2[correcciones];
			   $marksM=$rQ2[markandnos];
			   $quantityM=$rQ2[bulk];
			   $descriptionM=$rQ2[cargo];
			   $number_of_piecesM=$rQ2[number_of_pieces];
			   $weightM=$rQ2[weight];
			   $netweightM=$rQ2[netweight];
			   $measurementM=$rQ2[measurement];
			   $harmonized_codeM=$rQ2[harmonized_code];
			   $amsM=$rQ2[ams];
		  
			   $idEM=$rQ2[id_bl];
			   $type_of_bulksM=$rQ2[type_of_bulks];
			   $tratamiento_maderaM=$rQ2[tratamiento_madera];
			   $referenciaM=$rQ2[referencia];
			   $bookingnoM=$rQ2[bookingno];
			   
 
				$descripcion_espanol_articulo_23M=$rQ1[descripcion_espanol_articulo_23];  
				$tipo_mercancia_articulo_23M= $rQ1['tipo_mercancia_articulo_23'];
				$regimen_articulo_23M=$rQ1['regimen_articulo_23'];
				$factura_articulo_23M = $rQ1['factura_articulo_23'];
				$imo_articulo_23M = $rQ1['imo_articulo_23'];
				$un_articulo_23M = $rQ1['un_articulo_23'];
				$transportista_articulo_23M=$rQ1['transportista_articulo_23'];
				$nombre_del_chofer_articulo_23M= $rQ1['nombre_del_chofer_articulo_23'];
				$no_licencia_articulo_23M=$rQ1['no_licencia_articulo_23'];
				$placas_articulo_23M = $rQ1['placas_articulo_23'];
				$economico_articulo_23M = $rQ1['economico_articulo_23'];

	   }
//echo 'cargo vacio '.$cargo_vacio.' cargo vacio M '.$cargo_vacioM;
	
	   ?>
   <tr <? //= $row[tipo_bl]=='MBL' ? 'style="color:#F30"':''?>>
     <TD><?=$ID?></TD>
     <TD <?= $cancelado==1 ? 'style="text-decoration:line-through"' : ''?>><?=$booking?></TD>
     <TD><?=$fechaRegistro?></TD>
     <TD> 
	 <?  if($cancelado==1){ 
 
	  echo 'Cancelado';
	 }else{
		 if($status=='OK'){ 
	 	 echo 'Aceptado';
		 }
		 if($status=='REVISANDO' or $status=='REVISION PENDIENTE' or $status=='NUEVO'){ 
		 echo 'Revisando';
		 }
		 if($status=='FUERA DE TIEMPO'){ 
 
		  echo 'Fuera de tiempo';
		 }
	}
	 $status1=$status;
	 ?>

     </TD>
     <td><?=$fecha_revision?></td>
     <td style="display:none"> <a target="_blank" href="../pdf/articulo23_agente_aduanal.php?referencia_cliente=<?=$referencia_cliente?>&booking=<?=$row[bookingno]?>&idhbl=<?=$row[id_bl]?>" style="color:#00AF4B; text-decoration:underline; cursor:pointer;" title="Exportar a PDF" id="pdf">No disponible aun</a> </td>
  
    <TD <?= $cancelado==1 ? 'style="visibility:hidden"' : 'style="visibility:visible"'?> > 
    <? if( (strlen(trim($pedimento))==0 or strlen(trim($pedimento))<6 and ($status == 'OK' or $status == 'REVISANDO')) or $status == 'REVISION PENDIENTE' or $status = 'REVISANDO') {  ?>
<div id="esc<?=$row[id_bl]?>" style="display:none"><?=$row["cargo"]?></div>
<div id="esc1<?=$row[id_bl]?>" style="display:none"><?=$descriptionM?></div>
<div id="cor1<?=$row[id_bl]?>" style="display:none"><?=$correccionesM?></div> 
<div id="cor<?=$row[id_bl]?>" style="display:none"><?=$row["correcciones"]?></div> 
    



<? if(strlen(trim($pedimento))>=6 and strlen(trim($pedimento))!=0) { 
	
			if($status1=='OK' or  $status1=='FUERA DE TIEMPO'){ ?>
			No puede editarse
			<? } ?>
	
	<? }else{ ?>
    <img title="Modificar BL" onclick="
    <? if($row[tipo_bl]=='HBL') { 
	 
	?>
 
   document.getElementById('h_marks').value='<?=valorate($row[markandnos])?>';
    document.getElementById('h_quantity').value='<?=valorate($row[bulk])?>';
 
    $('#h_description').val(document.getElementById('esc<?=$row[id_bl]?>').innerHTML);
    $('#h_correcciones').val(document.getElementById('cor<?=$row[id_bl]?>').innerHTML);
    document.getElementById('h_status').value='<?=valorate($status)?>';
    document.getElementById('h_no_piezas').value='<?=valorate($row[number_of_pieces])?>';
    document.getElementById('h_gross_weight').value='<?=valorate($row[weight])?>';
    document.getElementById('h_net_weight').value='<?=valorate($row[netweight])?>';
    document.getElementById('h_volume').value='<?=valorate($row[measurement])?>';
    document.getElementById('h_harmonized_code').value='<?=valorate($row[harmonized_code])?>';
      
    document.getElementById('h_ams').value='<?=valorate($row[ams])?>';
    document.getElementById('h_id').value='<?=valorate($row[id])?>';
    document.getElementById('h_booking').value='<?=valorate($row[bookingno])?>';
    document.getElementById('h_referencia').value='<?=valorate($referencia)?>';
    document.getElementById('h_type_of_bulks').value='<?=valorate($row[type_of_bulks])?>';
    document.getElementById('h_tratamiento_madera').value='<?=valorate($row[tratamiento_madera])?>';
  document.getElementById('h_final_destination').value='<?=valorate($finaldestination)?>';
  document.getElementById('h_export_reference').value='<?=valorate($export_reference)?>';
  
  document.getElementById('h_correo_agente_aduanal').value='<?=valorate($correo_agente_aduanal)?>';
    document.getElementById('h_shipper1').value='<?=valorate($shipper)?>';
    document.getElementById('h_shipper2').value='<?=valorate($shipper2)?>';
    document.getElementById('h_shipper3').value='<?=valorate($shipper3)?>';
    document.getElementById('h_shipper4').value='<?=valorate($shipper4)?>';
    document.getElementById('h_shipper5').value='<?=valorate($shipper5)?>';
    document.getElementById('h_shipper6').value='<?=valorate($shipper6)?>';
    
    document.getElementById('h_consignee1').value='<?=valorate($consignee)?>';
    document.getElementById('h_consignee2').value='<?=valorate($consignee2)?>';
    document.getElementById('h_consignee3').value='<?=valorate($consignee3)?>';
    document.getElementById('h_consignee4').value='<?=valorate($consignee4)?>';
    document.getElementById('h_consignee5').value='<?=valorate($consignee5)?>';
    document.getElementById('h_consignee6').value='<?=valorate($consignee6)?>';
    
    document.getElementById('h_notify1').value='<?=valorate($notify)?>';
    document.getElementById('h_notify2').value='<?=valorate($notify2)?>';
    document.getElementById('h_notify3').value='<?=valorate($notify3)?>';
    document.getElementById('h_notify4').value='<?=valorate($notify4)?>';
    document.getElementById('h_notify5').value='<?=valorate($notify5)?>';
    document.getElementById('h_notify6').value='<?=valorate($notify6)?>';
    
    document.getElementById('hdescripcion_espanol_articulo_23').value='<?=valorate($descripcion_espanol_articulo_23)?>';
    document.getElementById('htipo_mercancia_articulo_23').value='<?=valorate($tipo_mercancia_articulo_23)?>';
    document.getElementById('hregimen_articulo_23').value='<?=valorate($regimen_articulo_23)?>';
    document.getElementById('hfactura_articulo_23').value='<?=valorate($factura_articulo_23)?>';
    document.getElementById('himo_articulo_23').value='<?=valorate($imo_articulo_23)?>';
    document.getElementById('hun_articulo_23').value='<?=valorate($un_articulo_23)?>';
    document.getElementById('htransportista_articulo_23').value='<?=valorate($transportista_articulo_23)?>';
    document.getElementById('hnombre_del_chofer_articulo_23').value='<?=valorate($nombre_del_chofer_articulo_23)?>';
    document.getElementById('hno_licencia_articulo_23').value='<?=valorate($no_licencia_articulo_23)?>';
    document.getElementById('hplacas_articulo_23').value='<?=valorate($placas_articulo_23)?>';
    document.getElementById('heconomico_articulo_23').value='<?=valorate($economico_articulo_23)?>';

        
        
    limpiar_mbl();
    document.getElementById('status').value='<?=valorate($statusM)?>';
    document.getElementById('cargo_vacio').checked='<?=($cargo_vacioM == 0 ? false : true)?>';
      
    document.getElementById('marks').value='<?=valorate($marksM)?>';
    document.getElementById('quantity').value='<?=valorate($quantityM)?>';
     $('#description').val(document.getElementById('esc1<?=$row[id_bl]?>').innerHTML);
   $('#correcciones').val(document.getElementById('cor1<?=$row[id_bl]?>').innerHTML); 
    document.getElementById('no_piezas').value='<?=valorate($number_of_piecesM)?>';
    document.getElementById('gross_weight').value='<?=valorate($weightM)?>';
    document.getElementById('net_weight').value='<?=valorate($netweightM)?>';
    document.getElementById('volume').value='<?=valorate($measurementM)?>';
    document.getElementById('harmonized_code').value='<?=valorate($harmonized_codeM)?>';
    document.getElementById('ams').value='<?=valorate($amsM)?>';
    document.getElementById('idE').value='<?=valorate($idEM)?>';
   
    document.getElementById('h_booking').value='<?=valorate($row[bookingno])?>';
    
    document.getElementById('final_destination').value='<?=valorate($finaldestinationM)?>';
    document.getElementById('export_reference').value='<?=valorate($export_referenceM)?>';
    document.getElementById('referencia').value='<?=valorate($referenciaM)?>';
    document.getElementById('type_of_bulks').value='<?=valorate($type_of_bulksM)?>';
    document.getElementById('tratamiento_madera').value='<?=valorate($tratamiento_maderaM)?>';   

 	document.getElementById('correo_agente_aduanal').value='<?=valorate($correo_agente_aduanalM)?>';
    document.getElementById('shipper1').value='<?=valorate($shipperM)?>';
    document.getElementById('shipper2').value='<?=valorate($shipper2M)?>';
    document.getElementById('shipper3').value='<?=valorate($shipper3M)?>';
    document.getElementById('shipper4').value='<?=valorate($shipper4M)?>';
    document.getElementById('shipper5').value='<?=valorate($shipper5M)?>';
    document.getElementById('shipper6').value='<?=valorate($shipper6M)?>';
    
    document.getElementById('consignee1').value='<?=valorate($consigneeM)?>';
    document.getElementById('consignee2').value='<?=valorate($consignee2M)?>';
    document.getElementById('consignee3').value='<?=valorate($consignee3M)?>';
    document.getElementById('consignee4').value='<?=valorate($consignee4M)?>';
    document.getElementById('consignee5').value='<?=valorate($consignee5M)?>';
    document.getElementById('consignee6').value='<?=valorate($consignee6M)?>';
    
    document.getElementById('notify1').value='<?=valorate($notifyM)?>';
    document.getElementById('notify2').value='<?=valorate($notify2M)?>';
    document.getElementById('notify3').value='<?=valorate($notify3M)?>';
    document.getElementById('notify4').value='<?=valorate($notify4M)?>';
    document.getElementById('notify5').value='<?=valorate($notify5M)?>';
    document.getElementById('notify6').value='<?=valorate($notify6M)?>';
    
    document.getElementById('descripcion_espanol_articulo_23').value='<?=valorate($descripcion_espanol_articulo_23M)?>';
    document.getElementById('tipo_mercancia_articulo_23').value='<?=valorate($tipo_mercancia_articulo_23M)?>';
    document.getElementById('regimen_articulo_23').value='<?=valorate($regimen_articulo_23M)?>';
    document.getElementById('factura_articulo_23').value='<?=valorate($factura_articulo_23M)?>';
    document.getElementById('imo_articulo_23').value='<?=valorate($imo_articulo_23M)?>';
    document.getElementById('un_articulo_23').value='<?=valorate($un_articulo_23M)?>';
    document.getElementById('transportista_articulo_23').value='<?=valorate($transportista_articulo_23M)?>';
    document.getElementById('nombre_del_chofer_articulo_23').value='<?=valorate($nombre_del_chofer_articulo_23M)?>';
    document.getElementById('no_licencia_articulo_23').value='<?=valorate($no_licencia_articulo_23M)?>';
    document.getElementById('placas_articulo_23').value='<?=valorate($placas_articulo_23M)?>';
    document.getElementById('economico_articulo_23').value='<?=valorate($economico_articulo_23M)?>';
    
   
    parent.document.location='#hbl'


    
    
    <? } elseif($row[tipo_bl]=='MBL') { ?>
    document.getElementById('status').value='<?=valorate($status)?>';
     
    document.getElementById('marks').value='<?=valorate($row[markandnos])?>';
    document.getElementById('quantity').value='<?=valorate($row[bulk])?>';
     
      $('#description').val(document.getElementById('esc1<?=$row[id_bl]?>').innerHTML);
      $('#correcciones').val(document.getElementById('cor1<?=$row[id_bl]?>').innerHTML);
    document.getElementById('no_piezas').value='<?=valorate($row[number_of_pieces])?>';
    document.getElementById('gross_weight').value='<?=valorate($row[weight])?>';
    document.getElementById('net_weight').value='<?=valorate($row[netweight])?>';
    document.getElementById('volume').value='<?=valorate($row[measurement])?>';
    document.getElementById('harmonized_code').value='<?=valorate($row[harmonized_code])?>';
    document.getElementById('ams').value='<?=valorate($row[ams])?>';
    document.getElementById('idE').value='<?=valorate($row[id_bl])?>';
    document.getElementById('booking').value='<?=valorate($row[bookingno])?>';
    
    document.getElementById('referencia').value='<?=valorate($referencia)?>';
    document.getElementById('type_of_bulks').value='<?=valorate($row[type_of_bulks])?>';
       document.getElementById('tratamiento_madera').value='<?=valorate($row[tratamiento_madera])?>';
    document.getElementById('cargo_vacio').checked='<?=($cargo_vacio == 0 ? false : true)?>';
    
    document.getElementById('final_destination').value='<?=valorate($finaldestination)?>';  
    document.getElementById('h_final_destination').value='<?=valorate($finaldestination)?>';     
    document.getElementById('h_export_reference').value='<?=valorate($export_reference)?>';
    document.getElementById('export_reference').value='<?=valorate($export_reference)?>';
    
    document.getElementById('correo_agente_aduanal').value='<?=valorate($correo_agente_aduanal)?>';
    document.getElementById('shipper1').value='<?=valorate($shipper)?>';
    document.getElementById('shipper2').value='<?=valorate($shipper2)?>';
    document.getElementById('shipper3').value='<?=valorate($shipper3)?>';
    document.getElementById('shipper4').value='<?=valorate($shipper4)?>';
    document.getElementById('shipper5').value='<?=valorate($shipper5)?>';
    document.getElementById('shipper6').value='<?=valorate($shipper6)?>';
    
    document.getElementById('consignee1').value='<?=valorate($consignee)?>';
    document.getElementById('consignee2').value='<?=valorate($consignee2)?>';
    document.getElementById('consignee3').value='<?=valorate($consignee3)?>';
    document.getElementById('consignee4').value='<?=valorate($consignee4)?>';
    document.getElementById('consignee5').value='<?=valorate($consignee5)?>';
    document.getElementById('consignee6').value='<?=valorate($consignee6)?>';
    
    document.getElementById('notify1').value='<?=valorate($notify)?>';
    document.getElementById('notify2').value='<?=valorate($notify2)?>';
    document.getElementById('notify3').value='<?=valorate($notify3)?>';
    document.getElementById('notify4').value='<?=valorate($notify4)?>';
    document.getElementById('notify5').value='<?=valorate($notify5)?>';
    document.getElementById('notify6').value='<?=valorate($notify6)?>';
    
    document.getElementById('descripcion_espanol_articulo_23').value='<?=valorate($descripcion_espanol_articulo_23M)?>';
    document.getElementById('tipo_mercancia_articulo_23').value='<?=valorate($tipo_mercancia_articulo_23M)?>';
    document.getElementById('regimen_articulo_23').value='<?=valorate($regimen_articulo_23M)?>';
    document.getElementById('factura_articulo_23').value='<?=valorate($factura_articulo_23M)?>';
    document.getElementById('imo_articulo_23').value='<?=valorate($imo_articulo_23M)?>';
    document.getElementById('un_articulo_23').value='<?=valorate($un_articulo_23M)?>';
    document.getElementById('transportista_articulo_23').value='<?=valorate($transportista_articulo_23M)?>';
    document.getElementById('nombre_del_chofer_articulo_23').value='<?=valorate($nombre_del_chofer_articulo_23M)?>';
    document.getElementById('no_licencia_articulo_23').value='<?=valorate($no_licencia_articulo_23M)?>';
    document.getElementById('placas_articulo_23').value='<?=valorate($placas_articulo_23M)?>';
    document.getElementById('economico_articulo_23').value='<?=valorate($economico_articulo_23M)?>';
    limpiar_hbl();
    parent.document.location='#mbl'
    <? } ?>" src="cambio.png" border="0" style="cursor:pointer" />
    
    <? }  ?>
   <? } ?>
    </TD>
    <td <?= $cancelado==1 ? 'style="visibility:hidden"' : 'style="visibility:visible"'?>>
    <? if($status1!='OK'){?>
            <img title="Borrar BL" onclick="
            <? if($row[tipo_bl]=='HBL') { ?>
            if(confirm('Borra este House BL?')){ 
            borrar_hbl('<?=$row[id]?>','<?=$row[bookingno]?>','<?=$row[id_bl]?>');
            }
            <? } elseif($row[tipo_bl]=='MBL') { ?>
            if(confirm('Borra este Master BL?')){ 
             borrar_mbl('<?=$row[id]?>','<?=$row[bookingno]?>','<?=$row[id_bl]?>');
            //borrar_mbl('<?=$row[bookingno]?>');
            }
            <? } ?>" src="eliminar.png" border="0" style="cursor:pointer" /> 
    <? }elseif($status1=='OK' ){?>
    <span>No puede borrarse</span>
    <? } ?>
    </td>
    
    
    <TD align="left"> 
    <? if($status1=='OK'){ ?>
	 <? if($row[tipo_bl]=='MBL'){ ?>
     			 <a  target="_blank" href="../pdf/mbl.php?booking=<?=base64_encode($row[bookingno])?>&idhbl=<?=base64_encode($row[id_bl])?>" style="color:#00AF4B; text-decoration:underline; cursor:pointer;" title="Exportar a PDF" id="pdf">Recibase MBL</a> 
     <? } ?>
	  
	 <? if($row[tipo_bl]=='HBL'){ ?>
     			<a target="_blank" href="../pdf/hbl.php?booking=<?=base64_encode($row[bookingno])?>&idhbl=<?=base64_encode($row[id_bl])?>" style="color:#00AF4B; text-decoration:underline; cursor:pointer;" title="Exportar a PDF" id="pdf">Recibase HBL</a> 
     <? } ?>

    <? }else{ ?>
    <?=($comentarios=='' ? ucwords(strtolower($status1)):$comentarios)?>
	  <? } ?>
    </TD>
    
     
    <td style="text-align:left"><?=$row[markandnos]?></td>
    <td style="text-align:left"><?=$status=='OK' ? $numeroContenedor : ''?></td>
    <td style="text-align:left"><?=$status=='OK' ? $dimensionContenedor : ''?></td>
    <td style="text-align:left"><?=$status=='OK' ? $tipoContenedor : ''?></td>
  </tr>

  <? } ?>  
  </table>
<br />