﻿
DROP PROCEDURE IF EXISTS uspGetAlkalmazottakAlapErtekekkel
GO

CREATE PROCEDURE uspGetAlkalmazottakAlapErtekekkel
    @pTanevID int
   ,@pSzuletesiHely nvarchar(500)
   ,@pSzuletesiDatum datetime
   ,@pNevKulso nvarchar(500)
   ,@pNevKulsoGyak nvarchar(500)
   ,@pNevHittanOktat nvarchar(500)
   ,@pNevBetoltetlen nvarchar(500)
AS
BEGIN
  SET NOCOUNT ON;
  SELECT fh.C_NYOMTATASINEV AS AlkalmazottNev
        
  FROM T_FELHASZNALO_OSSZES fh
  INNER JOIN T_ALKALMAZOTT_OSSZES a ON fh.ID = a.ID AND a.TOROLT = 'F' 
  INNER JOIN T_TANEV_OSSZES t ON a.C_ALTANEVID = t.ID AND t.C_AKTIV = 'T' AND t.TOROLT = 'F' AND t.ID = @pTanevID
  WHERE fh.TOROLT = 'F' 
    AND fh.C_SZULETESIDATUM = @pSzuletesiDatum 
    AND fh.C_SZULETESIHELY = @pSzuletesiHely 
    AND fh.C_ANYJANEVE  IN (@pNevKulso,@pNevKulsoGyak,@pNevHittanOktat,@pNevBetoltetlen)
    AND fh.C_SZULETESINEV IN (@pNevKulso,@pNevKulsoGyak,@pNevHittanOktat,@pNevBetoltetlen)

END
GO
