IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_199_dolinkdata_2780]') AND type = 'P')
DROP PROCEDURE [dbo].[order_199_dolinkdata_2780]
GO
create procedure order_199_dolinkdata_2780(
@cmpid int ,
@useruid int ,
@bizid int ,
@ordbcid int,
@ordid bigint,
@jbid bigint,
@ftype varchar(10),
@fbizid int,
@fordid bigint,
@ford2tag int ,
@ford2id bigint,
@rtype varchar(10),
@rbizid int,
@rordid bigint,
@rord2tag int ,
@rord2id bigint 
) 
as 
begin
declare @operation varchar(50) 
declare @errorinfo nvarchar(4000)  
declare @newobjid bigint 
declare @ident varchar(40) 
declare @newsql nvarchar(max) 
declare @condition nvarchar(4000) 
declare @authority varchar(200) 
declare @bcid int 
set @bcid=@ordbcid 



set @operation = 'continue' 
set @errorinfo='' 
set @newobjid = 0 
set @ident=convert(varchar(100),convert(decimal(18,11),CURRENT_TIMESTAMP)) 
set @newsql = '' 
set @authority = '' 
set @condition = '' 
-- 以下是用户扩展的程序  ---- 

-- 以上是用户扩展的程序  ---- 
if (@operation = 'continue') 
begin 


if (@ftype='biz' and @fbizid=202 and @ford2tag=0) 
set @newsql='
update old set  old.ord_updated=getdate() ,  old.ord_lxdh1=new.ord_lxdh1 ,  old.ord_jmfs=new.ord_jmfs ,  old.ord_dh=new.ord_dh ,  old.ord_xcsxy=new.ord_xcsxy ,  old.ord_xb=new.ord_xb ,  old.ord_tzys=new.ord_tzys ,  old.ord_sfzh=new.ord_sfzhm ,  old.ord_qwsr=new.ord_qwsr ,  old.ord_khxm=new.ord_khxm ,  old.ord_jyfs=new.ord_jyfs
from order_199 new ,order_202 old 
where  new.ord_id=@ordid 
 and old.ord_id=new.ord_fordid
'
if (@condition>'') set @newsql=@newsql+' and ('+@condition+') ' 

exec sp_executesql @newsql, N'@cmpid int,@useruid int,@bizid int,@ordbcid int,@ordid bigint,@jbid bigint,@ftype varchar(10),@fbizid int,@fordid bigint,@ford2tag int ,@ford2id bigint,@rtype varchar(10),@rbizid int,@rordid bigint,@rord2tag int ,@rord2id bigint,@newobjid bigint,@ident varchar(40),@authority varchar(300),@bcid int ', @cmpid,@useruid,@bizid,@ordbcid,@ordid,@jbid,@ftype,@fbizid,@fordid,@ford2tag,@ford2id,@rtype,@rbizid,@rordid,@rord2tag,@rord2id,@newobjid,@ident,@authority,@bcid 
end 

--- 下面这段程序，是完成帐务处理------

--- 帐务处理完毕 ------

--- 下面这段程序，是完成物资帐务处理------

--- 物资帐务处理完毕 ------


end