DROP PROCEDURE IF EXISTS uspGetAlkalmazottIdByGUID
GO
  CREATE PROCEDURE uspGetAlkalmazottIdByGUID
     @pAlkalmazottGuid NVARCHAR(36)
    ,@pTanevId INT
    ,@pIntezmenyId INT
  AS
  BEGIN
    SET NOCOUNT ON;

    SELECT a.ID
    FROM T_ALKALMAZOTT_OSSZES a
    INNER JOIN T_FELHASZNALO_OSSZES f ON f.ID = a.ID
      AND f.TOROLT = 'F'
    WHERE f.C_EGYEDIAZONOSITO = @pAlkalmazottGuid
      AND a.C_ALTANEVID = @pTanevId
      AND a.C_ALINTEZMENYID = @pIntezmenyId
      AND a.TOROLT = 'F'
  END
