Описание
(Нет описания для триггера IT_SetRRWRegister)
Определение
CREATE TRIGGER "IT_SetRRWRegister" FOR IT
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
as
declare RegisterID integer;
begin /*
if ((new.transporttypeid = 2) and
(new.OPERATIONID is not null) and
exists (select *
from OPERATION
where OperationID = new.OperationID and Operationsubtype = 0) and
(it.InvoiceID is not null)) then
begin
select RegisterID
from INVOICES
where INVOICES.INVOICEID = new.INVOICEID
into
:RegisterID;
if (:RegisterID is null) then
-- insert
begin
RegisterID = GEN_ID(Invoiceregisters_idgen, 1);
insert into Invoiceregisters
values (:RegisterID, new.TRANSPORTNUMBER, null, null, null, null);
update Invoices
set Registerid = :RegisterID
where InvoiceID = new.InvoiceID;
end
else
-- update
update Invoiceregisters
set Invoiceregisters.Registernumber = new.TRANSPORTNUMBER
where
Invoiceregisters.InvoiceregisterID =
(select RegisterID
from INVOICES
where INVOICES.INVOICEID = new.INVOICEID);
end
*/ POST_EVENT '$$IBE$$';
end