控制审核单据 更改物料单价
ALTER TRIGGER [dbo].[ICStockBill_updateprice]
ON [dbo].[ICStockBill]
FOR update
AS
SET NOCOUNT ON
if exists (select 1 from deleted where ftrantype =1 and frob=1 and isnull(fcheckerid,0)=0)
begin
if exists (select 1 from inserted where ftrantype =1 and frob=1 and isnull(fcheckerid,0)>0)
begin
declare @fitemid int
declare @fprice decimal(18, 4)
declare @forderprice decimal(18, 4)
select @fitemid=tt.fitemid,@fprice=tt.fprice,@forderprice=t1.forderprice from icstockbillentry tt
left join t_ICItemCore t1 on tt.fitemid=t1.fitemid
where finterid in (select finterid from inserted)
INSERT INTO zt_wg_updatepricetime(fitemid,forderprice_old,forderprice_new,ftype,fupdatetime)
VALUES(@fitemid,@forderprice,