Procedura-IncDocRef

Popis:
Zvýší interní referenci na použitý doklad

Parametry:

NázevPopisDatový typ
IN_DocumentTypeVarChar(2)
IN_Document_IDChar(10)

Tělo:

begin
  if (:IN_Document_ID is not null and IN_DocumentType <> '') then begin
    TempReference = -1;
    select Reference from SYS$REFCOUNT2
      where ID = :IN_Document_ID and DocumentType = :IN_DocumentType
      into :TempReference;
    if (TempReference > -1) then begin
      update SYS$REFCOUNT2 set REFERENCE = REFERENCE + 1
        where ID = :IN_Document_ID and DocumentType = :IN_DocumentType;
    end
    else begin
      insert into SYS$REFCOUNT2(DocumentType, ID, Reference) VALUES (:IN_DocumentType, :IN_Document_ID, 1);
    end
  end
end;

Generated by ABRA Software a.s. 27.10.2021 16:34:16