Procedura-SYS$CC_GetAddressOwner

Popis:
Pro adresu dohledá vlastníka a jeho ID (pro plnění tabulek SYS$CC....)

Parametry:

NázevPopisDatový typ
IN_Address_IDChar(10)

Návratové hodnoty:

NázevPopisDatový typ
Owner_IDChar(10)
OwnerTypeInteger

Tělo:

begin
  OwnerType = -1;
  Owner_ID = null;
  --firma
  select ID from Firms where ResidenceAddress_ID = :IN_Address_ID into Owner_ID;
  if (Owner_ID is not null) then
    OwnerType = 1;
  --provozovna  
  if (OwnerType = -1) then begin
    select ID from FirmOffices where Address_ID = :IN_Address_ID and SynchronizeAddress = 'N' into Owner_ID;
    if (Owner_ID is not null) then
      OwnerType = 2;
  end
  --osoba
  if (OwnerType = -1) then begin
    select ID from Persons where Address_ID = :IN_Address_ID into Owner_ID;
    if (Owner_ID is not null) then
      OwnerType = 3;
  end 
  suspend;
end

Generated by ABRA Software a.s. 27.10.2021 16:35:10