COGNOS QUERY
STRUCTURE,1,1
DATABASE,Kalender
DATASOURCENAME,C:\GAPS\Portal\System\IQD\Belege\current_date_Prognose_operativ.imr
TITLE,current_date_Prognose_operativ.imr
BEGIN SQL
select c1 as c1,
	   c2 as c2,
	   c3 as c3,
	   c4 as c4,
	   c5 as c5,
	   c6 as c6,
	   c7 as c7,
	   c8 as c8,
	   c9 as c9,
	   c10 as c10,
	   c11 as c11,
	   CASE WHEN (c4 = 1) THEN (RCOUNT(c4)) ELSE null END as c12,
	   c13 as c13
from 
(select T1."bundeslaender_id" as c1,
	   T1."datum" as c2,
	   T1."wochentage_id" as c3,
	   T1."arbeitstag_mofr" as c4,
	   T1."zaehler_mofr" as c5,
	   T1."summe_mofr" as c6,
	   T1."arbeitstag_mosa" as c7,
	   T1."zaehler_mosa" as c8,
	   T1."summe_mosa" as c9,
	   T1."feiertage_id" as c10,
	   (@CURRENT_DATE) as c11,
	   CASE WHEN (T1."datum" BETWEEN TIMESTAMP '2008-01-01 00:00:00.000' AND TIMESTAMP '2008-12-31 00:00:00.000') THEN (252) WHEN (T1."datum" BETWEEN TIMESTAMP '2009-01-01 00:00:00.000' AND TIMESTAMP '2009-12-31 00:00:00.000') THEN (252) WHEN (T1."datum" BETWEEN TIMESTAMP '2010-01-01 00:00:00.000' AND TIMESTAMP '2010-12-31 00:00:00.000') THEN (253) WHEN (T1."datum" BETWEEN TIMESTAMP '2011-01-01 00:00:00.000' AND TIMESTAMP '2011-12-31 00:00:00.000') THEN (250) WHEN (T1."datum" BETWEEN TIMESTAMP '2012-01-01 00:00:00.000' AND TIMESTAMP '2012-12-31 00:00:00.000') THEN (249) ELSE (250) END as c13
from "Arbeitstage" T1
where ((((((T1."bundeslaender_id" = '2') and (T1."arbeitstag_mofr" = 1)) and ((od_year(T1."datum")) = (od_year(((@CURRENT_DATE)))))) and (T1."datum" <= ((@CURRENT_DATE)))) and (T1."datum" <= ((@CURRENT_DATE)))) or ((((T1."bundeslaender_id" = '2') and ((od_year(T1."datum")) = (od_year(((@CURRENT_DATE)))))) and (T1."datum" <= ((@CURRENT_DATE)))) and (T1."datum" IN (TIMESTAMP '2020-01-01 00:00:00.000',TIMESTAMP '2021-01-01 00:00:00.000',TIMESTAMP '2022-01-01 00:00:00.000',TIMESTAMP '2023-01-01 00:00:00.000',TIMESTAMP '2024-01-01 00:00:00.000'))))
order by c1 asc,c2 asc,c3 asc,c4 asc,c5 asc,c6 asc,c7 asc,c8 asc,c9 asc,c10 asc,c13 asc
) D1

END SQL
COLUMN,0,Bundeslaender Id
COLUMN,1,Datum
COLUMN,2,Wochentage Id
COLUMN,3,Arbeitstag Mofr
COLUMN,4,Zaehler Mofr
COLUMN,5,Summe Mofr
COLUMN,6,Arbeitstag Mosa
COLUMN,7,Zaehler Mosa
COLUMN,8,Summe Mosa
COLUMN,9,Feiertage Id
COLUMN,10,Jahr
COLUMN,11,Arbeitstag Nr Jahr
COLUMN,12,Gesamt Arbeitstage

