init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
|||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
DROP PROCEDURE IF EXISTS sp_GetOsztalyokHaviHianyzasiOsszesitoje
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE sp_GetOsztalyokHaviHianyzasiOsszesitoje
|
||||
@tanevID int,
|
||||
@intezmenyId int
|
||||
|
||||
AS
|
||||
BEGIN
|
||||
|
||||
declare @honapok table(honap int, honapnev nvarchar(max));
|
||||
insert into @honapok
|
||||
select distinct d.c_value, d.c_name as Honap from t_dictionaryitembase d where c_type like 'honap%' order by d.c_value
|
||||
|
||||
select honapnev from @honapok
|
||||
|
||||
DECLARE kur CURSOR FOR
|
||||
select distinct d.c_value as Honap from t_dictionaryitembase d where c_type like 'honap%'
|
||||
|
||||
DECLARE @Honap int
|
||||
|
||||
OPEN kur
|
||||
FETCH NEXT FROM kur INTO @Honap
|
||||
|
||||
WHILE @@FETCH_STATUS = 0 BEGIN
|
||||
create table #tabla(COLUMN379 nvarchar(max), [1] int,[2] int,[3] int,[4] int,[5] int,[6] int,[7] int,[8] int,[9] int,[10] int,[11] int,[12] int,[13] int,[14] int,[15] int,[16] int,[17] int,[18] int,[19] int,[20] int,[21] int,[22] int,[23] int,[24] int,[25] int,[26] int,[27] int,[28] int,[29] int,[30] int,[31] int, COLUMN2672 int, COLUMN1910 int, COLUMN5197 int, COLUMN1786 int, COLUMN1787 int, COLUMN1788 int, COLUMN1789 int, COLUMN1911 int)
|
||||
insert into #tabla
|
||||
EXEC uspGetOsztalyokHaviHianyzasiOsszesitoje_honapra @tanevID, @intezmenyId, @honap
|
||||
SELECT * from #tabla
|
||||
drop table #tabla
|
||||
FETCH NEXT FROM kur INTO @honap
|
||||
END
|
||||
|
||||
CLOSE kur
|
||||
DEALLOCATE kur
|
||||
|
||||
END
|
|
@ -0,0 +1,66 @@
|
|||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
DROP PROCEDURE IF EXISTS uspGetOsztalyokHaviHianyzasiOsszesitoje_honapra
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE uspGetOsztalyokHaviHianyzasiOsszesitoje_honapra
|
||||
@tanevID int,
|
||||
@intezmenyId int,
|
||||
@honap int
|
||||
|
||||
AS
|
||||
BEGIN
|
||||
|
||||
--Összes osztály
|
||||
create table #osztaly (Id int)
|
||||
insert into #osztaly
|
||||
select ocs.id as Id from t_osztalycsoport ocs
|
||||
inner join t_osztaly o on o.id=ocs.id
|
||||
where ocs.torolt='F' and ocs.c_tanevid=@tanevid and ocs.c_intezmenyid=@intezmenyid
|
||||
|
||||
--Igazolások és típusai
|
||||
create table #igazolas (Osztaly int, IgazoltE nvarchar(1), IgazolasTipus int)
|
||||
insert into #igazolas
|
||||
select tao.c_osztalycsoportid as Osztaly, tm.c_igazolt as IgazoltE, tm.c_igazolastipusa as IgazolasTipus from t_tanulomulasztas tm
|
||||
inner join t_tanitasiora tao on tao.id=tm.c_tanitasiorakid and tao.torolt='F' and tao.c_tanevid=@tanevid and tao.c_intezmenyid=@intezmenyid and (CAST(MONTH(tao.c_datum) AS VARCHAR))=@honap
|
||||
where tm.torolt='F' and tm.c_intezmenyid=@intezmenyid and tm.c_tanevid=@tanevid
|
||||
|
||||
--Mulasztások
|
||||
create table #mulasztas (Nap int, Tanulo int, Osztaly int)
|
||||
insert into #mulasztas
|
||||
select CAST(DAY(tao.c_datum) as int) as Nap, tm.c_oratanuloiid as Tanulo, tao.c_osztalycsoportid as Osztaly from t_tanulomulasztas tm
|
||||
inner join t_tanitasiora tao on tao.id=tm.c_tanitasiorakid and tao.torolt='F' and tao.c_tanevid=@tanevid and tao.c_intezmenyid=@intezmenyid and (CAST(MONTH(tao.c_datum) AS VARCHAR))=@honap
|
||||
where tm.torolt='F' and tm.c_intezmenyid=@intezmenyid and tm.c_tanevid=@tanevid
|
||||
|
||||
select ocs.c_nev as COLUMN379,
|
||||
iif(m.[1]=0, null, m.[1]) as [1], iif(m.[2]=0, null, m.[2]) as [2], iif(m.[3]=0, null, m.[3]) as [3], iif(m.[4]=0, null, m.[4]) as [4], iif(m.[5]=0, null, m.[5]) as [5],
|
||||
iif(m.[6]=0, null, m.[6]) as [6], iif(m.[7]=0, null, m.[7]) as [7], iif(m.[8]=0, null, m.[8]) as [8], iif(m.[9]=0, null, m.[9]) as [9], iif(m.[10]=0, null, m.[10]) as [10],
|
||||
iif(m.[11]=0, null, m.[11]) as [11], iif(m.[12]=0, null, m.[12]) as [12], iif(m.[13]=0, null, m.[13]) as [13], iif(m.[14]=0, null, m.[14]) as [14], iif(m.[15]=0, null, m.[15]) as [15],
|
||||
iif(m.[16]=0, null, m.[16]) as [16], iif(m.[17]=0, null, m.[17]) as [17], iif(m.[18]=0, null, m.[18]) as [18], iif(m.[19]=0, null, m.[19]) as [19], iif(m.[20]=0, null, m.[20]) as [20],
|
||||
iif(m.[21]=0, null, m.[21]) as [21], iif(m.[22]=0, null, m.[22]) as [22], iif(m.[23]=0, null, m.[23]) as [23], iif(m.[24]=0, null, m.[24]) as [24], iif(m.[25]=0, null, m.[25]) as [25],
|
||||
iif(m.[26]=0, null, m.[26]) as [26], iif(m.[27]=0, null, m.[27]) as [27], iif(m.[28]=0, null, m.[28]) as [28], iif(m.[29]=0, null, m.[29]) as [29], iif(m.[30]=0, null, m.[30]) as [30],
|
||||
iif(m.[31]=0, null, m.[31]) as [31]
|
||||
, Osszes.Osszes as COLUMN2672, Igazolt.Igazolt as COLUMN2568, Egyeb.Egyeb as COLUMN5197, Orvosi.Orvosi as COLUMN1786, Szuloi.Szuloi as COLUMN1787, Hivatalos.Hivatalos as COLUMN1788, IskolaErdeku.IskolaErdeku as COLUMN1789, Igazolatlan.Igazolatlan as COLUMN1911
|
||||
from #osztaly o
|
||||
left join (select * from #mulasztas m pivot (count(Tanulo) for Nap in ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]))pv) m on m.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as Osszes from #igazolas group by Osztaly) Osszes on Osszes.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as Igazolt from #igazolas i where i.IgazoltE='T' group by Osztaly) Igazolt on Igazolt.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as Igazolatlan from #igazolas i where i.IgazoltE='F' group by Osztaly) Igazolatlan on Igazolatlan.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as Egyeb from #igazolas i where i.IgazolasTipus=1529 group by Osztaly) Egyeb on Egyeb.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as Orvosi from #igazolas i where i.IgazolasTipus=1530 group by Osztaly) Orvosi on Orvosi.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as Szuloi from #igazolas i where i.IgazolasTipus=1531 group by Osztaly) Szuloi on Szuloi.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as Hivatalos from #igazolas i where i.IgazolasTipus=1532 group by Osztaly) Hivatalos on Hivatalos.Osztaly=o.Id
|
||||
left join (select Osztaly, count(Osztaly) as IskolaErdeku from #igazolas i where i.IgazolasTipus=1533 group by Osztaly) IskolaErdeku on IskolaErdeku.Osztaly=o.Id
|
||||
inner join t_osztalycsoport ocs on ocs.id=o.Id
|
||||
order by ocs.c_nev
|
||||
|
||||
drop table #mulasztas
|
||||
drop table #osztaly
|
||||
drop table #igazolas
|
||||
|
||||
END
|
||||
|
||||
GO
|
Loading…
Add table
Add a link
Reference in a new issue