--FYI
--用戶張三(FUserId=48)只能審核倉庫A(FItemId=4848)的出入庫單據
create trigger Self_Bill_CheckUser on IcStockBill
after update
as
begin
set nocount on
--張三正在執行審核操作,可對 a.ftrantype指定特定的單據類型,如:
-- a.ftrantype=24 就是領料單
if exists (select 1 from inserted a inner join deleted b on a.finterid=b.finterid where a.fcheckerid=48 and isnull(b.fcheckerid,0)=0 )
begin
--如果此單據存在倉庫的ID不為4848,則回滾操作
-- a.fscstockid 為出庫倉庫 a.fdcstockid 為入庫倉 請加以區分
if (select top 1 a.fscstockid from icstockbillentry a inner join inserted b on a.finterid=b.finterid order by a.fentryid )<>4848
begin
raiserror(N'無權限!')
rollback tran
end
end
end
修改时间:2008-4-25 17:07:42
修改时间:2008-4-25 17:11:39
修改时间:2008-4-28 14:35:48