Описание
(Нет описания для триггера IT_SetWeightTimes)
Определение
CREATE TRIGGER "IT_SetWeightTimes" FOR IT
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
as
declare variable TRANSPORTTYPEID integer;
declare variable COMMENT varchar(31);
begin
if (not ((new.GROSS is null) and (new.TARE is null) and (new.NET is null))) then begin
if ((old.NET is null) and (new.NET is not null)) then
execute procedure USERS_GETID null returning_values new.WEIGHTUSERID;
if ((old.GROSS is null) and (new.GROSS is not null) and (new.GROSSTIME is null)) then
new.GROSSTIME = current_timestamp;
if ((old.TARE is null) and (new.TARE is not null) and (new.TARETIME is null)) then
new.TARETIME = current_timestamp;
end
-- if (new.net is not null and old.net is null and new.RegDate is null)
-- then
if (new.REGDATE is null) then begin
select ITTRANSPORT.TRANSPORTTYPEID
from ITTRANSPORT
where (ITTRANSPORT.INVENTORYID = new.INVENTORYID)
into :TRANSPORTTYPEID;
if (TRANSPORTTYPEID = 2) then
select ITTRANSPORT.SAMPLERINDATE
from ITTRANSPORT
where (ITTRANSPORT.INVENTORYID = new.INVENTORYID)
into new.REGDATE;
-- new.RegDate = current_date;
end
end