create trigger poorder_cust --控制采购订单的价格必须大于0on poorder --if (object_id('poorder_cust','tr') is not null) drop trigger poorder_cust
for insert,update
as
beginif exists(select 1 from inserted a inner join poorderentry b on a.finterid=b.finterid where b.fauxprice=0 and convert(varchar(10),a.fdate,120)>'2019-03-01')beginrollback tranraiserror('没有输入采购单价或者采购单价等于零单据不能正确保存',18,18)endif exists(select 1 from inserted a,t_item b where a.fsupplyid=b.fitemid and isnull(b.fchkuserid,0)=0)beginrollback tranraiserror('供应商资料没有审核,请联络财务部审核该资料',18,18)end
end