init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,69 @@
|
|||
DROP PROCEDURE IF EXISTS uspGetMulasztasokSzama
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE uspGetMulasztasokSzama
|
||||
@pTanevId int
|
||||
,@pTanarId int
|
||||
,@pDarab int
|
||||
,@pMulasztasTipusKeses int
|
||||
,@pMulasztasTipusHianyzas int
|
||||
,@pIsSzuperOsztalyFonok bit
|
||||
AS BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
DECLARE
|
||||
@sql nvarchar(max)
|
||||
|
||||
SET @sql = N'
|
||||
SELECT TOP (@pDarab)
|
||||
tn.C_DATUM AS MulasztasDatuma
|
||||
,FORMAT(tn.C_DATUM, ''dddd'', ''hu-HU'') AS MulasztasNapja
|
||||
,COUNT(tm.ID) AS MulasztasokSzama
|
||||
FROM T_TANULOMULASZTAS_OSSZES tm
|
||||
INNER JOIN T_TANITASIORA_OSSZES tn ON tn.ID = tm.C_TANITASIORAKID
|
||||
AND tn.TOROLT = ''F''
|
||||
LEFT JOIN T_OSZTALY_OSSZES o ON o.ID = tn.C_OSZTALYCSOPORTID
|
||||
AND o.TOROLT = ''F''
|
||||
'
|
||||
|
||||
IF @pIsSzuperOsztalyFonok = 0
|
||||
SET @sql += N'
|
||||
AND (o.C_OSZTALYFONOKID = @pTanarId OR o.C_OFOHELYETTESID = @pTanarId)
|
||||
'
|
||||
|
||||
SET @sql += N'
|
||||
LEFT JOIN T_CSOPORT_OSSZES cs ON cs.ID = tn.C_OSZTALYCSOPORTID
|
||||
AND cs.TOROLT = ''F''
|
||||
'
|
||||
|
||||
IF @pIsSzuperOsztalyFonok = 0
|
||||
SET @sql += N'
|
||||
AND cs.C_CSOPORTVEZETOID = @pTanarId
|
||||
'
|
||||
|
||||
SET @sql += N'
|
||||
WHERE tm.C_TANEVID = @pTanevId
|
||||
AND tm.TOROLT = ''F''
|
||||
AND tm.C_IGAZOLT IS NULL
|
||||
AND tm.C_TIPUS BETWEEN @pMulasztasTipusKeses AND @pMulasztasTipusHianyzas
|
||||
AND COALESCE(o.ID, cs.ID) IS NOT NULL
|
||||
GROUP BY
|
||||
tn.C_DATUM
|
||||
ORDER BY
|
||||
tn.C_DATUM DESC
|
||||
'
|
||||
|
||||
EXEC sp_executesql @sql, N'
|
||||
@pTanevId int
|
||||
,@pTanarId int
|
||||
,@pDarab int
|
||||
,@pMulasztasTipusKeses int
|
||||
,@pMulasztasTipusHianyzas int'
|
||||
,@pTanevId = @pTanevId
|
||||
,@pTanarId = @pTanarId
|
||||
,@pDarab = @pDarab
|
||||
,@pMulasztasTipusKeses = @pMulasztasTipusKeses
|
||||
,@pMulasztasTipusHianyzas = @pMulasztasTipusHianyzas
|
||||
|
||||
END
|
||||
GO
|
Loading…
Add table
Add a link
Reference in a new issue