,CASE WHEN len(b.DESTINATIONID)!=5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(b.DESTINATIONID,2)) END as COUNTRY
,b.VESSEL,b.VOYNO,bl.CNTRTOTAL,b.BLTYPE,b.[SERVICE],b.ETD,b.ATD,(SELECT TOP 1 COMPTIME FROM op_status WHERE [STATUS]='Approached' AND BSNO=B.BSNO) LINKCUSTTIME
,(SELECT TOP 1 OpTime FROM op_SeaCover WHERE coverTitle='接单' AND BSNO=B.BSNO) CREATETIME
,(SELECT TOP 1 OpTime FROM op_SeaCover WHERE coverTitle='出号' AND BSNO=B.BSNO) MBLNOTIME
FROM op_seae_billmanage bl
LEFT JOIN op_seae b on (b.bsno=bl.BSNO)
WHERE MBLNO!='' AND ETD>=GETDATE()-7 AND ETD<=GETDATE()+7
,CASE WHEN len(b.DESTINATIONID)!=5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(b.DESTINATIONID,2)) END as COUNTRY