|
|
|
|
SELECT M.[id],M.[ContractNo],[HTH],[seller],[company],comp.name as companyname,[buyer],[STT], M.[countryid],[creator],[Auditor],[MainState],[printed],[AutoAPP],[ShipCompany_id], [BillNo] ,[BillType],[Vessel],[Voyage], ci.code as cicode,ci.name as ciname, case [BillTime] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(12) , [BillTime],23) end as BillTime, case [Ex_sailingdate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(12) , [Ex_sailingdate],23) end as Ex_sailingdate, case [Sailingdate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(12) , [Sailingdate],23) end as Sailingdate , case [ArrivalDate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar , [ArrivalDate],120) end as ArrivalDate ,[ContainerNo],[SealNo],[TransactionMethod],[PaymentMethods] ,[SecurityDeposit], case [CustomsReleaseDate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar ,[CustomsReleaseDate],120) end as CustomsReleaseDate, case [SamplingDate_Plan] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar ,[SamplingDate_Plan],120) end as SamplingDate_Plan, case [SamplingDate_Act] when '1900-01-01' then '' else CONVERT(varchar ,[SamplingDate_Act],120) end as SamplingDate_Act,case [inspection_Signup_date] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar ,[inspection_Signup_date],120) end as inspection_Signup_date ,[inspection_no], case [inspection_date] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar ,[inspection_date],120) end as inspection_date ,cg.id as cgid ,cg.name,c.countryid,c.country, convert(bigint ,M.TimeMark) as TimeMark , case [creattime] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(12) , [creattime],120) end as creattime , case [Audittime] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(12) , [Audittime],120) end as Audittime , Freetime,CIQ_licence,CIQ_canbesearch, case [tax_date] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(12) , [tax_date],23) end as tax_date , case [tax_paydate] when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(12) , [tax_paydate],23) end as tax_paydate , (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=3 and EnumValueID=M.MainState) as MainStateRef, (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef, M.port, M.remark FROM [dbo].[Import_main] M left join code_country c on m.countryid=c.countryid left join import_cargo cg on cg.contractno=M.contractno left join import_cargoinfo ci on ci.id=cg.cargoinfo_id left join company comp on comp.gid=M.company where m.id='1'
|