![]() |
---|
CREATE trigger TR_INVOICE_INSERTONLY on dbo.INVOICE after insert not for replication as begin begin try if not exists( select V.ID from INSERTED I inner join dbo.FINANCIALTRANSACTION F on F.ID = I.ID inner join dbo.VENDOR V on V.ID = F.CONSTITUENTID where V.ALLOWTOCREATEINVOICES = 1) begin raiserror('Vendor has been marked ?Do not allow invoices?. You cannot create new invoices for this vendor.', 13, 1); end end try begin catch exec dbo.USP_RAISE_ERROR; end catch end |