I'm trying to validate the price of Invoice to be the same as Sales Order to prevent an user to make changes in moment of add Invoice document. So I made this code in transaction notification to block the user when he makes a mistake.
But the point is, even if don't change anything I got block and error message appears. I can't see anymore where I got wrong on this code.
Anyone could help me?
IF (@error = 0) AND (@object_type in ('13')) AND (@transaction_type IN ('A')) BEGIN select @sTmp = 'TRUE', @error_message = case when ( T1.Price != T2.Price ) then 'Price dismatch with base document! Please review the price!' end FROM [dbo].[OINV] T0 INNER JOIN [dbo].[INV1] T1 ON T0.[DocEntry] = T1.[DocEntry] LEFT JOIN [dbo].[RDR1] T2 ON T2.[DocEntry] = T1.[BaseRef] INNER JOIN [dbo].[ORDR] T3 ON T3.[DocEntry] = T2.[DocEntry] where T3.[DocEntry] = @list_of_cols_val_tab_del and ( ( T1.Price != T2.Price ) ) if (@sTmp <> 'FALSE') begin set @error = 1 end END