KFSG#58877 Stickers Eurest (op A6 gegroepeerd per Catalogus/Reservering/Levertijd)
svn path=/Customer/trunk/; revision=44141
This commit is contained in:
333
KFSG/kfsg.sql
333
KFSG/kfsg.sql
@@ -2959,10 +2959,7 @@ AS
|
||||
AND a.prs_kostenplaats_key = k.prs_kostenplaats_key(+)
|
||||
AND p.prs_perslid_key = pf.prs_perslid_key;
|
||||
|
||||
------ payload end ------
|
||||
|
||||
----UDR VIEW INCL KENKMERKEN KFSG#58766 -----
|
||||
|
||||
CREATE OR REPLACE VIEW KFSG_BEZ_V_UDR_BEZOEKERS
|
||||
(
|
||||
KEY,
|
||||
@@ -3091,6 +3088,336 @@ AS
|
||||
AND rrd.res_deel_key = rd.res_deel_key(+)
|
||||
AND a.bez_afspraak_datum >= TO_DATE ('01-01-2010', 'DD-MM-YYYY');
|
||||
|
||||
-- KFSG#58877: Sticker Eurest (standaard UDR-view plus Telefoon- en Opmerking-
|
||||
-- veld)!
|
||||
CREATE OR REPLACE VIEW KFSG_V_UDR_RESERVERINGINCL
|
||||
(
|
||||
KEY,
|
||||
NUMMER,
|
||||
RES_OMSCHRIJVING,
|
||||
INVOERDATUM,
|
||||
DATUM,
|
||||
GASTHEER,
|
||||
CONTACT,
|
||||
INVOERDER,
|
||||
KOSTENSOORTGROEP,
|
||||
KOSTENSOORT,
|
||||
KPN,
|
||||
KPN_OMSCHRIJVING,
|
||||
KPN_EXTERN,
|
||||
FCLT_3D_AFDELING_KEY,
|
||||
AFDELING_CODE,
|
||||
AFDELING_OMSCHRIJVING,
|
||||
REGIO_OMSCHRIJVING,
|
||||
DISTRICT_OMSCHIJVING,
|
||||
FCLT_3D_LOCATIE_KEY,
|
||||
LOCATIE,
|
||||
LOCATIE_OMSCHRIJVING,
|
||||
LOCATIE_PLAATS,
|
||||
GEBOUW,
|
||||
VERDIEPING,
|
||||
RUIMTE,
|
||||
OPSTELLING,
|
||||
CAPACITEIT,
|
||||
NO_SHOW,
|
||||
MANDAAT,
|
||||
PERSONEELSNR, -- Gastheer/vrouw?
|
||||
FCLT_3D_DISCIPLINE_KEY,
|
||||
CATALOGUS_KEY,
|
||||
CATALOGUS,
|
||||
RESERVEERBARE_RUIMTE,
|
||||
BEZOEKERS,
|
||||
VAN,
|
||||
TOT,
|
||||
DUUR,
|
||||
STATUS,
|
||||
BOSTATUS,
|
||||
ACTIVITEIT,
|
||||
SRTACTIVITEIT_KEY,
|
||||
ACTIVITEITSOORT,
|
||||
VOORZIENING_DISCIPLINE_KEY,
|
||||
VOORZIENING_TYPE,
|
||||
VOORZIENING_CATALOGUS,
|
||||
LEVERANCIER,
|
||||
VOORZIENING_PRODUCT_KEY,
|
||||
VOORZIENING_PRODUCT,
|
||||
VOORZIENING_TOTAALPRIJS,
|
||||
VOORZIENING_VAN,
|
||||
VOORZIENING_TOT,
|
||||
VOORZIENING_AANTAL,
|
||||
VOORZIENING_PRIJS,
|
||||
GASTHEER_TEL,
|
||||
CONTACT_TEL,
|
||||
RES_OPMERKING
|
||||
)
|
||||
AS
|
||||
SELECT rrr.res_rsv_ruimte_key,
|
||||
res.res_reservering_key || '/' || rrr.res_rsv_ruimte_volgnr,
|
||||
rrr.res_rsv_ruimte_omschrijving,
|
||||
COALESCE (rrr.res_rsv_ruimte_aanmaak, voorz.van),
|
||||
COALESCE (rrr.res_rsv_ruimte_van, voorz.van),
|
||||
(SELECT prs_perslid_naam_full
|
||||
FROM prs_v_perslid_fullnames_all
|
||||
WHERE prs_perslid_key = rrr.res_rsv_ruimte_host_key),
|
||||
(SELECT prs_perslid_naam_full
|
||||
FROM prs_v_perslid_fullnames_all
|
||||
WHERE prs_perslid_key = rrr.res_rsv_ruimte_contact_key),
|
||||
(SELECT pf.prs_perslid_naam_full
|
||||
FROM fac_tracking tr, fac_srtnotificatie str, prs_v_perslid_fullnames_all pf
|
||||
WHERE tr.prs_perslid_key = pf.prs_perslid_key
|
||||
AND tr.fac_srtnotificatie_key = str.fac_srtnotificatie_key
|
||||
AND str.fac_srtnotificatie_code = 'RESNEW'
|
||||
AND tr.fac_tracking_refkey = rrr.res_rsv_ruimte_key),
|
||||
(SELECT ksg.prs_kostensoortgrp_oms
|
||||
FROM prs_kostensoortgrp ksg, prs_kostensoort ks
|
||||
WHERE ksg.prs_kostensoortgrp_key = ks.prs_kostensoortgrp_key
|
||||
AND ks.prs_kostensoort_key =
|
||||
(SELECT prs_kostensoort_key
|
||||
FROM res_discipline
|
||||
WHERE ins_discipline_key =
|
||||
COALESCE (
|
||||
voorz.ins_discipline_key,
|
||||
(SELECT d.ins_discipline_key
|
||||
FROM ins_tab_discipline d, res_ruimte rr, res_ruimte_opstelling ro
|
||||
WHERE d.ins_discipline_key = rr.res_discipline_key
|
||||
AND rr.res_ruimte_key = ro.res_ruimte_key
|
||||
AND ro.res_ruimte_opstel_key = rrr.res_ruimte_opstel_key))))
|
||||
kostensoortgroep,
|
||||
(SELECT prs_kostensoort_oms
|
||||
FROM prs_kostensoort
|
||||
WHERE prs_kostensoort_key =
|
||||
(SELECT prs_kostensoort_key
|
||||
FROM res_discipline
|
||||
WHERE ins_discipline_key =
|
||||
COALESCE (
|
||||
voorz.ins_discipline_key,
|
||||
(SELECT d.ins_discipline_key
|
||||
FROM ins_tab_discipline d, res_ruimte rr, res_ruimte_opstelling ro
|
||||
WHERE d.ins_discipline_key = rr.res_discipline_key
|
||||
AND rr.res_ruimte_key = ro.res_ruimte_key
|
||||
AND ro.res_ruimte_opstel_key = rrr.res_ruimte_opstel_key))))
|
||||
kostensoort,
|
||||
k.prs_kostenplaats_nr,
|
||||
k.prs_kostenplaats_omschrijving,
|
||||
k.prs_kostenplaats_extern,
|
||||
a.prs_afdeling_key,
|
||||
a.prs_afdeling_naam,
|
||||
a.prs_afdeling_omschrijving,
|
||||
(SELECT rg.alg_regio_omschrijving
|
||||
FROM alg_regio rg,
|
||||
alg_district d,
|
||||
alg_locatie l,
|
||||
alg_gebouw g,
|
||||
alg_verdieping v,
|
||||
alg_ruimte r
|
||||
WHERE rg.alg_regio_key = d.alg_regio_key
|
||||
AND d.alg_district_key = l.alg_district_key
|
||||
AND l.alg_locatie_key = g.alg_locatie_key
|
||||
AND g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
(SELECT d.alg_district_omschrijving
|
||||
FROM alg_district d,
|
||||
alg_locatie l,
|
||||
alg_gebouw g,
|
||||
alg_verdieping v,
|
||||
alg_ruimte r
|
||||
WHERE d.alg_district_key = l.alg_district_key
|
||||
AND l.alg_locatie_key = g.alg_locatie_key
|
||||
AND g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
(SELECT l.alg_locatie_key
|
||||
FROM alg_locatie l,
|
||||
alg_gebouw g,
|
||||
alg_verdieping v,
|
||||
alg_ruimte r
|
||||
WHERE l.alg_locatie_key = g.alg_locatie_key
|
||||
AND g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
(SELECT l.alg_locatie_code
|
||||
FROM alg_locatie l,
|
||||
alg_gebouw g,
|
||||
alg_verdieping v,
|
||||
alg_ruimte r
|
||||
WHERE l.alg_locatie_key = g.alg_locatie_key
|
||||
AND g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
(SELECT l.alg_locatie_omschrijving
|
||||
FROM alg_locatie l,
|
||||
alg_gebouw g,
|
||||
alg_verdieping v,
|
||||
alg_ruimte r
|
||||
WHERE l.alg_locatie_key = g.alg_locatie_key
|
||||
AND g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
(SELECT l.alg_locatie_plaats
|
||||
FROM alg_locatie l,
|
||||
alg_gebouw g,
|
||||
alg_verdieping v,
|
||||
alg_ruimte r
|
||||
WHERE l.alg_locatie_key = g.alg_locatie_key
|
||||
AND g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
(SELECT g.alg_gebouw_code
|
||||
FROM alg_gebouw g, alg_verdieping v, alg_ruimte r
|
||||
WHERE g.alg_gebouw_key = v.alg_gebouw_key
|
||||
AND v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
(SELECT v.alg_verdieping_code
|
||||
FROM alg_verdieping v, alg_ruimte r
|
||||
WHERE v.alg_verdieping_key = r.alg_verdieping_key
|
||||
AND r.alg_ruimte_key = r2a.alg_ruimte_key),
|
||||
r2a.ruimte_nr,
|
||||
r2a.opstelling,
|
||||
r2a.capaciteit,
|
||||
rrr.res_rsv_ruimte_noshow,
|
||||
COALESCE ((SELECT fac_profiel_limiet
|
||||
FROM fac_profiel
|
||||
WHERE fac_profiel_key = ph.fac_profiel_key), 0),
|
||||
ph.prs_perslid_nr,
|
||||
COALESCE (
|
||||
voorz.ins_discipline_key,
|
||||
(SELECT d.ins_discipline_key
|
||||
FROM ins_tab_discipline d, res_ruimte rr, res_ruimte_opstelling ro
|
||||
WHERE d.ins_discipline_key = rr.res_discipline_key
|
||||
AND rr.res_ruimte_key = ro.res_ruimte_key
|
||||
AND ro.res_ruimte_opstel_key = rrr.res_ruimte_opstel_key)),
|
||||
(SELECT d.ins_discipline_key
|
||||
FROM ins_tab_discipline d, res_ruimte rr, res_ruimte_opstelling ro
|
||||
WHERE d.ins_discipline_key = rr.res_discipline_key
|
||||
AND rr.res_ruimte_key = ro.res_ruimte_key
|
||||
AND ro.res_ruimte_opstel_key = rrr.res_ruimte_opstel_key),
|
||||
(SELECT d.ins_discipline_omschrijving
|
||||
FROM ins_tab_discipline d, res_ruimte rr, res_ruimte_opstelling ro
|
||||
WHERE d.ins_discipline_key = rr.res_discipline_key
|
||||
AND rr.res_ruimte_key = ro.res_ruimte_key
|
||||
AND ro.res_ruimte_opstel_key = rrr.res_ruimte_opstel_key),
|
||||
DECODE (rrr.alg_ruimte_key, NULL, 'Ja', 'Nee'),
|
||||
rrr.res_rsv_ruimte_bezoekers,
|
||||
rrr.res_rsv_ruimte_van,
|
||||
rrr.res_rsv_ruimte_tot,
|
||||
COALESCE ((rrr.res_rsv_ruimte_tot - rrr.res_rsv_ruimte_van) * 24, 0),
|
||||
(SELECT res_status_fo_omschrijving
|
||||
FROM res_status_fo
|
||||
WHERE res_status_fo_key = rrr.res_status_fo_key),
|
||||
(SELECT res_status_bo_omschrijving
|
||||
FROM res_status_bo
|
||||
WHERE res_status_bo_key = rrr.res_status_bo_key),
|
||||
ra.res_activiteit_omschrijving,
|
||||
rsa.res_srtactiviteit_key,
|
||||
rsa.res_srtactiviteit_omschrijving,
|
||||
voorz.ins_discipline_key,
|
||||
voorz.vtype,
|
||||
voorz.catalogus,
|
||||
(SELECT prs_bedrijf_naam
|
||||
FROM res_disc_params rdp, prs_bedrijf b
|
||||
WHERE rdp.prs_bedrijf_key = b.prs_bedrijf_key
|
||||
AND rdp.res_ins_discipline_key = voorz.ins_discipline_key),
|
||||
voorz.product_key,
|
||||
voorz.product,
|
||||
voorz.totaalprijs,
|
||||
TO_CHAR (voorz.van, 'hh24:mi'),
|
||||
TO_CHAR (voorz.tot, 'hh24:mi'),
|
||||
voorz.aantal,
|
||||
voorz.prijs,
|
||||
COALESCE (pc.prs_perslid_telefoonnr, pc.prs_perslid_mobiel) contact_tel,
|
||||
COALESCE (ph.prs_perslid_telefoonnr, ph.prs_perslid_mobiel) host_tel,
|
||||
rrr.res_rsv_ruimte_opmerking
|
||||
FROM res_v_aanwezigrsv_ruimte rrr,
|
||||
res_reservering res,
|
||||
( SELECT rrr.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
|
||||
FROM res_rsv_ruimte rrr,
|
||||
res_ruimte_opstelling ro,
|
||||
res_opstelling o,
|
||||
res_ruimte rr,
|
||||
res_alg_ruimte ra
|
||||
WHERE rrr.res_rsv_ruimte_verwijder IS NULL
|
||||
AND rrr.res_ruimte_opstel_key = ro.res_ruimte_opstel_key
|
||||
AND ro.res_opstelling_key = o.res_opstelling_key
|
||||
AND ro.res_ruimte_key = rr.res_ruimte_key
|
||||
AND rr.res_ruimte_key = ra.res_ruimte_key
|
||||
GROUP BY rrr.res_rsv_ruimte_key
|
||||
UNION ALL
|
||||
SELECT rrr.res_rsv_ruimte_key,
|
||||
'' opstelling,
|
||||
TO_NUMBER (NULL) capaciteit,
|
||||
rrr.alg_ruimte_key,
|
||||
r.alg_ruimte_nr
|
||||
FROM res_rsv_ruimte rrr, alg_ruimte r
|
||||
WHERE rrr.res_rsv_ruimte_verwijder IS NULL
|
||||
AND rrr.alg_ruimte_key IS NOT NULL
|
||||
AND r.alg_ruimte_key = rrr.alg_ruimte_key) r2a,
|
||||
(SELECT rrd.res_rsv_ruimte_key res_rsv_ruimte_key,
|
||||
-rd.res_deel_key product_key,
|
||||
rd.res_deel_omschrijving product,
|
||||
DECODE (rd.res_deel_prijs_vast,
|
||||
1, COALESCE (rrd.res_rsv_deel_prijs, rd.res_deel_prijs),
|
||||
(rrd.res_rsv_deel_tot - rrd.res_rsv_deel_van) * 24 * COALESCE (rrd.res_rsv_deel_prijs, rd.res_deel_prijs))
|
||||
totaalprijs,
|
||||
rrd.res_rsv_deel_van van,
|
||||
rrd.res_rsv_deel_tot tot,
|
||||
(rrd.res_rsv_deel_tot - rrd.res_rsv_deel_van) * 24 aantal,
|
||||
COALESCE (rrd.res_rsv_deel_prijs, rd.res_deel_prijs)
|
||||
prijs,
|
||||
c.ins_discipline_key ins_discipline_key,
|
||||
c.ins_discipline_omschrijving catalogus,
|
||||
'object' vtype
|
||||
FROM res_v_aanwezigrsv_deel rrd,
|
||||
res_deel rd,
|
||||
ins_deel d,
|
||||
ins_tab_discipline c
|
||||
WHERE rrd.res_rsv_ruimte_key IS NOT NULL
|
||||
AND rrd.res_deel_key = rd.res_deel_key
|
||||
AND rd.res_ins_deel_key = d.ins_deel_key
|
||||
AND rd.res_discipline_key = c.ins_discipline_key
|
||||
UNION ALL
|
||||
SELECT rra.res_rsv_ruimte_key res_rsv_ruimte_key,
|
||||
ra.res_artikel_key product_key,
|
||||
ra.res_artikel_omschrijving product,
|
||||
COALESCE (rra.res_rsv_artikel_prijs, rra.res_rsv_artikel_aantal * res_artikel_prijs)
|
||||
totaalprijs,
|
||||
rra.res_rsv_artikel_levering van,
|
||||
NULL tot,
|
||||
rra.res_rsv_artikel_aantal aantal,
|
||||
COALESCE (rra.res_rsv_artikel_prijs / rra.res_rsv_artikel_aantal, res_artikel_prijs)
|
||||
prijs,
|
||||
c.ins_discipline_key ins_discipline_key,
|
||||
c.ins_discipline_omschrijving catalogus,
|
||||
'consumable' vtype
|
||||
FROM res_v_aanwezigrsv_artikel rra,
|
||||
res_artikel ra,
|
||||
ins_tab_discipline c
|
||||
WHERE rra.res_artikel_key = ra.res_artikel_key
|
||||
AND ra.res_discipline_key = c.ins_discipline_key) voorz,
|
||||
res_activiteit ra,
|
||||
res_srtactiviteit rsa,
|
||||
prs_perslid pc,
|
||||
prs_perslid ph,
|
||||
prs_afdeling a,
|
||||
prs_kostenplaats k
|
||||
WHERE rrr.res_reservering_key = res.res_reservering_key
|
||||
AND rrr.res_rsv_ruimte_key = r2a.res_rsv_ruimte_key(+)
|
||||
AND rrr.res_rsv_ruimte_key = voorz.res_rsv_ruimte_key(+)
|
||||
AND rrr.res_activiteit_key = ra.res_activiteit_key
|
||||
AND ra.res_srtactiviteit_key = rsa.res_srtactiviteit_key
|
||||
AND rrr.res_rsv_ruimte_contact_key = pc.prs_perslid_key
|
||||
AND rrr.res_rsv_ruimte_host_key = ph.prs_perslid_key
|
||||
AND ph.prs_afdeling_key = a.prs_afdeling_key
|
||||
AND rrr.prs_kostenplaats_key = k.prs_kostenplaats_key(+)
|
||||
AND (rrr.res_ruimte_opstel_key IS NOT NULL OR voorz.res_rsv_ruimte_key IS NOT NULL)
|
||||
AND rrr.res_rsv_ruimte_van >= TRUNC (ADD_MONTHS (SYSDATE, -1), 'mm');
|
||||
|
||||
------ payload end ------
|
||||
|
||||
SET DEFINE OFF
|
||||
BEGIN adm.systrackscriptId ('$Id$', 0); END;
|
||||
/
|
||||
|
||||
Reference in New Issue
Block a user