FBEA#83511 Filteren op vrije dagen en vrije ruimten in reserveringsoverzicht

svn path=/Customer/trunk/; revision=65294
This commit is contained in:
Suzan Wiegerinck
2024-06-26 11:38:05 +00:00
parent 1cacafcc35
commit 56317e4004

View File

@@ -1462,6 +1462,115 @@ AS
AND rsv.res_activiteit_key = ra.res_activiteit_key
AND ra.res_srtactiviteit_key = rsa.res_srtactiviteit_key
AND rsa.res_srtactiviteit_key = 30;
CREATE OR REPLACE VIEW FBEA_V_RAP_PLANNING
AS
SELECT alle_ruimten.datum,
alle_ruimten.dag,
alle_ruimten.res_ruimte_nr,
COALESCE (ROUND(aantallen.duur_res, 1) , 0) tot_duur
FROM (SELECT rr.res_ruimte_key,
rr.res_ruimte_nr,
datum,
dag
FROM res_ruimte rr,
( SELECT TRUNC (SYSDATE) + LEVEL - 1 AS datum,
TO_CHAR (TRUNC (SYSDATE) + LEVEL - 1, 'DAY') dag
FROM DUAL
CONNECT BY LEVEL <= SYSDATE - SYSDATE + 365) d
WHERE rr.res_discipline_key = 241
AND rr.res_ruimte_verwijder IS NULL
AND (rr.res_ruimte_vervaldatum > SYSDATE OR rr.res_ruimte_vervaldatum IS NULL))
alle_ruimten,
( SELECT d.dag,
d.datum,
r.res_ruimte_key,
r.ruimte,
SUM (r.duur) duur_res
FROM (SELECT ur.datum,
ur.datum_van,
ur.datum_tot,
ur.duur,
ur.res_ruimte_key,
ur.ruimte_nr ruimte,
ur.key
FROM (SELECT rrr.res_rsv_ruimte_key
key,
res.res_reservering_key || '/' || rrr.res_rsv_ruimte_volgnr
reservering,
rrr.res_rsv_ruimte_omschrijving,
rrr.res_rsv_ruimte_aanmaak,
r2a.ruimte_nr,
r2a.res_ruimte_key,
(SELECT ins_discipline_key
FROM ins_tab_discipline d,
res_ruimte_opstelling ro,
res_ruimte rr
WHERE rrr.res_ruimte_opstel_key = ro.res_ruimte_opstel_key
AND ro.res_ruimte_key = rr.res_ruimte_key
AND rr.res_discipline_key = d.ins_discipline_key)
catalogus_key,
(SELECT ins_discipline_omschrijving
FROM ins_tab_discipline d,
res_ruimte_opstelling ro,
res_ruimte rr
WHERE rrr.res_ruimte_opstel_key = ro.res_ruimte_opstel_key
AND ro.res_ruimte_key = rr.res_ruimte_key
AND rr.res_discipline_key = d.ins_discipline_key)
catalogus,
DECODE (rrr.alg_ruimte_key, NULL, 'Ja', 'Nee')
reserveerbare_ruimte,
TRUNC (rrr.res_rsv_ruimte_van)
datum,
rrr.res_rsv_ruimte_van
datum_van,
rrr.res_rsv_ruimte_tot
datum_tot,
COALESCE (
(rrr.res_rsv_ruimte_tot - rrr.res_rsv_ruimte_van) * 24,
0)
duur,
rrr.res_rsv_ruimte_opmerking
FROM res_v_aanwezigrsv_ruimte rrr,
res_activiteit ra,
res_srtactiviteit rsa,
res_reservering res,
( SELECT res_rsv_ruimte_key,
MAX (o.res_opstelling_omschrijving) opstelling,
MAX (ro.res_ruimte_opstel_bezoekers) capaciteit,
MAX (ra.alg_ruimte_key) alg_ruimte_key,
MAX (rr.res_ruimte_nr) ruimte_nr,
MAX (ra.res_ruimte_key) res_ruimte_key
FROM res_rsv_ruimte r,
res_ruimte_opstelling ro,
res_opstelling o,
res_ruimte rr,
res_alg_ruimte ra
WHERE r.res_rsv_ruimte_verwijder IS NULL
AND r.res_ruimte_opstel_key = ro.res_ruimte_opstel_key
AND ro.res_ruimte_key = rr.res_ruimte_key
AND ro.res_opstelling_key = o.res_opstelling_key
AND rr.res_ruimte_key = ra.res_ruimte_key
GROUP BY res_rsv_ruimte_key) r2a
WHERE rrr.res_reservering_key = res.res_reservering_key
AND rrr.res_rsv_ruimte_key = r2a.res_rsv_ruimte_key(+)
AND rrr.res_activiteit_key = ra.res_activiteit_key
AND ra.res_srtactiviteit_key = rsa.res_srtactiviteit_key) ur
WHERE UPPER (ur.reserveerbare_ruimte) = 'JA'
AND ur.catalogus_key = 241
AND ur.datum_van BETWEEN SYSDATE AND SYSDATE + 365) r,
( SELECT TRUNC (SYSDATE) + LEVEL - 1 AS datum,
TO_CHAR (TRUNC (SYSDATE) + LEVEL - 1, 'DAY') dag
FROM DUAL
CONNECT BY LEVEL <= SYSDATE - SYSDATE + 365) d
WHERE r.datum(+) = d.datum
GROUP BY d.dag,
d.datum,
r.res_ruimte_key,
r.ruimte
ORDER BY datum) aantallen
WHERE aantallen.datum(+) = alle_ruimten.datum
AND aantallen.res_ruimte_key(+) = alle_ruimten.res_ruimte_key;
------ payload end ------