|
|
|
|
/****** Object: Table [dbo].[Import_approval] Script Date: 09/02/2013 09:57:33 ******/
|
|
|
|
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Import_approval]') AND type in (N'U'))
|
|
|
|
|
DROP TABLE [dbo].[Import_approval]
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
/****** Object: Table [dbo].[Import_approval] Script Date: 09/02/2013 09:57:33 ******/
|
|
|
|
|
SET ANSI_NULLS ON
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
SET QUOTED_IDENTIFIER ON
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
SET ANSI_PADDING ON
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE TABLE [dbo].[Import_approval](
|
|
|
|
|
[id] [int] IDENTITY(1,1) NOT NULL,
|
|
|
|
|
[AppNo] [varchar](50) NOT NULL,
|
|
|
|
|
[SQDH] [varchar](50) NOT NULL,
|
|
|
|
|
[SLJG] tinyint null,
|
|
|
|
|
[Cargoinfo_id] int null,
|
|
|
|
|
[Cargociq_id] int null,
|
|
|
|
|
[Countryid] [varchar](50) NULL,
|
|
|
|
|
[weight] [numeric](18, 6) NULL,
|
|
|
|
|
[ValidDate] [varchar](50) NULL,
|
|
|
|
|
[depot] [varchar](50) NULL,
|
|
|
|
|
[company] [varchar](50) NULL,
|
|
|
|
|
[ISDELETED] tinyint default 0,
|
|
|
|
|
[gid] [varchar](50) not null,
|
|
|
|
|
CONSTRAINT [PK_Import_Approval] PRIMARY KEY CLUSTERED
|
|
|
|
|
(
|
|
|
|
|
[id] ASC
|
|
|
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
|
|
|
) ON [PRIMARY]
|
|
|
|
|
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
SET ANSI_PADDING OFF
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
insert into [Import_approval] values
|
|
|
|
|
('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>01','0',0,1,1,'GB',500.00,'2013-10-01','<EFBFBD>ֿ<EFBFBD>1','Comcab2d43f60454327af30a131fc1d3abd',0)
|
|
|
|
|
insert into [Import_approval] values
|
|
|
|
|
('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>02','1',1,4,1,'GB',300.00,'2013-11-01','<EFBFBD>ֿ<EFBFBD>2','Comcab2d43f60454327af30a131fc1d3abd',0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
----<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>б<EFBFBD>
|
|
|
|
|
SELECT a.*,cp.name companyname,
|
|
|
|
|
c.country,u.used,u.selected, u.remain,u.canbeused ,
|
|
|
|
|
ci.code,ci.name,ciq.ciqcode,ciq.ciqname,
|
|
|
|
|
(select EnumValueName from tSysEnumValue
|
|
|
|
|
where LangId=0 and EnumTypeID=10 and EnumValueID=a.SLJG) as portRef,
|
|
|
|
|
(select EnumValueName from tSysEnumValue
|
|
|
|
|
where LangId=0 and EnumTypeID=0 and EnumValueID=a.isdeleted) as isdeletedRef
|
|
|
|
|
FROM [ShippingWeb].[dbo].[Import_approval] a
|
|
|
|
|
left join import_cargoinfo ci on ci.id=a.cargoinfo_id
|
|
|
|
|
left join code_country c on a.[Countryid]=c.[Countryid]
|
|
|
|
|
left join vMsAppUsed U on U.[app_id]=a.[id]
|
|
|
|
|
left join import_cargociq ciq on ciq.id=a.cargociq_id
|
|
|
|
|
left join company cp on cp.gid=a.company
|
|
|
|
|
|
|
|
|
|
----<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
select st.[weight],
|
|
|
|
|
(select EnumValueName from tSysEnumValue
|
|
|
|
|
where LangId=0 and EnumTypeID=13 and EnumValueID=st.cancellation) as cancellationRef,
|
|
|
|
|
c.contractno,m.seller,m.buyer,
|
|
|
|
|
ci.code,ci.name,ciq.ciqcode,ciq.ciqname,c.name cargoname
|
|
|
|
|
from import_appstate st
|
|
|
|
|
left join import_cargo c on c.id=st.cargo_id
|
|
|
|
|
left join Import_main m on m.contractno=c.contractno
|
|
|
|
|
left join import_cargoinfo ci on ci.id = c.cargoinfo_id
|
|
|
|
|
left join import_cargociq ciq on ciq.id = c.cargociq_id
|
|
|
|
|
|
|
|
|
|
select * from import_appstate
|