494 lines
23 KiB
Plaintext
494 lines
23 KiB
Plaintext
#ifdef BES // 03-11-2000 PF
|
|
/*
|
|
* $Revision$
|
|
* $Id$
|
|
*/
|
|
|
|
CREATE_VIEW(bes_discipline, 0)
|
|
AS
|
|
SELECT * FROM ins_tab_discipline WHERE ins_discipline_module = 'BES';
|
|
|
|
DEFINIEER_VIEW_AANWEZIG(bes_discipline, ins_discipline_verwijder,
|
|
bes_v_aanwezigdiscipline,0);
|
|
|
|
CREATE_VIEW(bes_v_aanwezigsrtgroep, 0)
|
|
AS
|
|
SELECT * FROM bes_srtgroep WHERE bes_srtgroep_verwijder IS NULL;
|
|
|
|
CREATE_VIEW(bes_v_aanwezigsrtdeel, 0)
|
|
AS
|
|
SELECT * FROM bes_srtdeel WHERE bes_srtdeel_verwijder IS NULL;
|
|
|
|
/* LET OP (FSN#21553)
|
|
* Deze twee views lijkt qua naam een tabel, maar is het technisch niet
|
|
* Hij levert de statustekst in de juiste taal op, van een specifieke statuscode
|
|
* Voorheen was dit een tabel met deze naam, en werd deze initieel gevuld. Dit is
|
|
* hiermee dus vanwege de i18n veranderd.
|
|
*/
|
|
CREATE_VIEW(bes_bestellingstatuses, 0)
|
|
AS
|
|
SELECT fac_code2label_code bes_bestellingstatuses_key,
|
|
COALESCE (fac_locale_xsl_cust, fac_locale_xsl_tekst) bes_bestellingstatuses_omschr
|
|
FROM fac_locale_xsl fl, fac_code2label fs
|
|
WHERE fl.fac_locale_xsl_label = fac_code2label_label
|
|
AND fac_code2label_domein = 'bestelling'
|
|
AND fac_locale_xsl_lang = lcl.getuserlanguage ();
|
|
|
|
CREATE_VIEW(bes_bestelopdrstatuses, 0)
|
|
AS
|
|
SELECT fac_code2label_code bes_bestelopdrstatuses_key,
|
|
COALESCE (fac_locale_xsl_cust, fac_locale_xsl_tekst) bes_bestelopdrstatuses_omschr
|
|
FROM fac_locale_xsl fl, fac_code2label fs
|
|
WHERE fl.fac_locale_xsl_label = fac_code2label_label
|
|
AND fac_code2label_domein = 'bestelopdr'
|
|
AND fac_locale_xsl_lang = lcl.getuserlanguage ();
|
|
|
|
CREATE_VIEW(bes_v_qvw_algemeen, 0) (bes_bestelling_key,
|
|
bestelaanvraagnr,
|
|
besteldatum,
|
|
besteller,
|
|
invoerder,
|
|
kostensoortgroep,
|
|
kostensoort,
|
|
kpn,
|
|
kpn_omschrijving,
|
|
prs_bedrijf_key,
|
|
afdeling_code,
|
|
afdeling_omschrijving,
|
|
alg_locatie_key,
|
|
locatie_code,
|
|
district_omschijving,
|
|
afleveradres,
|
|
mandaat,
|
|
personeelsnr,
|
|
werkplek,
|
|
ins_discipline_key,
|
|
catalogus,
|
|
bes_srtgroep_key,
|
|
groep,
|
|
afleverdatum,
|
|
doorlooptijd_werkdgn,
|
|
sla_tijd,
|
|
productcode,
|
|
prijs,
|
|
inkoopprijs,
|
|
status,
|
|
gefiatteerddoor,
|
|
bestelopdrachtnummer,
|
|
aantal,
|
|
itemprijs,
|
|
iteminkoopprijs,
|
|
bes_srtdeel_key,
|
|
productomschrijving,
|
|
itemposnr
|
|
)
|
|
AS
|
|
SELECT bes_bestelling_key, bestelaanvraagnr, besteldatum, besteller, invoerder, kostensoortgroep,kostensoort, kpn, kpn_omschrijving, prs_bedrijf_key,
|
|
afdeling_code, afdeling_omschrijving, alg_locatie_key, locatie_code, district_omschijving, afleveradres, mandaat,
|
|
personeelsnr, werkplek, ins_discipline_key, catalogus, bes_srtgroep_key, groep, afleverdatum, doorlooptijd_werkdgn, sla_tijd,
|
|
productcode, prijs, inkoopprijs, status, gefiatteerddoor, bestelopdrachtnummer, aantal, itemprijs, iteminkoopprijs, bes_srtdeel_key, productomschrijving, itemposnr
|
|
FROM (SELECT b.bes_bestelling_key bes_bestelling_key, 'A-' || b.bes_bestelling_key bestelaanvraagnr,
|
|
TRUNC(b.bes_bestelling_datum) besteldatum,
|
|
(SELECT prs_perslid_naam_full
|
|
FROM prs_v_perslid_fullnames_all pf
|
|
WHERE pf.prs_perslid_key = p.prs_perslid_key) besteller,
|
|
(SELECT prs_perslid_naam_full
|
|
FROM prs_v_perslid_fullnames_all pf
|
|
WHERE pf.prs_perslid_key = COALESCE(fac.gettrackinguserkey ('BESNEW', b.bes_bestelling_key), fac.gettrackinguserkey ('BESAP2', b.bes_bestelling_key))) invoerder,
|
|
(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 MAX(COALESCE(bsg.prs_kostensoort_key, disc.prs_kostensoort_key))
|
|
FROM bes_discipline disc,
|
|
bes_srtgroep bsg
|
|
WHERE disc.ins_discipline_key = d.ins_discipline_key)) kostensoortgroep,
|
|
(SELECT ks.prs_kostensoort_oms
|
|
FROM prs_kostensoort ks
|
|
WHERE ks.prs_kostensoort_key =
|
|
(SELECT MAX(COALESCE(bsg.prs_kostensoort_key, disc.prs_kostensoort_key))
|
|
FROM bes_discipline disc,
|
|
bes_srtgroep bsg
|
|
WHERE disc.ins_discipline_key = bsg.ins_discipline_key
|
|
AND disc.ins_discipline_key = d.ins_discipline_key)) kostensoort,
|
|
k.prs_kostenplaats_nr kpn,
|
|
k.prs_kostenplaats_omschrijving kpn_omschrijving,
|
|
(SELECT prs_bedrijf_key
|
|
FROM prs_v_afdeling pva
|
|
WHERE pva.prs_afdeling_key = a.prs_afdeling_key) prs_bedrijf_key,
|
|
a.prs_afdeling_naam afdeling_code,
|
|
a.prs_afdeling_omschrijving afdeling_omschrijving,
|
|
ma.alg_locatie_key alg_locatie_key,
|
|
(SELECT alg_locatie_code
|
|
FROM alg_locatie l
|
|
WHERE l.alg_locatie_key = ma.alg_locatie_key) locatie_code,
|
|
(SELECT alg_district_omschrijving
|
|
FROM alg_locatie l, alg_district d
|
|
WHERE l.alg_district_key = d.alg_district_key
|
|
AND l.alg_locatie_key = ma.alg_locatie_key) district_omschijving,
|
|
ma.mld_adres_naam afleveradres, NVL ((SELECT pr.fac_profiel_limiet
|
|
FROM fac_profiel pr
|
|
WHERE p.fac_profiel_key = pr.fac_profiel_key), 0) mandaat,
|
|
prs_perslid_nr personeelsnr, wp2.prs_werkplek_aanduiding werkplek,
|
|
d.ins_discipline_key ins_discipline_key,
|
|
d.ins_discipline_omschrijving catalogus,
|
|
sg.bes_srtgroep_key bes_srtgroep_key,
|
|
sg.bes_srtgroep_omschrijving groep,
|
|
TRUNC(bes_bestelling_leverdatum) afleverdatum,
|
|
fac.count_work_days (b.bes_bestelling_datum, NVL (fac.gettrackingdate ('BESOTV', b.bes_bestelling_key), SYSDATE)) doorlooptijd_werkdgn,
|
|
NVL ((SELECT bdp.bes_disc_params_leverdagen
|
|
FROM bes_disc_params bdp
|
|
WHERE d.ins_discipline_key = bdp.bes_ins_discipline_key), 0) sla_tijd,
|
|
sd.bes_srtdeel_nr productcode,
|
|
bi.bes_bestelling_item_prijs * bi.bes_bestelling_item_aantal prijs,
|
|
NVL(bes.getsrtdeelinkprijs(sd.bes_srtdeel_key, bes_bestelling_datum), bi.bes_bestelling_item_prijs) * bi.bes_bestelling_item_aantal inkoopprijs,
|
|
(SELECT bes_bestellingstatuses_omschr
|
|
FROM bes_bestellingstatuses bs
|
|
WHERE bs.bes_bestellingstatuses_key = b.bes_bestelling_status) status,
|
|
(SELECT prs_perslid_naam_full
|
|
FROM prs_v_perslid_fullnames_all pf
|
|
WHERE pf.prs_perslid_key = b.bes_bestelling_fiat_user) gefiatteerddoor,
|
|
'O-' || bo.bes_bestelopdr_id bestelopdrachtnummer, bi.bes_bestelling_item_aantal aantal,
|
|
bi.bes_bestelling_item_prijs itemprijs,
|
|
NVL(bes.getsrtdeelinkprijs(sd.bes_srtdeel_key, bes_bestelling_datum), bi.bes_bestelling_item_prijs) iteminkoopprijs,
|
|
sd.bes_srtdeel_key bes_srtdeel_key,
|
|
sd.bes_srtdeel_omschrijving productomschrijving,
|
|
boi.bes_bestelopdr_item_posnr itemposnr
|
|
FROM bes_bestelling b,
|
|
prs_perslid p,
|
|
prs_kostenplaats k,
|
|
prs_afdeling a,
|
|
mld_adres ma,
|
|
(SELECT pw.prs_perslid_key,
|
|
MIN (prs_werkplek_aanduiding) || DECODE (COUNT (*), 1, '', '...') prs_werkplek_aanduiding
|
|
FROM prs_v_werkplek_gegevens wp, prs_perslidwerkplek pw
|
|
WHERE wp.prs_werkplek_key = pw.prs_werkplek_key
|
|
GROUP BY pw.prs_perslid_key) wp2,
|
|
bes_bestelling_item bi,
|
|
bes_bestelopdr_item boi,
|
|
bes_bestelopdr bo,
|
|
bes_srtdeel sd,
|
|
bes_srtgroep sg,
|
|
ins_tab_discipline d
|
|
WHERE b.prs_perslid_key = p.prs_perslid_key
|
|
AND b.prs_kostenplaats_key = k.prs_kostenplaats_key
|
|
AND p.prs_afdeling_key = a.prs_afdeling_key
|
|
AND b.mld_adres_key_lev = ma.mld_adres_key
|
|
AND wp2.prs_perslid_key(+) = p.prs_perslid_key
|
|
AND b.bes_bestelling_key = bi.bes_bestelling_key
|
|
AND bi.bes_bestelopdr_item_key = boi.bes_bestelopdr_item_key(+)
|
|
AND boi.bes_bestelopdr_key = bo.bes_bestelopdr_key(+)
|
|
AND bi.bes_srtdeel_key = sd.bes_srtdeel_key
|
|
AND sd.bes_srtgroep_key = sg.bes_srtgroep_key
|
|
AND sg.ins_discipline_key = d.ins_discipline_key);
|
|
|
|
CREATE_VIEW(bes_v_qvw_locale, 0)
|
|
(fac_locale_kolomkeyval, fac_locale_kolomnaam, fac_locale_tekst_nl, fac_locale_tekst_en, fac_locale_tekst_de, fac_locale_tekst_fr)
|
|
AS
|
|
WITH bqa AS (SELECT DISTINCT ins_discipline_key,
|
|
catalogus,
|
|
bes_srtgroep_key,
|
|
groep,
|
|
bes_srtdeel_key,
|
|
productomschrijving
|
|
FROM bes_v_qvw_algemeen)
|
|
SELECT DISTINCT bqa.ins_discipline_key,
|
|
'INS_DISCIPLINE_OMSCHRIJVING',
|
|
bqa.catalogus,
|
|
COALESCE (en.fac_locale_tekst, bqa.catalogus),
|
|
COALESCE (de.fac_locale_tekst, bqa.catalogus),
|
|
COALESCE (fr.fac_locale_tekst, bqa.catalogus)
|
|
FROM fac_locale en,
|
|
fac_locale de,
|
|
fac_locale fr,
|
|
bqa
|
|
WHERE bqa.ins_discipline_key = en.fac_locale_kolomkeyval(+)
|
|
AND en.fac_locale_kolomnaam(+) = 'INS_DISCIPLINE_OMSCHRIJVING'
|
|
AND en.fac_locale_lang(+) = 'EN'
|
|
AND bqa.ins_discipline_key = de.fac_locale_kolomkeyval(+)
|
|
AND de.fac_locale_kolomnaam(+) = 'INS_DISCIPLINE_OMSCHRIJVING'
|
|
AND de.fac_locale_lang(+) = 'DE'
|
|
AND bqa.ins_discipline_key = fr.fac_locale_kolomkeyval(+)
|
|
AND fr.fac_locale_kolomnaam(+) = 'INS_DISCIPLINE_OMSCHRIJVING'
|
|
AND fr.fac_locale_lang(+) = 'FR'
|
|
UNION ALL
|
|
SELECT DISTINCT bqa.bes_srtgroep_key,
|
|
'BES_SRTGROEP_OMSCHRIJVING',
|
|
bqa.groep,
|
|
COALESCE (en.fac_locale_tekst, bqa.groep),
|
|
COALESCE (de.fac_locale_tekst, bqa.groep),
|
|
COALESCE (fr.fac_locale_tekst, bqa.groep)
|
|
FROM fac_locale en,
|
|
fac_locale de,
|
|
fac_locale fr,
|
|
bqa
|
|
WHERE bqa.bes_srtgroep_key = en.fac_locale_kolomkeyval(+)
|
|
AND en.fac_locale_kolomnaam(+) = 'BES_SRTGROEP_OMSCHRIJVING'
|
|
AND en.fac_locale_lang(+) = 'EN'
|
|
AND bqa.bes_srtgroep_key = de.fac_locale_kolomkeyval(+)
|
|
AND de.fac_locale_kolomnaam(+) = 'BES_SRTGROEP_OMSCHRIJVING'
|
|
AND de.fac_locale_lang(+) = 'DE'
|
|
AND bqa.bes_srtgroep_key = fr.fac_locale_kolomkeyval(+)
|
|
AND fr.fac_locale_kolomnaam(+) = 'BES_SRTGROEP_OMSCHRIJVING'
|
|
AND fr.fac_locale_lang(+) = 'FR'
|
|
UNION ALL
|
|
SELECT DISTINCT bqa.bes_srtdeel_key,
|
|
'BES_SRTDEEL_OMSCHRIJVING',
|
|
bqa.productomschrijving,
|
|
COALESCE (en.fac_locale_tekst, bqa.productomschrijving),
|
|
COALESCE (de.fac_locale_tekst, bqa.productomschrijving),
|
|
COALESCE (fr.fac_locale_tekst, bqa.productomschrijving)
|
|
FROM fac_locale en,
|
|
fac_locale de,
|
|
fac_locale fr,
|
|
bqa
|
|
WHERE bqa.bes_srtdeel_key = en.fac_locale_kolomkeyval(+)
|
|
AND en.fac_locale_kolomnaam(+) = 'BES_SRTDEEL_OMSCHRIJVING'
|
|
AND en.fac_locale_lang(+) = 'EN'
|
|
AND bqa.bes_srtdeel_key = de.fac_locale_kolomkeyval(+)
|
|
AND de.fac_locale_kolomnaam(+) = 'BES_SRTDEEL_OMSCHRIJVING'
|
|
AND de.fac_locale_lang(+) = 'DE'
|
|
AND bqa.bes_srtdeel_key = fr.fac_locale_kolomkeyval(+)
|
|
AND fr.fac_locale_kolomnaam(+) = 'BES_SRTDEEL_OMSCHRIJVING'
|
|
AND fr.fac_locale_lang(+) = 'FR';
|
|
|
|
-- Vooralsnog placeholders, moeten aangepast worden
|
|
CREATE_VIEW(bes_v_api_bestellingen, 1) AS SELECT * from bes_bestelling;
|
|
CREATE_VIEW(bes_v_api_bestelopdrachten, 1) AS SELECT * from bes_bestelopdr;
|
|
|
|
/* ROOT VIEWS for User defined Reports (UDR) */
|
|
CREATE_VIEW(bes_v_udr_bestelling, 1)
|
|
(
|
|
bestelling_key,
|
|
bestelaanvraagnr,
|
|
besteldatum,
|
|
leverancier,
|
|
besteller,
|
|
invoerder,
|
|
kostensoortgroep,
|
|
kostensoort,
|
|
kpn,
|
|
kpn_omschrijving,
|
|
fclt_3d_afdeling_key,
|
|
afdeling_code,
|
|
afdeling_omschrijving,
|
|
fclt_3d_locatie_key,
|
|
locatie_code,
|
|
district_omschrijving,
|
|
afleveradres,
|
|
mandaat,
|
|
fclt_3d_discipline_key,
|
|
catalogus,
|
|
groep,
|
|
productomschrijving,
|
|
productcode,
|
|
afleverdatum,
|
|
doorlooptijd_werkdgn,
|
|
sla_tijd,
|
|
prijs,
|
|
inkoopprijs,
|
|
status,
|
|
gefiatteerddoor,
|
|
bestelopdrachtnummer,
|
|
aantal,
|
|
itemprijs,
|
|
iteminkoopprijs,
|
|
itemposnr
|
|
)
|
|
AS
|
|
SELECT bes_bestelling_key,
|
|
bestelaanvraagnr,
|
|
besteldatum,
|
|
bedrijf_naam,
|
|
besteller,
|
|
invoerder,
|
|
kostensoortgroep,
|
|
kostensoort,
|
|
kpn,
|
|
kpn_omschrijving,
|
|
prs_afdeling_key,
|
|
afdeling_code,
|
|
afdeling_omschrijving,
|
|
alg_locatie_key,
|
|
locatie_code,
|
|
district_omschijving,
|
|
afleveradres,
|
|
mandaat,
|
|
ins_discipline_key,
|
|
catalogus,
|
|
groep,
|
|
productomschrijving,
|
|
productcode,
|
|
afleverdatum,
|
|
doorlooptijd_werkdgn,
|
|
sla_tijd,
|
|
prijs,
|
|
inkoopprijs,
|
|
status,
|
|
gefiatteerddoor,
|
|
bestelopdrachtnummer,
|
|
aantal,
|
|
itemprijs,
|
|
iteminkoopprijs,
|
|
itemposnr
|
|
FROM (SELECT b.bes_bestelling_key bes_bestelling_key,
|
|
'A-' || b.bes_bestelling_key bestelaanvraagnr,
|
|
b.bes_bestelling_datum besteldatum,
|
|
(SELECT prs_perslid_naam_full
|
|
FROM prs_v_perslid_fullnames_all pf
|
|
WHERE pf.prs_perslid_key = p.prs_perslid_key)
|
|
besteller,
|
|
(SELECT prs_perslid_naam_full
|
|
FROM prs_v_perslid_fullnames_all pf
|
|
WHERE pf.prs_perslid_key =
|
|
COALESCE (fac.gettrackinguserkey ('BESNEW', b.bes_bestelling_key),
|
|
fac.gettrackinguserkey ('BESAP2', b.bes_bestelling_key)))
|
|
invoerder,
|
|
(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 MAX(COALESCE (bsg.prs_kostensoort_key,
|
|
disc.prs_kostensoort_key))
|
|
FROM bes_discipline disc, bes_srtgroep bsg
|
|
WHERE disc.ins_discipline_key = d.ins_discipline_key))
|
|
kostensoortgroep,
|
|
(SELECT ks.prs_kostensoort_oms
|
|
FROM prs_kostensoort ks
|
|
WHERE ks.prs_kostensoort_key =
|
|
(SELECT MAX(COALESCE (bsg.prs_kostensoort_key,
|
|
disc.prs_kostensoort_key))
|
|
FROM bes_discipline disc, bes_srtgroep bsg
|
|
WHERE disc.ins_discipline_key = bsg.ins_discipline_key
|
|
AND disc.ins_discipline_key = d.ins_discipline_key))
|
|
kostensoort,
|
|
k.prs_kostenplaats_nr kpn,
|
|
k.prs_kostenplaats_omschrijving kpn_omschrijving,
|
|
(SELECT b.prs_bedrijf_naam
|
|
FROM prs_bedrijf b
|
|
WHERE b.prs_bedrijf_key = sd.prs_bedrijf_key)
|
|
bedrijf_naam,
|
|
a.prs_afdeling_key,
|
|
a.prs_afdeling_naam afdeling_code,
|
|
a.prs_afdeling_omschrijving afdeling_omschrijving,
|
|
ma.alg_locatie_key alg_locatie_key,
|
|
(SELECT alg_locatie_code
|
|
FROM alg_locatie l
|
|
WHERE l.alg_locatie_key = ma.alg_locatie_key)
|
|
locatie_code,
|
|
(SELECT alg_district_omschrijving
|
|
FROM alg_locatie l, alg_district d
|
|
WHERE l.alg_district_key = d.alg_district_key
|
|
AND l.alg_locatie_key = ma.alg_locatie_key)
|
|
district_omschijving,
|
|
ma.mld_adres_naam afleveradres,
|
|
NVL ( (SELECT pr.fac_profiel_limiet
|
|
FROM fac_profiel pr
|
|
WHERE p.fac_profiel_key = pr.fac_profiel_key), 0)
|
|
mandaat,
|
|
d.ins_discipline_key ins_discipline_key,
|
|
d.ins_discipline_omschrijving catalogus,
|
|
sg.bes_srtgroep_omschrijving groep,
|
|
b.bes_bestelling_leverdatum afleverdatum,
|
|
fac.count_work_days (
|
|
b.bes_bestelling_datum,
|
|
NVL (fac.gettrackingdate ('BESOTV', b.bes_bestelling_key), SYSDATE))
|
|
doorlooptijd_werkdgn,
|
|
NVL ( (SELECT bdp.bes_disc_params_leverdagen
|
|
FROM bes_disc_params bdp
|
|
WHERE d.ins_discipline_key = bdp.bes_ins_discipline_key), 0)
|
|
sla_tijd,
|
|
sd.bes_srtdeel_nr productcode,
|
|
bi.bes_bestelling_item_prijs * bi.bes_bestelling_item_aantal prijs,
|
|
NVL (bes.getsrtdeelinkprijs (sd.bes_srtdeel_key, bes_bestelling_datum),
|
|
bi.bes_bestelling_item_prijs)
|
|
* bi.bes_bestelling_item_aantal
|
|
inkoopprijs,
|
|
(SELECT bes_bestellingstatuses_omschr
|
|
FROM bes_bestellingstatuses bs
|
|
WHERE bs.bes_bestellingstatuses_key = b.bes_bestelling_status)
|
|
status,
|
|
(SELECT prs_perslid_naam_full
|
|
FROM prs_v_perslid_fullnames_all pf
|
|
WHERE pf.prs_perslid_key = b.bes_bestelling_fiat_user)
|
|
gefiatteerddoor,
|
|
'O-' || bo.bes_bestelopdr_id bestelopdrachtnummer,
|
|
bi.bes_bestelling_item_aantal aantal,
|
|
bi.bes_bestelling_item_prijs itemprijs,
|
|
NVL (bes.getsrtdeelinkprijs (sd.bes_srtdeel_key, bes_bestelling_datum),
|
|
bi.bes_bestelling_item_prijs)
|
|
iteminkoopprijs,
|
|
sd.bes_srtdeel_omschrijving productomschrijving,
|
|
boi.bes_bestelopdr_item_posnr itemposnr
|
|
FROM bes_bestelling b,
|
|
prs_perslid p,
|
|
prs_kostenplaats k,
|
|
prs_afdeling a,
|
|
mld_adres ma,
|
|
bes_bestelling_item bi,
|
|
bes_bestelopdr_item boi,
|
|
bes_bestelopdr bo,
|
|
bes_srtdeel sd,
|
|
bes_srtgroep sg,
|
|
ins_tab_discipline d
|
|
WHERE b.prs_perslid_key = p.prs_perslid_key
|
|
AND b.prs_kostenplaats_key = k.prs_kostenplaats_key
|
|
AND p.prs_afdeling_key = a.prs_afdeling_key
|
|
AND b.mld_adres_key_lev = ma.mld_adres_key
|
|
AND b.bes_bestelling_key = bi.bes_bestelling_key
|
|
AND bi.bes_bestelopdr_item_key = boi.bes_bestelopdr_item_key(+)
|
|
AND boi.bes_bestelopdr_key = bo.bes_bestelopdr_key(+)
|
|
AND bi.bes_srtdeel_key = sd.bes_srtdeel_key
|
|
AND sd.bes_srtgroep_key = sg.bes_srtgroep_key
|
|
AND sg.ins_discipline_key = d.ins_discipline_key);
|
|
|
|
CREATE_VIEW(bes_v_allsrtinstallatie, 0)
|
|
(
|
|
NIVEAU,
|
|
BES_SRTINSTALLATIE_KEY,
|
|
DISCIPLINE_OMS,
|
|
SRTGROEP_OMS,
|
|
SRTDEEL_OMS,
|
|
BES_DISCIPLINE_KEY,
|
|
BES_SRTGROEP_KEY,
|
|
BES_SRTDEEL_KEY
|
|
)
|
|
AS
|
|
SELECT 'D',
|
|
bes_ID.ins_discipline_key,
|
|
bes_ID.ins_discipline_omschrijving discipline_oms,
|
|
NULL srtgroep_oms,
|
|
NULL srtdeel_oms,
|
|
bes_ID.ins_discipline_key,
|
|
NULL bes_srtgroep_key,
|
|
NULL bes_srtdeel_key
|
|
FROM bes_discipline bes_ID
|
|
UNION
|
|
SELECT 'G',
|
|
bes_SG.bes_srtgroep_key,
|
|
bes_ID.ins_discipline_omschrijving,
|
|
bes_SG.bes_srtgroep_omschrijving,
|
|
NULL,
|
|
bes_ID.ins_discipline_key,
|
|
bes_SG.bes_srtgroep_key,
|
|
NULL
|
|
FROM bes_discipline bes_ID, bes_srtgroep bes_SG
|
|
WHERE bes_ID.ins_discipline_key = bes_SG.ins_discipline_key
|
|
UNION
|
|
SELECT 'S',
|
|
bes_SD.bes_srtdeel_key,
|
|
bes_ID.ins_discipline_omschrijving,
|
|
bes_SG.bes_srtgroep_omschrijving,
|
|
bes_SD.bes_srtdeel_omschrijving,
|
|
bes_ID.ins_discipline_key,
|
|
bes_SG.bes_srtgroep_key,
|
|
bes_SD.bes_srtdeel_key
|
|
FROM bes_discipline bes_ID, bes_srtgroep bes_SG, bes_srtdeel bes_SD
|
|
WHERE bes_SG.bes_srtgroep_key = bes_SD.bes_srtgroep_key
|
|
AND bes_ID.ins_discipline_key = bes_SG.ins_discipline_key;
|
|
|
|
REGISTERRUN('$Id$')
|
|
|
|
#endif // BES
|