Procedura-DecDocRef

Popis:
Sníží 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;
    update SYS$REFCOUNT2 set REFERENCE = REFERENCE - 1
      where ID = :IN_Document_ID and DocumentType = :IN_DocumentType;
    select Reference from SYS$REFCOUNT2
      where ID = :IN_Document_ID and DocumentType = :IN_DocumentType
      into :TempReference;
    if (TempReference < 1) then
      delete from SYS$REFCOUNT2 where ID = :IN_Document_ID and DocumentType = :IN_DocumentType;
  end
end;

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