create trigger icsubcontract_cust
on icsubcontract
for insert,update
as --if exists(select 1 from sys.triggers where object_name(parent_id)='icsubcontract') drop trigger icsubcontract_cust
begin
update b set forderno=c.fsourcebillno,finteridorder_src=c.fsourceinterid,fentryidorder_src=c.fsourceentryid from inserted a inner join icsubcontractentry b on a.finterid=b.finterid left outer join porequestentry c on b.finterid_src=c.finterid and b.fentryid_src=c.fentryid where abs(c.fsourcetrantype) in (87)
if exists(select 1 from inserted a,t_item b where a.fsupplyid=b.fitemid and isnull(fchkuserid,0)=0)
begin
rollback tran
raiserror('供应商资料没有审核,请联络财务部审核该资料',18,18)
end
end