|
发表于 2009-1-7 12:27:56
|
显示全部楼层
通过远程跟踪年结处理。
临时表:
create table tempJZ
(
cTblName varchar(50) not null,
cFlag varchar(50) null,
cIdName varchar(50) not null,
cId int not null
)
临时表:
create table tempEAToNextYear
(
cEAO_Class varchar(3) not null default '11',
cEAO_ID varchar(8) not null,
cEAO_Code varchar(40) not null,
CONSTRAINT [PK_tempEAToNextYear] PRIMARY KEY CLUSTERED
(
[cEAO_Class],[cEAO_ID],[cEAO_Code]
) ON [PRIMARY]
)
销售管理/销售发票处理:
临时表处理
if exists(select name from sysobjects where name='BSTmp') drop table BSTmp
create table BSTmp (sbvid int,idlsid int,cvouchtype varchar(2),breturnflag bit )
go
insert into BSTmp (sbvid,idlsid,cvouchtype,breturnflag) select salebillvouch.sbvid,idlsid,cvouchtype,breturnflag from salebillvouch inner join salebillvouchs on salebillvouch.sbvid=salebillvouchs.sbvid where IsNull(cInvalider,'') = '' and dDate>='2008-01-01' and csource='销售'
insert into BSTmp (sbvid,idlsid,cvouchtype,breturnflag) select salebillvouch.sbvid,idlsid,cvouchtype,breturnflag from salebillvouch inner join salebillvouchs on salebillvouch.sbvid=salebillvouchs.sbvid inner join inventory on inventory.cinvcode=salebillvouchs.cinvcode where bService=0 and IsNull(cInvalider,'') = '' and dDate<'2008-01-01' and csource='销售' and cbustype='直运销售' and isnull(ipbvsid,0)=0 and isnull(isosid,0)=0 and (abs(cast(isnull(iquantity,0) as decimal(20,6)))-abs(cast(isnull(foutquantity,0) as decimal(20,6))))>0
insert into tempjz (ctblName,cid,cflag,cidname) select 'salebillvouch',sbvid,null,'sbvid' from BSTmp
Insert into tempEAToNextYear select distinct '11' as cEAO_Class,Case cVouchType when '26' then Case breturnflag
when 0 then '06' when 1 then '08' End when '27' then Case breturnflag when 0 then '07' when 1 then '09' End
when '28' then Case breturnflag when 0 then '26' when 1 then '27' End when '29' then Case breturnflag when 0 then '28' when 1 then '29' End End as cEAO_ID, sbvid as cEAO_Code From BSTmp
脚本执行并不存在问题。
出现错误现象怪异,建议通过400找用友服务远程分析分析! |
|