﻿DROP PROCEDURE IF EXISTS uspGetOraSorszamByOsztaly
GO

CREATE PROCEDURE uspGetOraSorszamByOsztaly
   @osztalyCsoportId int
  ,@datum date
  ,@intezmenyId int
  ,@tanevId int
AS
SET NOCOUNT ON;

SELECT
   t.ID AS TanitasiOraId
  ,t.C_ORAEVESSORSZAMA AS Sorszam
FROM T_TANITASIORA_OSSZES t
WHERE t.C_MEGTARTOTT = 'T'
AND t.C_SORSZAMOZANDO = 'T'
AND t.C_DATUM <= @datum
AND t.TOROLT = 'F'
AND t.C_INTEZMENYID = @intezmenyid
AND t.C_TANEVID = @tanevId
AND t.C_OSZTALYCSOPORTID = @osztalyCsoportId

GO