You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/word/新协航_设计文档/数据库建表文档/1.0/枚举类型设置及部分视图.sql

232 lines
10 KiB
SQL

select m.seller,m.buyer,m.contractno,m.id as mainid,cg.id ,
cg.name,c.country_code,c.country ,M.billno,M.ContainerNo,M.SealNo,M.ContractAmount
from import_main M
left join import_country c on m.country_id=c.id
left join import_cargo cg on cg.contract_id=M.id
left join import_cargoinfo ci on ci.id=cg.cargoinfo_id
select distinct seller from import_main
-----------建表时------------
select * from tSysEnumtype
select * from tSysEnumvalue
/*
delete from tSysEnumtype where langid=8
delete from tSysEnumValue where langid=8
delete from tSysEnumtype where enumtypeid=8
delete from tSysEnumValue where enumtypeid=8
*/
insert into tSysEnumtype values(0,0,'是或否',1)
insert into tSysEnumValue values(0,0,0,'',0,1,1.00)
insert into tSysEnumValue values(0,0,1,'',0,2,1.00)
insert into tSysEnumtype values(0,1,'成交方式',1)
insert into tSysEnumValue values(0,1,0,'FOB',0,1,1.00)
insert into tSysEnumValue values(0,1,1,'CIF',0,2,1.00)
insert into tSysEnumValue values(0,1,2,'CIP',0,3,1.00)
delete from tSysEnumtype where enumtypeid=2
delete from tsysenumvalue where enumtypeid=2
insert into tSysEnumtype values(0,2,'单据名称',1)
insert into tSysEnumValue values(0,2,0,'单据',0,1,1.00)
insert into tSysEnumValue values(0,2,1,'自动证',0,2,1.00)
insert into tSysEnumValue values(0,2,2,'卫生证',0,3,1.00)
insert into tSysEnumValue values(0,2,3,'提单',0,4,1.00)
delete from tSysEnumtype where enumtypeid=3
delete from tsysenumvalue where enumtypeid=3
insert into tSysEnumtype values(0,3,'合同状态',1)
insert into tSysEnumValue values(0,3,0,'接单',0,1,1.00)
insert into tSysEnumValue values(0,3,1,'配证',0,2,1.00)
insert into tSysEnumValue values(0,3,2,'审单',0,3,1.00)
insert into tSysEnumValue values(0,3,3,'申证',0,4,1.00)
insert into tSysEnumValue values(0,3,4,'港口操作',0,5,1.00)
insert into tSysEnumValue values(0,3,5,'账单提交',0,6,1.00)
insert into tSysEnumValue values(0,3,6,'账单审核通过',0,7,1.00)
insert into tSysEnumValue values(0,3,7,'合同完成',0,8,1.00)
insert into tSysEnumtype values(0,4,'付款方式',1)
insert into tSysEnumValue values(0,4,0,'DP',0,1,1.00)
insert into tSysEnumValue values(0,4,1,'TT',0,2,1.00)
insert into tSysEnumtype values(0,5,'船公司',1)
insert into tSysEnumValue values(0,5,0,'未知',0,1,1.00)
insert into tSysEnumValue values(0,5,1,'BBB船公司',0,2,1.00)
insert into tSysEnumValue values(0,5,2,'CCC船公司',0,3,1.00)
insert into tSysEnumtype values(0,6,'提单提交方式',1)
insert into tSysEnumValue values(0,6,0,'电放',0,1,1.00)
insert into tSysEnumValue values(0,6,1,'正本',0,2,1.00)
insert into tSysEnumtype values(0,7,'单据状态',1)
insert into tSysEnumValue values(0,7,0,'',0,1,1.00)
insert into tSysEnumValue values(0,7,1,'待发',0,2,1.00)
insert into tSysEnumValue values(0,7,2,'待收',0,2,1.00)
insert into tSysEnumValue values(0,7,3,'已发',0,2,1.00)
insert into tSysEnumValue values(0,7,4,'已收',0,2,1.00)
insert into tSysEnumValue values(0,7,5,'待回复',0,2,1.00)
insert into tSysEnumtype values(0,8,'库存操作状态',1)
insert into tSysEnumValue values(0,8,0,'库存货物初始化',0,1,1.00)
insert into tSysEnumValue values(0,8,1,'入库',0,2,1.00)
insert into tSysEnumValue values(0,8,2,'转移库存',0,2,1.00)
insert into tSysEnumValue values(0,8,3,'倒柜',0,2,1.00)
insert into tSysEnumValue values(0,8,4,'出库',0,2,1.00)
insert into tSysEnumtype values(0,9,'库房',1)
insert into tSysEnumValue values(0,9,0,'未到港',0,1,1.00)
insert into tSysEnumValue values(0,9,1,'海关',0,2,1.00)
insert into tSysEnumValue values(0,9,2,'商检库',0,2,1.00)
insert into tSysEnumValue values(0,9,3,'储存库',0,2,1.00)
insert into tSysEnumtype values(0,10,'港口',1)
insert into tSysEnumValue values(0,10,0,'天津',0,1,1.00)
insert into tSysEnumValue values(0,10,1,'青岛',0,2,1.00)
insert into tSysEnumValue values(0,10,2,'上海',0,2,1.00)
delete from tSysEnumtype where enumtypeid=11
delete from tsysenumvalue where enumtypeid=11
insert into tSysEnumtype values(0,11,'重量单位',1)
insert into tSysEnumValue values(0,11,0,'KG',0,1,1.00)
insert into tSysEnumValue values(0,11,1,'',0,2,0.4536)
insert into tSysEnumValue values(0,11,2,'',0,3,1000.00)
delete from tSysEnumtype where enumtypeid=12
delete from tsysenumvalue where enumtypeid=12
insert into tSysEnumtype values(0,12,'客户付款方式',1)
insert into tSysEnumValue values(0,12,0,'全款',0,1,1.00)
insert into tSysEnumValue values(0,12,1,'只付预付款,客户支付尾款',0,2,1.00)
insert into tSysEnumValue values(0,12,2,'客户支付全款',0,3,1.00)
insert into tSysEnumValue values(0,12,3,'只付尾款,客户支付预付款',0,3,1.00)
delete from tSysEnumtype where enumtypeid=13
delete from tsysenumvalue where enumtypeid=13
insert into tSysEnumtype values(0,13,'许可证使用状态',1)
insert into tSysEnumValue values(0,13,0,'配证',0,1,1.00)
insert into tSysEnumValue values(0,13,1,'核销',0,2,1.00)
delete from tSysEnumtype where enumtypeid=14
delete from tsysenumvalue where enumtypeid=14
insert into tSysEnumtype values(0,14,'财务应收应付条目_进口贸易',1)
insert into tSysEnumValue values(0,14,0,'预付款',0,1,1.00)
insert into tSysEnumValue values(0,14,1,'尾款',0,2,1.00)
insert into tSysEnumValue values(0,14,2,'关税',0,3,1.00)
insert into tSysEnumValue values(0,14,3,'增值税',0,4,1.00)
insert into tSysEnumValue values(0,14,4,'代理费',0,5,1.00)
insert into tSysEnumValue values(0,14,5,'运费',0,6,1.00)
insert into tSysEnumValue values(0,14,6,'超期箱使费',0,7,1.00)
insert into tSysEnumValue values(0,14,7,'吊装费',0,8,1.00)
delete from tSysEnumtype where enumtypeid=15
delete from tsysenumvalue where enumtypeid=15
insert into tSysEnumtype values(0,15,'货物融资状态',1)
insert into tSysEnumValue values(0,15,0,'待融资',0,1,1.00)
insert into tSysEnumValue values(0,15,1,'已融资',0,2,1.00)
insert into tSysEnumValue values(0,15,2,'部分归还',0,3,1.00)
insert into tSysEnumValue values(0,15,3,'全部归还',0,4,1.00)
delete from tSysEnumtype where enumtypeid=16
delete from tsysenumvalue where enumtypeid=16
insert into tSysEnumtype values(0,16,'融资状态——融出',1)
insert into tSysEnumValue values(0,16,0,'未融资',0,1,1.00)
insert into tSysEnumValue values(0,16,1,'等待融资',0,1,1.00)
insert into tSysEnumValue values(0,16,2,'已融出',0,2,1.00)
insert into tSysEnumValue values(0,16,3,'部分归还',0,3,1.00)
insert into tSysEnumValue values(0,16,4,'全部归还',0,4,1.00)
delete from tSysEnumtype where enumtypeid=17
delete from tsysenumvalue where enumtypeid=17
insert into tSysEnumtype values(0,17,'融资状态——融入',1)
insert into tSysEnumValue values(0,17,0,'录入,未放款',0,1,1.00)
insert into tSysEnumValue values(0,17,1,'已融出',0,2,1.00)
insert into tSysEnumValue values(0,17,2,'部分归还',0,3,1.00)
insert into tSysEnumValue values(0,17,3,'全部归还',0,4,1.00)
delete from tSysEnumtype where enumtypeid=18
delete from tsysenumvalue where enumtypeid=18
insert into tSysEnumtype values(0,18,'融资明细状态',1)
insert into tSysEnumValue values(0,18,0,'部分归还',0,1,1.00)
insert into tSysEnumValue values(0,18,1,'全部归还',0,2,1.00)
delete from tSysEnumtype where enumtypeid=19
delete from tsysenumvalue where enumtypeid=19
insert into tSysEnumtype values(0,19,'关联仓库',1)
delete from tSysEnumtype where enumtypeid=20
delete from tsysenumvalue where enumtypeid=20
insert into tSysEnumtype values(0,20,'财务-管理费名称',1)
insert into tSysEnumValue values(0,20,1,'办公费',0,1,1.00)
insert into tSysEnumValue values(0,20,2,'差旅费',0,2,1.00)
insert into tSysEnumValue values(0,20,3,'长期待摊费用',0,3,1.00)
insert into tSysEnumValue values(0,20,4,'待摊费用',0,4,1.00)
insert into tSysEnumValue values(0,20,5,'贷款利息',0,5,1.00)
insert into tSysEnumValue values(0,20,6,'发票费',0,6,1.00)
insert into tSysEnumValue values(0,20,7,'福利费',0,7,1.00)
insert into tSysEnumValue values(0,20,8,'工资',0,8,1.00)
insert into tSysEnumValue values(0,20,9,'固定资产',0,9,1.00)
insert into tSysEnumValue values(0,20,10,'汇兑',0,10,1.00)
insert into tSysEnumValue values(0,20,11,'交通费',0,11,1.00)
insert into tSysEnumValue values(0,20,12,'快递费',0,12,1.00)
insert into tSysEnumValue values(0,20,13,'利息',0,13,1.00)
insert into tSysEnumValue values(0,20,14,'汽车费用',0,14,1.00)
insert into tSysEnumValue values(0,20,15,'汽油费',0,15,1.00)
insert into tSysEnumValue values(0,20,16,'取暖费',0,16,1.00)
insert into tSysEnumValue values(0,20,17,'社保费',0,17,1.00)
insert into tSysEnumValue values(0,20,18,'实收资本',0,18,1.00)
insert into tSysEnumValue values(0,20,19,'实收资本-人民币',0,19,1.00)
insert into tSysEnumValue values(0,20,20,'手续费',0,20,1.00)
insert into tSysEnumValue values(0,20,21,'水电费',0,21,1.00)
insert into tSysEnumValue values(0,20,22,'税费',0,22,1.00)
insert into tSysEnumValue values(0,20,23,'摊销费',0,23,1.00)
insert into tSysEnumValue values(0,20,24,'通讯费',0,24,1.00)
insert into tSysEnumValue values(0,20,25,'无形资产',0,25,1.00)
insert into tSysEnumValue values(0,20,26,'物业费',0,26,1.00)
insert into tSysEnumValue values(0,20,27,'现金',0,27,1.00)
insert into tSysEnumValue values(0,20,28,'应付工资',0,28,1.00)
insert into tSysEnumValue values(0,20,29,'招待费',0,29,1.00)
insert into tSysEnumValue values(0,20,30,'折旧费',0,30,1.00)
delete from tSysEnumtype where enumtypeid=21
delete from tsysenumvalue where enumtypeid=21
insert into tSysEnumtype values(0,21,'预收付方向',1)
insert into tSysEnumValue values(0,21,1,'预收',0,1,1.00)
insert into tSysEnumValue values(0,21,2,'预付',0,2,1.00)
delete from tSysEnumtype where enumtypeid=22
delete from tsysenumvalue where enumtypeid=22
insert into tSysEnumtype values(0,22,'收付方向',1)
insert into tSysEnumValue values(0,22,1,'收款',0,1,1.00)
insert into tSysEnumValue values(0,22,2,'付款',0,2,1.00)
delete from tSysEnumtype where enumtypeid=9000
delete from tsysenumvalue where enumtypeid=9000
insert into tSysEnumtype values(0,9000,'国别税率',1)
insert into tSysEnumValue values(0,9000,0,'最惠国',0,1,1.00)
insert into tSysEnumValue values(0,9000,1,'普通',0,2,1.00)
insert into tSysenumvalue values(0,99024,10,'融资支付',0,0,1.00)
select * into temp_code_fee from code_fee
delete from code_fee
-----------------------
select newid()+''
select * from import_country
SELECT CtnCode,CtnName,CodeAndName
from vMsTruckCtn
SELECT id,country_code,country,(country_code+'_'+country) as country_codeandname
from import_country