sql server 游标
培训ERP,浪潮gs5测试版本。产品问题比较多,毕竟是测试版本嘛!
(说明:gs是浪潮的高端产品,主要是集团行业使用。集团下的分公司在软件中是一个组织单位。)
讲到组织单位启用的时候,就不能继续了。界面上提示脚本错误。组织单位不能启用,后续工作就不能进行了。怎么办?
开发正在忙着测试版的修正工作。无暇顾及。哎,自己动手吧,靠别人是不行的。
通过sql的事件察看器,跟踪后台执行过程,分析修改跟踪出来的sql语句。
选择一个帐套执行,然后作后续业务测试,ok。
结下来的问题是,sql语句只是针对一个数据库的一个组织单位。
34个学员每人一个数据库,每个数据库至少20个组织单位,不能每次都替换组织编码。
如果那样下去,估计得累死。
怎么办?问题可以解决,但是要简便。一次性修改就要涉及到循环。懂程序涉及的人都知道。
对呀,sql提供了游标。呵呵,快一年没有写sql脚本了,突然想起来了。
整体的一个架构如下:
DECLARE @au_id varchar(30) 声明一个变量存放标准组织单位的编码。
DECLARE authors_cursor CURSOR FOR 声明游标,条件:标准组织单位表中启用标示lsbzdw_qybz=0,代表组织单位没有启用。
SELECT LSBZDW_DWBH
FROM LSBZDW
where lsbzdw_qybz=0
OPEN authors_cursor 打开游标。
FETCH NEXT FROM authors_cursor 取LSBZDW_DWBH自段值赋给变量@au_id 。
INTO @au_id
WHILE @@FETCH_STATUS = 0 判断循环条件。
begin
组织单位启用代码
例如:delete from ZWHSGX2008 where ZWHSGX_DWBH=@au_id 原来是组织单位编码010101,现在用变量@au_id代替。
FETCH NEXT FROM authors_cursor 取下一个值。
INTO @au_id
END
CLOSE authors_cursor 关闭游标。
DEALLOCATE authors_cursor 释放游标。
go
这样可以针对每个数据库执行一次,但是还需要执行34次。我们可以嵌套游标,从master库中取浪潮的数据库,然后执行。
由于还要进行下面的培训,所以找两个人针对不同的数据库执行这个游标,脚本的执行效率很高,就4秒左右,就没有在考虑嵌套游标。
上边就是一个游标的例子,可以在框架中加入select ,update,insert into等语句,大家看到这里就可以了。
如果是浪潮的erp工程师可以看看下边的整个游标,可能对你有帮助。
DECLARE @au_id varchar(30)
DECLARE authors_cursor CURSOR FOR
SELECT LSBZDW_DWBH
FROM LSBZDW
where lsbzdw_qybz=0
OPEN authors_cursor
FETCH NEXT FROM authors_cursor
INTO @au_id
WHILE @@FETCH_STATUS = 0
begin
insert into LSDWCN(LSDWCN_DWBH,LSDWCN_YEAR,LSDWCN_ZJBH,LSDWCN_KJRL,LSDWCN_BWB,LSDWCN_KMTX) values(@au_id,'2008','01','01','01','01')
update LSBZDW set LSBZDW_QYBZ = '1' where LSBZDW_DWBH=@au_id and (LSBZDW_TYBZ = '0' or (LSBZDW_TYBZ = '1' and LSBZDW_TYND > '2008'))
delete from ZWHSGX2008 where ZWHSGX_DWBH=@au_id
insert into ZWHSGX2008(ZWHSGX_ZJBH,ZWHSGX_DWBH,ZWHSGX_KMBH,ZWHSGX_BMHS,ZWHSGX_DWHS,ZWHSGX_CPHS,ZWHSGX_NBJY,ZWHSGX_GRHS,ZWHSGX_ZXHS) select '%',@au_id,ZWHSGX_KMBH,ZWHSGX_BMHS,ZWHSGX_DWHS,ZWHSGX_CPHS,ZWHSGX_NBJY,ZWHSGX_GRHS,ZWHSGX_ZXHS from ZWHSGX2008 where ZWHSGX_ZJBH='01' and ZWHSGX_DWBH='%'
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='ZW'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='ZW'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' 'from SYDOMK,SYMK where SYMK_MKID='ZW' and SYMK_DTID=SYDOMK_MKID
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and (LSGSCS_MKID='ZW' or LSGSCS_MKID='FZ')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_CSNDQJ','200804','初始年度期间')
delete from LSQJZT2008 where LSQJZT_DWBH=@au_id
insert into LSQJZT2008(LSQJZT_DWBH,LSQJZT_QJDM,LSQJZT_KJND,LSQJZT_QJXH,LSQJZT_QJZT,LSQJZT_LX,LSQJZT_INIT) select @au_id,LSKJQJ_QJDM,'2008',LSKJQJ_QJXH,'4','3','0' from LSKJQJ2008 where LSKJQJ_RLDM='01'
update LSQJZT2008 set LSQJZT_QJZT='3',LSQJZT_LX='2',LSQJZT_INIT='1' where LSQJZT_DWBH=@au_id and LSQJZT_QJXH='04'
update LSQJZT2008 set LSQJZT_QJZT='1',LSQJZT_LX='1' where LSQJZT_DWBH=@au_id and LSQJZT_QJXH<'04'
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_KMSTRU','43333','科目编码结构')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'CW_LINKSYMBOL','-','科目连接符')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_PZXS','1','是否凭证序时')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_CWZG','财务主管','财务主管')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_HAVEJZ','0','是否已记帐')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_HAVENJ','0','是否已年结')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_PZWZKZ','1','是否控制凭证必须完整')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_CHECKYS','1','检查预算')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_INPUTBH','1','修改凭证编号')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_FZYS','1','录入辅助原始凭证')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('FZ',@au_id,'ZW_DWHELP','0','单位快速查找方式')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_CZJG','1','赤字警告')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_PZCX','1','凭证显示设置')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_PZTD','1','凭证套打')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_SLKZ','0','是否必须输入数量单价')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_DJDECN','2','单价精度')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_BWZPZ','1','是否任何人可修改不完整凭证')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'CW_SYZJ','01','使用帐集')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_JEDECN','2','金额精度')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_SLDECN','2','数量精度')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'ZW_INPUTFZZY','0','录入辅助摘要')
delete from ZWHSGX2008 where ZWHSGX_DWBH=@au_id and ZWHSGX_ZJBH='%'
insert into ZWHSGX2008(ZWHSGX_DWBH,ZWHSGX_ZJBH,ZWHSGX_KMBH,ZWHSGX_YWXZ,ZWHSGX_BMHS,ZWHSGX_GRHS,ZWHSGX_DWHS,ZWHSGX_CPHS,ZWHSGX_ZXHS,ZWHSGX_YSPZ,ZWHSGX_HSWB,ZWHSGX_WBBH,ZWHSGX_HSSL,ZWHSGX_XX01,ZWHSGX_XX02,ZWHSGX_XX03,ZWHSGX_ZYGS) select @au_id,'%',ZWKMZD_KMBH,isNull(ZWHSGX_YWXZ,'0'),isNull(ZWHSGX_BMHS,'0'),isNull(ZWHSGX_GRHS,'0'),isNull(ZWHSGX_DWHS,'0'),isNull(ZWHSGX_CPHS,'0'),isNull(ZWHSGX_ZXHS,' '),' ',isNull(ZWHSGX_HSWB,'0'),isNull(ZWHSGX_WBBH,' '),isNull(ZWHSGX_HSSL,'0'),isNull(ZWHSGX_XX01,' '),isNull(ZWHSGX_XX02,' '),isNull(ZWHSGX_XX03,' '),isNull(ZWHSGX_ZYGS,'0') from ZWKMZD2008 left join ZWHSGX2008 on(ZWHSGX_DWBH='%' and ZWHSGX_ZJBH='01' and ZWHSGX_KMBH=ZWKMZD_KMBH) where ZWKMZD_TX=(select LSSETS_KMTX from LSSETS2008 where LSSETS_ZJBH='01') and (ZWKMZD_KMLX='1' or (ZWKMZD_KMLX='2' and ZWKMZD_DWBH=@au_id))
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZW',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='WL'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='WL'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='WL' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('WL',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('WL',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('WL',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='ZX'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='ZX'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='ZX' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZX',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZX',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZX',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='BB'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='BB'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='BB' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('BB',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('BB',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='GZ'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='GZ'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='GZ' and SYMK_DTID=SYDOMK_MKID
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='GZ'
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GZ',@au_id,'GZ_JGX','2','工资条间隔线类型0、1、2')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GZ',@au_id,'GZ_MHJG','6','工资条每行间隔')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GZ',@au_id,'GZ_MHXM','20','工资条每行项目个数')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GZ',@au_id,'GZ_JSXZXM','0','工资计算选择项目')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GZ',@au_id,'GZ_SLJD','2','个人所得税税率精度')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GZ',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GZ',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='GD'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='GD'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='GD' and SYMK_DTID=SYDOMK_MKID
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='GD'
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) select LSGSCS_MKID,@au_id,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE from LSGSCS2008 where LSGSCS_HSDW='@DWBH@'
update LSGSCS2008 SET LSGSCS_VALUE='04' WHERE LSGSCS_HSDW<>'@DWBH@' and LSGSCS_VALUE='@KJQJ@' AND LSGSCS_HSDW=@au_id
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GD',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GD',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('GD',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='XJ'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='XJ'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='XJ' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('XJ',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('XJ',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='XJGL'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='XJGL'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='XJGL' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('XJGL',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('XJGL',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='MV'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='MV'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='MV' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('MV',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('MV',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('MV',@au_id,'LS_DWQYND','2008','启用年度')
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISBATCHMGR','0','是否使用批次管理 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISBATCHMGR') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISPERIODOFVALIDITYMGR','0','是否使用效期管理 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISPERIODOFVALIDITYMGR') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISFCURRENCY','0','是否使用外币核算 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISFCURRENCY') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISFLEXFIELD','0','是否使用自由项 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISFLEXFIELD') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_CUSTOMFIELDDECN','2','自定义项精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_CUSTOMFIELDDECN') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_DISCRATEDECN','2','折扣比例精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_DISCRATEDECN') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_TAXRATEDECN','2','税率精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_TAXRATEDECN') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_DWQYND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'MV',@au_id,'MV_DWQYND',LSGSCS_VALUE,'存货模块启用会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='MV' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_DWQYQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'MV',@au_id,'MV_DWQYQJ',LSGSCS_VALUE,'存货模块启用会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='MV' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_IFMODULUSCOUNT' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_IFMODULUSCOUNT','1','出库成本计算是否按绝对值计算:1、是;0、否') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_DWDQND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'MV',@au_id,'MV_DWDQND',LSGSCS_VALUE,'存货模块当前会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='MV' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_DWDQQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'MV',@au_id,'MV_DWDQQJ',LSGSCS_VALUE,'存货模块当前会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='MV' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; end ;
begin DELETE FROM PERIODSTATE WHERE COMPANYID=@au_id AND MODULEID='MV' ; INSERT INTO PERIODSTATE (COMPANYID,MODULEID,FISCALYEAR,FISCALPERIOD,PERIODNAME,STATE) SELECT @au_id,'MV','2008',LSKJQJ_QJXH,LSKJQJ_QJDM,'1' FROM LSKJQJ2008 WHERE LSKJQJ_RLDM = (SELECT LSDWCN_KJRL FROM LSDWCN WHERE LSDWCN_DWBH=@au_id AND LSDWCN_YEAR='2008') ; UPDATE PERIODSTATE SET STATE='3' WHERE COMPANYID=@au_id AND MODULEID='MV' AND FISCALYEAR='2008' AND FISCALPERIOD=(SELECT LSGSCS_VALUE FROM LSGSCS2008 WHERE LSGSCS_MKID='MV' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ') ; UPDATE PERIODSTATE SET STATE='4' WHERE COMPANYID=@au_id AND MODULEID='MV' AND FISCALYEAR='2008' AND FISCALPERIOD>(SELECT LSGSCS_VALUE FROM LSGSCS2008 WHERE LSGSCS_MKID='MV' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_ISPERMIT' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_ISPERMIT','0','是否允许修改删除其他人所做单据 1:是 0:否') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_ADJUSTLEVEL' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) Values('MV',@au_id,'MV_ADJUSTLEVEL','1','存货核算层次 1:公司 0:库存组织') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_DIFAPTBASIS' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) Values('MV',@au_id,'MV_DIFAPTBASIS','1','差异分摊依据 1:业务类别 2:出库仓库 3:领用部门') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_EVALTYPE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) Values('MV',@au_id,'MV_EVALTYPE','1','暂估入库的冲销方式 0:单到回冲 1:单到补差') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_ISUNITPRICEMDF' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) Values('MV',@au_id,'MV_ISUNITPRICEMDF','0','出库单价允许修改 1:是 0:否') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_AUTOCOMPUTEMOVEINPRICE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) Values('MV',@au_id,'MV_AUTOCOMPUTEMOVEINPRICE','0','移入价格是否根据移出成本自动处理 1,是,0,否,默认为0') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_MODEOFPRICEISZ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) Values('MV',@au_id,'MV_MODEOFPRICEISZ','1','出库单价为零的处理方式 1:取上次单价 2:手工输入') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_ISUSESTANDARD' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) Values('MV',@au_id,'MV_ISUSESTANDARD','1','是否使用标准价 1:是 0:否') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_OUTREDBILLTOCALU' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_OUTREDBILLTOCALU','0','出库红单是否参与出库成本计算.0:不参与,1:参与,默认为:0') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_CURRENTPERIODCLEARISTR' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_CURRENTPERIODCLEARISTR','1','本期核销的收货记入暂估发生 0不记入,1记入 默认1') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_OUTBILLFORCONFIRMTOCALU' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_OUTBILLFORCONFIRMTOCALU','1','手工确认的出库单是否参与出库成本计算.0:不参与,1:参与,默认为:1') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_RECBILLTOMVCONFIRM' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_RECBILLTOMVCONFIRM','1','对存货计价为全月加权的入库单入库时是否直接成本确认 0:否,1:是') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='FIFO' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'FIFO','M0','先进先出层次定义:层次分类+批次,用1表示启用,0表示不启用M0这时最初始的情况(层次分类为Y会计年度,M会计年度+会计期间,D会计年度+会计期间+业务日期') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='LIFO' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'LIFO','M0','后进先出层次定义:层次分类+批次,用1表示启用,0表示不启用M0这时最初始的情况(层次分类为Y会计年度,M会计年度+会计期间,D会计年度+会计期间+业务日期') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='SPEP' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'SPEP','M0','个别计价层次定义:层次分类+批次,用1表示启用,0表示不启用M0这时最初始的情况(层次分类为Y会计年度,M会计年度+会计期间,D会计年度+会计期间+业务日期') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_CHEAPENOBJECT' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_CHEAPENOBJECT','1','存货跌价对象 1:物料、2:物料类型、3:核算类型') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_PRICEMETHOD' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_PRICEMETHOD','1','默认计价方式 1、移动加权平均 2、全月一次加权平均 5、个别计价 6、计划价 默认为1') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='MV' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='MV_VARCOMCATE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('MV',@au_id,'MV_VARCOMCATE','DIFFMATERIALS','存货差异计算对象 DIFFMATERIALS:物料、DIFFMALSORTS:物料分类、DIFFMALVAL:核算类型') ; end ;
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='AR'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='AR'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='AR' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('AR',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('AR',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('AR',@au_id,'LS_DWQYND','2008','启用年度')
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_DWQYND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_DWQYND',LSGSCS_VALUE,'应收模块启用会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='AR' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_DWQYQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_DWQYQJ',LSGSCS_VALUE,'应收模块启用会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='AR' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_DWDQND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_DWDQND',LSGSCS_VALUE,'应收模块当前会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='AR' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_DWDQQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_DWDQQJ',LSGSCS_VALUE,'应收模块当前会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='AR' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; END ;
BEGIN DELETE FROM PERIODSTATE WHERE COMPANYID=@au_id AND MODULEID='AR' ; INSERT INTO PERIODSTATE (COMPANYID,MODULEID,FISCALYEAR,FISCALPERIOD,PERIODNAME,STATE) SELECT @au_id,'AR','2008',LSKJQJ_QJXH,LSKJQJ_QJDM,'1' FROM LSKJQJ2008 WHERE LSKJQJ_RLDM = (SELECT LSDWCN_KJRL FROM LSDWCN WHERE LSDWCN_DWBH=@au_id AND LSDWCN_YEAR='2008') ; UPDATE PERIODSTATE SET STATE='3' WHERE COMPANYID=@au_id AND MODULEID='AR' AND FISCALYEAR='2008' AND FISCALPERIOD=(SELECT LSGSCS_VALUE FROM LSGSCS2008 WHERE LSGSCS_MKID='AR' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ') ; UPDATE PERIODSTATE SET STATE='4' WHERE COMPANYID=@au_id AND MODULEID='AR' AND FISCALYEAR='2008' AND FISCALPERIOD>(SELECT LSGSCS_VALUE FROM LSGSCS2008 WHERE LSGSCS_MKID='AR' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ') ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_ISPERMIT' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_ISPERMIT','0','是否允许修改删除其他人所做单据:0 否 1 是' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_CONTROLGL' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_CONTROLGL','0','否控制总账:0 不控制 1 是控制' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_VOUCHER' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_VOUCHER','0','月结是否控制所有单据生成凭证:0 否 1 是' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_CLEARMODE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_CLEARMODE','1','应收款核销方式:0 按单据 1 按行' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_PREINTEREST' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_PREINTEREST','1','是否预提票据利息:0 否 1 是' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_NOTEPOSTMODE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_NOTEPOSTMODE','1','票据应收记账方式:0 单独记账 1 核销记账' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_USEAUDITFLOW' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_USEAUDITFLOW','0','收款审核是否调用审批流程: 0 不使用 1 使用' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_USEAUDITFLOW_ARAP' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_USEAUDITFLOW_ARAP','0','应收审核是否调用审批流程: 0 不使用 1 使用' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_USEBUDGETCONTROL' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_USEBUDGETCONTROL','0','收款单是否需要预算检查:0 不检查 1 检查' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_SELALLRPITEM' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_SELALLRPITEM','0','是否选择全部收支项目0仅选择收入项目;1选择全部收支项目,默认是0' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_UNIONYSZJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_UNIONYSZJ','0','收支项目不能为空 1,是 0不是 ,默认是1' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_ISPERMITEDITEXCHRATE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_ISPERMITEDITEXCHRATE','0','是否允许修改汇率:1、允许;0、不允许,默认为0' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AR' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AR_ISCLEAROTHERS' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AR',@au_id,'AR_ISCLEAROTHERS','1','是否允许核销他人单据 0:不允许,1:允许 默认1' FROM SYSDRPDUMMY ; END ;
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='AP'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='AP'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='AP' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('AP',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('AP',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('AP',@au_id,'LS_DWQYND','2008','启用年度')
BEGIN INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISBATCHMGR','0','是否使用批次管理 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='DRP_ISBATCHMGR') ; END ;
BEGIN INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISPERIODOFVALIDITYMGR','0','是否使用效期管理 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='DRP_ISPERIODOFVALIDITYMGR') ; END ;
BEGIN INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISFCURRENCY','0','是否使用外币核算 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='DRP_ISFCURRENCY') ; END ;
BEGIN INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISFLEXFIELD','0','是否使用自由项 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='DRP_ISFLEXFIELD') ; END ;
BEGIN INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_CUSTOMFIELDDECN','2','自定义项精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='DRP_CUSTOMFIELDDECN') ; END ;
BEGIN INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_DISCRATEDECN','2','折扣比例精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='DRP_DISCRATEDECN') ; END ;
BEGIN INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_TAXRATEDECN','2','税率精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='DRP_TAXRATEDECN') ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_DWQYND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_DWQYND',LSGSCS_VALUE,'应付模块启用会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='AP' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_DWQYQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_DWQYQJ',LSGSCS_VALUE,'应付模块启用会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='AP' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_DWDQND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_DWDQND',LSGSCS_VALUE,'应付模块当前会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='AP' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_DWDQQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_DWDQQJ',LSGSCS_VALUE,'应付模块当前会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='AP' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; END ;
BEGIN DELETE FROM PERIODSTATE WHERE COMPANYID=@au_id AND MODULEID='AP' ; INSERT INTO PERIODSTATE (COMPANYID,MODULEID,FISCALYEAR,FISCALPERIOD,PERIODNAME,STATE) SELECT @au_id,'AP','2008',LSKJQJ_QJXH,LSKJQJ_QJDM,'1' FROM LSKJQJ2008 WHERE LSKJQJ_RLDM = (SELECT LSDWCN_KJRL FROM LSDWCN WHERE LSDWCN_DWBH=@au_id AND LSDWCN_YEAR='2008') ; UPDATE PERIODSTATE SET STATE='3' WHERE COMPANYID=@au_id AND MODULEID='AP' AND FISCALYEAR='2008' AND FISCALPERIOD=(SELECT LSGSCS_VALUE FROM LSGSCS2008 WHERE LSGSCS_MKID='AP' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ') ; UPDATE PERIODSTATE SET STATE='4' WHERE COMPANYID=@au_id AND MODULEID='AP' AND FISCALYEAR='2008' AND FISCALPERIOD>(SELECT LSGSCS_VALUE FROM LSGSCS2008 WHERE LSGSCS_MKID='AP' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ') ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_USEPAYMENTPLAN' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_USEPAYMENTPLAN','0','是否使用付款计划:0 不使用、1 使用' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_ISPERMIT' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_ISPERMIT','0','是否允许修改删除其他人所做单据:0 否 1 是' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_CONTROLGL' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_CONTROLGL','0','否控制总账:0 不控制 1 是控制' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_VOUCHER' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_VOUCHER','0','月结是否控制所有单据生成凭证:0 否 1 是' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_CLEARMODE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_CLEARMODE','1','应付款核销方式:0 按单据 1 按行' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_PREINTEREST' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_PREINTEREST','1','是否预提票据利息:0 否 1 是' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_NOTEPOSTMODE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_NOTEPOSTMODE','1','票据应付记账方式:0 单独记账 1 核销记账' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_PAYMENTPOSTMODE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_PAYMENTPOSTMODE','1','付款记账方式:0 单独记账 1 核销记账' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_USEAUDITFLOW' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_USEAUDITFLOW','0','付款审核是否调用审批流程: 0 不使用 1 使用' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_USEAUDITFLOW_ARAP' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_USEAUDITFLOW_ARAP','0','应付审核是否调用审批流程: 0 不使用 1 使用' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_USEBUDGETCONTROL' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_USEBUDGETCONTROL','0','付款单是否需要预算检查:0 不检查 1 检查' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_SELALLRPITEM' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_SELALLRPITEM','0','是否选择全部收支项目0仅选择支出项目;1选择全部收支项目,默认是0' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_UNIONYSZJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_UNIONYSZJ','1','收支项目不能为空 1,是 0不是 ,默认是1' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_ISPERMITEDITEXCHRATE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_ISPERMITEDITEXCHRATE','0','是否允许修改汇率:1、允许;0、不允许,默认为0' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_ISCLEAROTHERS' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'AP',@au_id,'AP_ISCLEAROTHERS','1','是否允许核销他人单据 0:不允许,1:允许 默认1' FROM SYSDRPDUMMY ; END ;
BEGIN DELETE FROM LSCONF WHERE LSCONF_MKID='AP' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='AP_ISNEEDEMP' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('AP',@au_id,'AP_ISNEEDEMP','1','付款单业务员是否必输 AP_ISNEEDEMP:0否,1是,默认是1') ; END ;
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='FX'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='FX'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='FX' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('FX',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('FX',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='FY'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='FY'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='FY' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('FY',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('FY',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('FY',@au_id,'LS_DWQYND','2008','启用年度')
insert into LSGSCS2008 values('FY',@au_id,'FYGL_DATE','20080410','')
insert into LSGSCS2008 values('FY',@au_id,'FYGL_YEAR','2008','')
insert into LSGSCS2008 values('FY',@au_id,'FYGL_MONTH','04','')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='TB'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='TB'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='TB' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('TB',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('TB',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('TB',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='ZJ'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='ZJ'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='ZJ' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZJ',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZJ',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('ZJ',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='XD'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='XD'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='XD' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('XD',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('XD',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('XD',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='HP'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='HP'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='HP' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('HP',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('HP',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('HP',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='JH'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='JH'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='JH' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('JH',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('JH',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('JH',@au_id,'LS_DWQYND','2008','启用年度')
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='CX'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='CX' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('CX',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('CX',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='MC'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='MC'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='MC' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('MC',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('MC',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='LQ'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='LQ'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='LQ' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('LQ',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('LQ',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='OLAP'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='OLAP'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='OLAP' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('OLAP',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('OLAP',@au_id,'LS_DWQYND','2008','启用年度')
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='DRPO'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='DRPO'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' ' from SYDOMK,SYMK where SYMK_MKID='DRPO' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('DRPO',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('DRPO',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('DRPO',@au_id,'LS_DWQYND','2008','启用年度')
begin DELETE FROM YWKJQJ2008; INSERT INTO YWKJQJ2008 (YWKJQJ_RLDM,YWKJQJ_QJDM,YWKJQJ_QJXH,YWKJQJ_QSRQ,YWKJQJ_ZZRQ,YWKJQJ_SSJD) SELECT LSKJQJ_RLDM,LSKJQJ_QJDM,LSKJQJ_QJXH,LSKJQJ_QSRQ,LSKJQJ_ZZRQ,LSKJQJ_SSJD FROM LSKJQJ2008; end ;
delete from LSGSCS2008 where LSGSCS_HSDW=@au_id and LSGSCS_MKID='IM'
delete from SYDOMFP where SYDOMFP_HSDW=@au_id and SYDOMFP_MKID='IM'
insert into SYDOMFP(SYDOMFP_DOMID,SYDOMFP_HSDW,SYDOMFP_MKID,SYDOMFP_VER) select distinct SYDOMK_DOMID,@au_id,SYMK_MKID,' 'from SYDOMK,SYMK where SYMK_MKID='IM' and SYMK_DTID=SYDOMK_MKID
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('IM',@au_id,'LS_DWQYRQ','20080410','启用日期')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('IM',@au_id,'LS_DWQYQJ','04','启用期间')
insert into LSGSCS2008(LSGSCS_MKID,LSGSCS_HSDW,LSGSCS_KEY,LSGSCS_VALUE,LSGSCS_NOTE) values('IM',@au_id,'LS_DWQYND','2008','启用年度')
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISBATCHMGR','0','是否使用批次管理 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISBATCHMGR') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISPERIODOFVALIDITYMGR','0','是否使用效期管理 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISPERIODOFVALIDITYMGR') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISFCURRENCY','0','是否使用外币核算 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISFCURRENCY') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_ISFLEXFIELD','0','是否使用自由项 1:是 0:否' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_ISFLEXFIELD') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_CUSTOMFIELDDECN','2','自定义项精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_CUSTOMFIELDDECN') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_DISCRATEDECN','2','折扣比例精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_DISCRATEDECN') ; end ;
begin INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'DRP',@au_id,'DRP_TAXRATEDECN','2','税率精度' FROM SYSDRPDUMMY WHERE NOT EXISTS (SELECT 1 FROM LSCONF WHERE LSCONF_MKID='DRP' and LSCONF_HSDW=@au_id and LSCONF_KEY='DRP_TAXRATEDECN') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='IM' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='IM_ISALTERBILLALLOW' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('IM',@au_id,'IM_ISALTERBILLALLOW','0','发货申请审核时允许修改单据:1、允许;0、不允许') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='IM' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='IM_DEFAULTSENDDATE' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) VALUES('IM',@au_id,'IM_DEFAULTSENDDATE','1','发货申请日期默认发货天数,缺省为1') ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='IM' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='IM_DWQYND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'IM',@au_id,'IM_DWQYND',LSGSCS_VALUE,'库存模块启用会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='IM' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='IM' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='IM_DWQYQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'IM',@au_id,'IM_DWQYQJ',LSGSCS_VALUE,'库存模块启用会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='IM' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='IM' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='IM_DWDQND' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'IM',@au_id,'IM_DWDQND',LSGSCS_VALUE,'库存模块当前会计年度' FROM LSGSCS2008 WHERE LSGSCS_MKID='IM' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYND' ; end ;
begin DELETE FROM LSCONF WHERE LSCONF_MKID='IM' AND LSCONF_HSDW=@au_id AND LSCONF_KEY='IM_DWDQQJ' ; INSERT INTO LSCONF (LSCONF_MKID,LSCONF_HSDW,LSCONF_KEY,LSCONF_VALUE,LSCONF_NOTE) SELECT 'IM',@au_id,'IM_DWDQQJ',LSGSCS_VALUE,'库存模块当前会计期间' FROM LSGSCS2008 WHERE LSGSCS_MKID='IM' AND LSGSCS_HSDW=@au_id AND LSGSCS_KEY='LS_DWQYQJ' ; end ;
begin DELETE FROM PERIODSTATE WHERE COMPANYID=@au_id AND MODULEID='IM' ; INSERT INTO PERIODSTATE (COMPANYID,MODULEID,FISCALYEAR,FISCALPERIOD,PERIODNAME,STATE) SELECT @au_id,'IM','2008',LSKJQJ_QJXH,LSKJQJ_QJDM,'1' FROM LSKJQJ2008 WHERE LSKJQJ_RLDM = (SELECT LSDWCN_KJRL FROM LSDWCN WHERE LSDWCN_DWBH=@au_id AND LSDWCN_YEAR='2008') ; UPDATE PERIODSTATE SET STATE='3' WHERE COMPANYID=@au_id AND MODULEID='IM' AND FISCALYEAR='2008' AND FISCALPERIOD=(SELECT LSGSCS_VALUE FROM LSGSCS2008 WHERE LSGSCS_MKID='IM' AND