"localhost:/firebird/data/ILICHEVSK2.FDB". Триггеры Previous topic Chapter index Next topic

IT_SET_BUH_QUALITY

 

Описание

(Нет описания для триггера IT_SET_BUH_QUALITY)

 

Определение

CREATE TRIGGER IT_SET_BUH_QUALITY FOR IT
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
as
declare ISLAB integer;
declare SENDERQUALITYID integer;

begin
  select ITTRANSPORT.SENDERQUALITYID
    from ITTRANSPORT
    where (ITTRANSPORT.INVENTORYID = new.INVENTORYID)
  into :SENDERQUALITYID;

  if (:SENDERQUALITYID is not null) then begin
    select QUALITYDATA.QUALITYVALUE
      from QUALITYDATA
      where (QUALITYDATA.QUALITYID = :SENDERQUALITYID)
        and (QUALITYDATA.qualitytypeid = 200)
    into :ISLAB;

    if (:ISLAB is not null) then begin
      if (:ISLAB = 0) then
        new.BUHQUALITYID = new.LABQUALITYID;
      else
        if (:ISLAB = 1) then
          new.BUHQUALITYID = :SENDERQUALITYID;
    end
    else new.BUHQUALITYID = new.LABQUALITYID;

  end
  else new.BUHQUALITYID = new.LABQUALITYID;
end

 

     Previous topic Chapter index Next topic