562 lines
25 KiB
Plaintext
562 lines
25 KiB
Plaintext
#ifdef CNT
|
|
/* $Revision$
|
|
* $Id$
|
|
*/
|
|
|
|
CREATE_VIEW(cnt_discipline, 0)
|
|
AS SELECT * FROM ALL_discipline WHERE ins_discipline_module = 'CNT';
|
|
|
|
DEFINIEER_VIEW_AANWEZIG(cnt_discipline, ins_discipline_verwijder, cnt_v_aanwezigdiscipline, 0);
|
|
DEFINIEER_VIEW_AANWEZIG(cnt_contract, cnt_contract_verwijder, cnt_v_aanwezigcontract, 0);
|
|
DEFINIEER_VIEW_AANWEZIG(cnt_contract_plaats, cnt_contract_plaats_verwijder, cnt_v_aanwezigcontract_plaats, 0);
|
|
DEFINIEER_VIEW_AANWEZIG(cnt_contract_object, cnt_contract_object_verwijder, cnt_v_aanwezigcontract_object, 0);
|
|
|
|
CREATE_VIEW(cnt_v_contract_plaats,0) AS
|
|
SELECT L.alg_locatie_key cnt_plaats_key
|
|
, 'L' cnt_plaats_code
|
|
, L.alg_locatie_code ||' ( '
|
|
|| L.alg_locatie_omschrijving ||' )' cnt_plaats_omschrijving
|
|
FROM alg_v_aanweziglocatie L
|
|
UNION
|
|
SELECT T.alg_terreinsector_key
|
|
, 'T'
|
|
, L.alg_locatie_code ||' - '
|
|
|| T.alg_terreinsector_code ||' ( '
|
|
|| T.alg_terreinsector_naam ||')'
|
|
FROM alg_v_aanweziglocatie L
|
|
, alg_v_aanwezigterreinsector T
|
|
WHERE T.alg_locatie_key = L.alg_locatie_key
|
|
UNION
|
|
SELECT G.alg_gebouw_key
|
|
, 'G'
|
|
, L.alg_locatie_code ||' - '
|
|
|| G.alg_gebouw_code ||' ( '
|
|
|| G.alg_gebouw_naam ||' )'
|
|
FROM alg_v_aanweziglocatie L
|
|
, alg_v_aanweziggebouw G
|
|
WHERE G.alg_locatie_key = L.alg_locatie_key
|
|
UNION
|
|
SELECT V.alg_verdieping_key
|
|
, 'V'
|
|
, L.alg_locatie_code ||' - '
|
|
|| G.alg_gebouw_code ||' - '
|
|
|| to_char(V.alg_verdieping_volgnr) ||' ( '
|
|
|| V.alg_verdieping_omschrijving ||' )'
|
|
FROM alg_v_aanweziglocatie L
|
|
, alg_v_aanweziggebouw G
|
|
, alg_v_aanwezigverdieping V
|
|
WHERE V.alg_gebouw_key = G.alg_gebouw_key
|
|
AND G.alg_locatie_key = L.alg_locatie_key
|
|
UNION
|
|
SELECT R.alg_ruimte_key
|
|
, 'R'
|
|
, L.alg_locatie_code ||' - '
|
|
|| G.alg_gebouw_code ||' - '
|
|
|| to_char(V.alg_verdieping_volgnr) ||' - '
|
|
|| R.alg_ruimte_upper_nr ||' ( '
|
|
|| R.alg_ruimte_omschrijving ||' )'
|
|
FROM alg_v_aanweziglocatie L
|
|
, alg_v_aanweziggebouw G
|
|
, alg_v_aanwezigverdieping V
|
|
, alg_v_aanwezigruimte R
|
|
WHERE R.alg_verdieping_key = V.alg_verdieping_key
|
|
AND V.alg_gebouw_key = G.alg_gebouw_key
|
|
AND G.alg_locatie_key = L.alg_locatie_key;
|
|
|
|
|
|
CREATE_VIEW (cnt_v_aanwezigcontract_data, 0)
|
|
( cnt_contract_key,
|
|
cnt_contract_nummer,
|
|
cnt_contract_omschrijving,
|
|
cnt_contract_looptijd_van,
|
|
cnt_contract_looptijd_tot,
|
|
cnt_alg_plaats_key,
|
|
cnt_alg_plaats_code ) AS
|
|
SELECT CC.cnt_contract_key,
|
|
CC.cnt_contract_nummer,
|
|
CC.cnt_contract_omschrijving,
|
|
CC.cnt_contract_looptijd_van,
|
|
CC.cnt_contract_looptijd_tot,
|
|
CP.cnt_alg_plaats_key,
|
|
CP.cnt_alg_plaats_code
|
|
FROM cnt_v_aanwezigcontract CC, cnt_v_aanwezigcontract_plaats CP
|
|
WHERE CC.cnt_contract_key = CP.cnt_contract_key
|
|
UNION
|
|
SELECT CC.cnt_contract_key,
|
|
CC.cnt_contract_nummer,
|
|
CC.cnt_contract_omschrijving,
|
|
CC.cnt_contract_looptijd_van,
|
|
CC.cnt_contract_looptijd_tot,
|
|
ID.ins_alg_ruimte_key,
|
|
ID.ins_alg_ruimte_type
|
|
FROM cnt_v_aanwezigcontract CC, cnt_v_aanwezigcontract_object CO,
|
|
ins_v_aanwezigdeel ID
|
|
WHERE CC.cnt_contract_key = CO.cnt_contract_key
|
|
AND CO.cnt_ins_deel_key = ID.ins_deel_key
|
|
AND ID.ins_alg_ruimte_type <> 'W'
|
|
UNION
|
|
SELECT CC.cnt_contract_key,
|
|
CC.cnt_contract_nummer,
|
|
CC.cnt_contract_omschrijving,
|
|
CC.cnt_contract_looptijd_van,
|
|
CC.cnt_contract_looptijd_tot,
|
|
ID.ins_alg_ruimte_key,
|
|
ID.ins_alg_ruimte_type
|
|
FROM cnt_v_aanwezigcontract CC, cnt_v_aanwezigcontract_object CO,
|
|
ins_v_aanwezigdeel ID, prs_werkplek WP
|
|
WHERE CC.cnt_contract_key = CO.cnt_contract_key
|
|
AND CO.cnt_ins_deel_key = ID.ins_deel_key
|
|
AND ID.ins_alg_ruimte_type = 'W'
|
|
AND ID.ins_alg_ruimte_key = WP.prs_alg_ruimte_key
|
|
/
|
|
|
|
CREATE_VIEW(cnt_v_contract_locatie_geg, 0)
|
|
(cnt_contract_key, cnt_contract_omschrijving, ins_discipline_key, alg_locatie_key, cnt_prs_bedrijf_key,
|
|
cnt_prs_afdeling_key)
|
|
AS
|
|
SELECT cc.cnt_contract_key, cnt_contract_omschrijving, ins_discipline_key, alg_locatie_key, cnt_prs_bedrijf_key, cnt_prs_afdeling_key
|
|
FROM cnt_v_aanwezigcontract cc, cnt_contract_onrgoed co, alg_ruimte r, alg_verdieping v, alg_gebouw g
|
|
WHERE cc.cnt_contract_key = co.cnt_contract_key
|
|
AND r.alg_verdieping_key = v.alg_verdieping_key
|
|
AND co.alg_onrgoed_key = r.alg_ruimte_key
|
|
AND v.alg_gebouw_key = g.alg_gebouw_key
|
|
UNION
|
|
SELECT cc.cnt_contract_key, cnt_contract_omschrijving, ins_discipline_key, alg_locatie_key, cnt_prs_bedrijf_key, cnt_prs_afdeling_key
|
|
FROM cnt_v_aanwezigcontract cc, cnt_contract_onrgoed co, alg_v_aanwezigterreinsector aa
|
|
WHERE cc.cnt_contract_key = co.cnt_contract_key
|
|
AND co.alg_onrgoed_key = aa.alg_terreinsector_key;
|
|
/
|
|
|
|
|
|
CREATE_VIEW(cnt_v_cnt_contract_onrgoed_new, 0)
|
|
(cnt_contract_onrgoed_key,
|
|
cnt_contract_key,
|
|
alg_onrgoed_key,
|
|
alg_onrgoed_niveau,
|
|
cnt_mutatie_key,
|
|
cnt_contract_onrgoed_opp,
|
|
alg_srtonrgoed_key,
|
|
cnt_mld_melding_key,
|
|
cnt_srtruimte_prijs,
|
|
cnt_mutatie_status_key,
|
|
cnt_contract_onrgoed_key_org) AS
|
|
SELECT cnt_contract_onrgoed_key,
|
|
cnt_contract_key,
|
|
alg_onrgoed_key,
|
|
alg_onrgoed_niveau,
|
|
cnt_mutatie_key,
|
|
cnt_contract_onrgoed_opp,
|
|
alg_srtonrgoed_key,
|
|
cnt_mld_melding_key,
|
|
cnt_srtruimte_prijs,
|
|
cnt_mutatie_status_key,
|
|
cnt_contract_onrgoed_key_org
|
|
FROM cnt_contract_onrgoed
|
|
WHERE cnt_mld_melding_key IS NOT NULL
|
|
AND cnt_contract_onrgoed_key_org IS NULL
|
|
/
|
|
|
|
|
|
CREATE_VIEW(cnt_v_cnt_contract_onrgoed_cur, 0)
|
|
(cnt_contract_onrgoed_key,
|
|
cnt_contract_key,
|
|
alg_onrgoed_key,
|
|
alg_onrgoed_niveau,
|
|
cnt_mutatie_key,
|
|
cnt_contract_onrgoed_opp,
|
|
alg_srtonrgoed_key,
|
|
cnt_mld_melding_key,
|
|
cnt_srtruimte_prijs,
|
|
cnt_mutatie_status_key,
|
|
cnt_contract_onrgoed_key_org) AS
|
|
SELECT cnt_contract_onrgoed_key,
|
|
cnt_contract_key,
|
|
alg_onrgoed_key,
|
|
alg_onrgoed_niveau,
|
|
cnt_mutatie_key,
|
|
cnt_contract_onrgoed_opp,
|
|
alg_srtonrgoed_key,
|
|
cnt_mld_melding_key,
|
|
cnt_srtruimte_prijs,
|
|
cnt_mutatie_status_key,
|
|
cnt_contract_onrgoed_key_org
|
|
FROM cnt_contract_onrgoed
|
|
WHERE cnt_contract_onrgoed_key_org IS NULL
|
|
AND cnt_mld_melding_key IS NULL
|
|
/
|
|
|
|
|
|
CREATE_VIEW(cnt_v_cnt_contract_onrgoed_mut, 0)
|
|
(cnt_contract_onrgoed_key,
|
|
cnt_contract_key,
|
|
alg_onrgoed_key,
|
|
alg_onrgoed_niveau,
|
|
cnt_mutatie_key,
|
|
cnt_contract_onrgoed_opp,
|
|
alg_srtonrgoed_key,
|
|
cnt_mld_melding_key,
|
|
cnt_srtruimte_prijs,
|
|
cnt_mutatie_status_key,
|
|
cnt_contract_onrgoed_key_org) AS
|
|
SELECT cnt_contract_onrgoed_key,
|
|
cnt_contract_key,
|
|
alg_onrgoed_key,
|
|
alg_onrgoed_niveau,
|
|
cnt_mutatie_key,
|
|
cnt_contract_onrgoed_opp,
|
|
alg_srtonrgoed_key,
|
|
cnt_mld_melding_key,
|
|
cnt_srtruimte_prijs,
|
|
cnt_mutatie_status_key,
|
|
cnt_contract_onrgoed_key_org
|
|
FROM cnt_contract_onrgoed
|
|
WHERE cnt_mld_melding_key IS NOT NULL
|
|
AND cnt_contract_onrgoed_key_org IS NOT NULL
|
|
/
|
|
|
|
CREATE_VIEW (CNT_V_ALLONROERENDGOED, 0)
|
|
(ALG_ONROERENDGOED_KEYS, ALG_RUIMTE_KEY, ALG_SRTRUIMTE_CODE, ALG_SRTRUIMTE_PRIJS, ALG_VERDIEPING_KEY, ALG_GEBOUW_KEY, ALG_TERREINSECTOR_KEY, ALG_SRTTERREINSECTOR_CODE, ALG_SRTTERREINSECTOR_PRIJS,
|
|
ALG_LOCATIE_KEY, ALG_TYPE)
|
|
AS
|
|
SELECT ALG_R.alg_ruimte_key,
|
|
ALG_R.alg_ruimte_key,
|
|
ALG_SR.alg_srtruimte_code,
|
|
ALG_SR.alg_srtruimte_prijs,
|
|
ALG_R.alg_verdieping_key,
|
|
ALG_V.alg_gebouw_key,
|
|
TO_NUMBER(NULL),
|
|
NULL,
|
|
TO_NUMBER(NULL),
|
|
ALG_G.alg_locatie_key,
|
|
'R'
|
|
FROM alg_v_aanwezigruimte ALG_R, alg_verdieping ALG_V, alg_gebouw ALG_G, alg_srtruimte ALG_SR
|
|
WHERE ALG_R.alg_verdieping_key = ALG_V.alg_verdieping_key
|
|
AND ALG_V.alg_gebouw_key = ALG_G.alg_gebouw_key
|
|
AND ALG_R.alg_srtruimte_key = ALG_SR.alg_srtruimte_key
|
|
UNION
|
|
SELECT ALG_T.alg_terreinsector_key,
|
|
TO_NUMBER(NULL),
|
|
NULL,
|
|
TO_NUMBER(NULL),
|
|
TO_NUMBER(NULL),
|
|
TO_NUMBER(NULL),
|
|
ALG_T.alg_terreinsector_key,
|
|
ALG_ST.alg_srtterreinsector_code,
|
|
ALG_ST.alg_srtterreinsector_prijs,
|
|
ALG_T.alg_locatie_key,
|
|
'T'
|
|
FROM alg_v_aanwezigterreinsector ALG_T, alg_srtterreinsector ALG_ST
|
|
WHERE ALG_T.alg_srtterreinsector_key = ALG_ST.alg_srtterreinsector_key;
|
|
|
|
|
|
CREATE_VIEW(CNT_V_QVW_ALGEMEEN, 0)
|
|
(CONTRACT_KEY, INTERNNR, EXTERNNR, BESCHRIJVING, DISCIPLINE_KEY,
|
|
CONTRACTSOORT, TYPECONTRACT_KEY, TYPECONTRACT, INGANGSDATUM, RAPPELDATUM,
|
|
RAPPELTERMIJN, OPZEGDATUM, OPZEGTERMIJN, EINDDATUM, EIGENAAR,
|
|
BEHEERDER, UITVOERDER, CONTACTPERSOON, KOSTENPLAATS, TERMIJNBEDRAG,
|
|
CONTRACTBEDRAG, LOCATIE_KEY, LOCATIE_CODE, GEBOUW_KEY, GEBOUW_CODE)
|
|
AS
|
|
SELECT basis.contract_key, basis.internnr, basis.externnr,
|
|
basis.beschrijving, basis.discipline_key, basis.contractsoort,
|
|
basis.typecontract_key, basis.typecontract, basis.ingangsdatum,
|
|
basis.rappeldatum, basis.rappeltermijn, basis.opzegdatum,
|
|
basis.opzegtermijn, basis.einddatum, basis.eigenaar,
|
|
basis.beheerder, basis.uitvoerder, basis.contactpersoon,
|
|
basis.kostenplaats, basis.termijnbedrag, basis.contractbedrag,
|
|
plaats.locatie_key, plaats.locatie_code, plaats.gebouw_key,
|
|
plaats.gebouw_code
|
|
FROM (SELECT cc.cnt_contract_key contract_key,
|
|
cc.cnt_contract_nummer_intern internnr,
|
|
cc.cnt_contract_nummer externnr,
|
|
cc.cnt_contract_omschrijving beschrijving,
|
|
cc.ins_discipline_key discipline_key,
|
|
cs.ins_discipline_omschrijving contractsoort,
|
|
tc.cnt_typecontract_key typecontract_key,
|
|
tc.cnt_typecontract_omschrijving typecontract,
|
|
TO_CHAR
|
|
(COALESCE (cc.cnt_contract_looptijd_van, SYSDATE),
|
|
'DD-MM-YYYY'
|
|
) ingangsdatum,
|
|
TO_CHAR
|
|
(COALESCE (cnt.cnt_getrappeldatum (cc.cnt_contract_key),
|
|
COALESCE (cc.cnt_contract_looptijd_tot,
|
|
SYSDATE
|
|
)
|
|
),
|
|
'DD-MM-YYYY'
|
|
) rappeldatum,
|
|
rt.cnt_termijn_omschrijving rappeltermijn,
|
|
TO_CHAR
|
|
(COALESCE (cnt.cnt_getopzegdatum (cc.cnt_contract_key),
|
|
COALESCE (cc.cnt_contract_looptijd_tot,
|
|
SYSDATE
|
|
)
|
|
),
|
|
'DD-MM-YYYY'
|
|
) opzegdatum,
|
|
ot.cnt_termijn_omschrijving opzegtermijn,
|
|
TO_CHAR (COALESCE (cc.cnt_contract_looptijd_tot, SYSDATE),
|
|
'DD-MM-YYYY'
|
|
) einddatum,
|
|
(SELECT d.prs_afdeling_naam6
|
|
FROM prs_v_aanwezigafdeling d
|
|
WHERE d.prs_afdeling_key =
|
|
cc.prs_afdeling_key_eig)
|
|
eigenaar,
|
|
(SELECT p.prs_perslid_naam
|
|
|| DECODE (NVL (p.prs_perslid_voorletters, ''),
|
|
'', '',
|
|
', ' || p.prs_perslid_voorletters
|
|
)
|
|
|| DECODE (NVL (p.prs_perslid_tussenvoegsel, ''),
|
|
'', '',
|
|
' ' || p.prs_perslid_tussenvoegsel
|
|
)
|
|
|| DECODE (NVL (p.prs_perslid_voornaam, ''),
|
|
'', '',
|
|
' (' || p.prs_perslid_voornaam || ')'
|
|
)
|
|
FROM prs_perslid p
|
|
WHERE p.prs_perslid_key = cc.prs_perslid_key_beh)
|
|
beheerder,
|
|
(SELECT b.prs_bedrijf_naam
|
|
FROM prs_bedrijf b
|
|
WHERE b.prs_bedrijf_key =
|
|
cc.cnt_prs_bedrijf_key)
|
|
uitvoerder,
|
|
(SELECT c.prs_contactpersoon_naam
|
|
|| DECODE (NVL (c.prs_contactpersoon_voorletters,
|
|
''),
|
|
'', '',
|
|
', ' || c.prs_contactpersoon_voorletters
|
|
)
|
|
|| DECODE (NVL (c.prs_contactpersoon_tussenv, ''),
|
|
'', '',
|
|
' ' || c.prs_contactpersoon_tussenv
|
|
)
|
|
|| DECODE (NVL (c.prs_contactpersoon_voornaam, ''),
|
|
'', '',
|
|
' ('
|
|
|| c.prs_contactpersoon_voornaam
|
|
|| ')'
|
|
) prs_contactpersoon_naam
|
|
FROM prs_contactpersoon c
|
|
WHERE c.prs_contactpersoon_key =
|
|
cc.prs_contactpersoon_key)
|
|
contactpersoon,
|
|
(SELECT k.prs_kostenplaats_nr
|
|
|| ' '
|
|
|| k.prs_kostenplaats_omschrijving
|
|
FROM prs_kostenplaats k
|
|
WHERE k.prs_kostenplaats_key = cc.prs_kostenplaats_key)
|
|
kostenplaats,
|
|
cc.cnt_contract_termijnkosten termijnbedrag,
|
|
cc.cnt_contract_kosten contractbedrag
|
|
FROM cnt_contract cc,
|
|
cnt_discipline cs,
|
|
cnt_disc_params dp,
|
|
cnt_typecontract tc,
|
|
cnt_termijn rt,
|
|
cnt_termijn ot
|
|
WHERE cc.ins_discipline_key = cs.ins_discipline_key
|
|
AND cc.ins_discipline_key = dp.cnt_ins_discipline_key
|
|
AND dp.cnt_srtcontract_type = tc.cnt_typecontract_key
|
|
AND cc.cnt_contract_rappeltermijn = rt.cnt_termijn_key
|
|
AND cc.cnt_contract_opzegtermijn = ot.cnt_termijn_key
|
|
AND cc.cnt_contract_verwijder IS NULL) basis
|
|
LEFT JOIN
|
|
(SELECT cp.cnt_contract_key contract_key,
|
|
DECODE (cp.cnt_alg_plaats_code,
|
|
'L', cp.cnt_alg_plaats_key,
|
|
(SELECT l.alg_locatie_key
|
|
FROM alg_gebouw g, alg_locatie l
|
|
WHERE g.alg_gebouw_key = cp.cnt_alg_plaats_key
|
|
AND g.alg_locatie_key = l.alg_locatie_key)
|
|
) locatie_key,
|
|
DECODE (cp.cnt_alg_plaats_code,
|
|
'L', (SELECT l.alg_locatie_code
|
|
FROM alg_locatie l
|
|
WHERE l.alg_locatie_key =
|
|
cp.cnt_alg_plaats_key),
|
|
(SELECT l.alg_locatie_code
|
|
FROM alg_gebouw g, alg_locatie l
|
|
WHERE g.alg_gebouw_key = cp.cnt_alg_plaats_key
|
|
AND g.alg_locatie_key = l.alg_locatie_key)
|
|
) locatie_code,
|
|
DECODE (cp.cnt_alg_plaats_code,
|
|
'G', cp.cnt_alg_plaats_key,
|
|
NULL
|
|
) gebouw_key,
|
|
DECODE (cp.cnt_alg_plaats_code,
|
|
'G', (SELECT g.alg_gebouw_code
|
|
FROM alg_gebouw g
|
|
WHERE g.alg_gebouw_key =
|
|
cp.cnt_alg_plaats_key),
|
|
NULL
|
|
) gebouw_code
|
|
FROM cnt_contract_plaats cp
|
|
WHERE cp.cnt_contract_plaats_verwijder IS NULL) plaats
|
|
ON basis.contract_key = plaats.contract_key;
|
|
|
|
/* Formatted on 31-1-2013 16:52:13 (QP5 v5.136.908.31019) */
|
|
CREATE_VIEW(cnt_v_contract_huurder,0)
|
|
(alg_onrgoed_key, cnt_contract_key, ins_discipline_key, cnt_prs_bedrijf_key1, cnt_prs_afdeling_key1,
|
|
cnt_contract_onrgoed_key, cnt_contract_onrgoed_opp1, cnt_contract_onrgoed_type1, cnt_mld_melding_key, cnt_prs_bedrijf_key2,
|
|
cnt_prs_afdeling_key2, cnt_contract_onrgoed_key2, cnt_contract_onrgoed_opp2, cnt_contract_onrgoed_type2, cnt_contract_key2)
|
|
AS
|
|
SELECT alg_onrgoed_key,
|
|
org_contract_key AS cnt_contract_key,
|
|
(SELECT ins_discipline_key
|
|
FROM cnt_contract c
|
|
WHERE c.cnt_contract_key = mut.org_contract_key)
|
|
AS cnt_srtcontract_key,
|
|
(SELECT c.cnt_prs_bedrijf_key
|
|
FROM cnt_contract c
|
|
WHERE c.cnt_contract_key = mut.org_contract_key)
|
|
AS cnt_prs_bedrijf_key1,
|
|
(SELECT c.cnt_prs_afdeling_key
|
|
FROM cnt_contract c
|
|
WHERE c.cnt_contract_key = mut.org_contract_key)
|
|
AS cnt_prs_afdeling_key1,
|
|
org_contract_onrgoed_key AS cnt_contract_onrgoed_key,
|
|
org_contract_onrgoed_opp AS cnt_contract_onrgoed_opp1,
|
|
NVL (
|
|
(SELECT sr.alg_srtruimte_code
|
|
FROM alg_srtruimte sr
|
|
WHERE sr.alg_srtruimte_key = mut.org_alg_srtonrgoed_key
|
|
AND mut.alg_onrgoed_niveau = 'R'),
|
|
(SELECT st.alg_srtterreinsector_code
|
|
FROM alg_srtterreinsector st
|
|
WHERE st.alg_srtterreinsector_key = mut.org_alg_srtonrgoed_key))
|
|
AS cnt_contract_onrgoed_type1,
|
|
cnt_melding_key AS cnt_mld_melding_key,
|
|
(SELECT c.cnt_prs_bedrijf_key
|
|
FROM cnt_contract c
|
|
WHERE c.cnt_contract_key = mut.mut_contract_key)
|
|
AS cnt_prs_bedrijf_key2,
|
|
(SELECT c.cnt_prs_afdeling_key
|
|
FROM cnt_contract c
|
|
WHERE c.cnt_contract_key = mut.mut_contract_key)
|
|
AS cnt_prs_afdeling_key2,
|
|
mut_contract_onrgoed_key AS cnt_contract_onrgoed_key2,
|
|
mut_contract_onrgoed_opp AS cnt_contract_onrgoed_opp2,
|
|
NVL (
|
|
(SELECT sr.alg_srtruimte_code
|
|
FROM alg_srtruimte sr
|
|
WHERE sr.alg_srtruimte_key = mut.org_alg_srtonrgoed_key
|
|
AND mut.alg_onrgoed_niveau = 'R'),
|
|
(SELECT st.alg_srtterreinsector_code
|
|
FROM alg_srtterreinsector st
|
|
WHERE st.alg_srtterreinsector_key = mut.mut_alg_srtonrgoed_key))
|
|
AS cnt_contract_onrgoed_type2,
|
|
mut_contract_key
|
|
FROM (SELECT cogo.alg_onrgoed_key,
|
|
cogm.cnt_mld_melding_key AS cnt_melding_key,
|
|
cogo.cnt_contract_key AS org_contract_key,
|
|
cogo.cnt_contract_onrgoed_key AS org_contract_onrgoed_key,
|
|
cogo.cnt_contract_onrgoed_opp AS org_contract_onrgoed_opp,
|
|
cogo.alg_srtonrgoed_key AS org_alg_srtonrgoed_key,
|
|
cogm.cnt_contract_key AS mut_contract_key,
|
|
cogm.cnt_contract_onrgoed_key AS mut_contract_onrgoed_key,
|
|
cogm.cnt_contract_onrgoed_opp AS mut_contract_onrgoed_opp,
|
|
cogm.alg_srtonrgoed_key AS mut_alg_srtonrgoed_key,
|
|
cogo.alg_onrgoed_niveau AS alg_onrgoed_niveau
|
|
FROM cnt_contract_onrgoed cogo, cnt_contract_onrgoed cogm
|
|
WHERE cogo.cnt_contract_onrgoed_key = cogm.cnt_contract_onrgoed_key_org
|
|
AND cogo.cnt_mld_melding_key IS NULL
|
|
AND cogm.cnt_mld_melding_key IS NOT NULL
|
|
AND cogm.cnt_contract_onrgoed_key_org IS NOT NULL
|
|
UNION ALL
|
|
SELECT cogo.alg_onrgoed_key,
|
|
cogo.cnt_mld_melding_key AS cnt_melding_key,
|
|
cogo.cnt_contract_key AS org_contract_key,
|
|
cogo.cnt_contract_onrgoed_key AS org_contract_onrgoed_key,
|
|
cogo.cnt_contract_onrgoed_opp AS org_contract_onrgoed_opp,
|
|
cogo.alg_srtonrgoed_key AS org_alg_srtonrgoed_key,
|
|
TO_NUMBER (NULL) AS mut_contract_key,
|
|
TO_NUMBER (NULL) AS mut_contract_onrgoed_key,
|
|
TO_NUMBER (NULL) AS mut_contract_onrgoed_opp,
|
|
TO_NUMBER (NULL) AS mut_alg_srtonrgoed_key,
|
|
cogo.alg_onrgoed_niveau AS alg_onrgoed_niveau
|
|
FROM cnt_contract_onrgoed cogo
|
|
WHERE cogo.cnt_contract_onrgoed_key NOT IN
|
|
(SELECT cnt_contract_onrgoed_key_org
|
|
FROM cnt_contract_onrgoed
|
|
WHERE cnt_contract_onrgoed_key_org IS NOT NULL)
|
|
AND cogo.cnt_mld_melding_key IS NULL
|
|
UNION ALL
|
|
SELECT cogm.alg_onrgoed_key,
|
|
cogm.cnt_mld_melding_key AS cnt_melding_key,
|
|
TO_NUMBER (NULL) AS org_contract_key,
|
|
TO_NUMBER (NULL) AS org_contract_onrgoed_key,
|
|
TO_NUMBER (NULL) AS org_contract_onrgoed_opp,
|
|
TO_NUMBER (NULL) AS org_alg_srtonrgoed_key,
|
|
cogm.cnt_contract_key AS mut_contract_key,
|
|
cogm.cnt_contract_onrgoed_key AS mut_contract_onrgoed_key,
|
|
cogm.cnt_contract_onrgoed_opp AS mut_contract_onrgoed_opp,
|
|
cogm.alg_srtonrgoed_key AS mut_alg_srtonrgoed_key,
|
|
cogm.alg_onrgoed_niveau AS alg_onrgoed_niveau
|
|
FROM cnt_contract_onrgoed cogm
|
|
WHERE cogm.cnt_mld_melding_key IS NOT NULL AND cogm.cnt_contract_onrgoed_key_org IS NULL)
|
|
mut;
|
|
|
|
-- Een eerste versie
|
|
CREATE_VIEW(cnt_v_api_contracten, 1)
|
|
AS
|
|
SELECT c.cnt_contract_key contract_key,
|
|
c.cnt_contract_nummer contract_nummer,
|
|
c.cnt_contract_omschrijving omschrijving,
|
|
c.cnt_contract_looptijd_van looptijd_van,
|
|
c.cnt_contract_looptijd_tot looptijd_tot,
|
|
c.cnt_contract_kosten kosten,
|
|
c.cnt_contract_nummer_intern nummer_intern,
|
|
c.cnt_contract_korting korting,
|
|
c.cnt_contract_contact_persoon contactpersoon,
|
|
c.cnt_contract_document beschrijving,
|
|
c.cnt_contract_status status,
|
|
c.cnt_contract_termijnkosten termijnkosten,
|
|
c.cnt_contract_opmerking opmerking,
|
|
c.cnt_contract_versie versie,
|
|
c.cnt_contract_verlenging verlenging,
|
|
cm.cnt_contract_nummer mantelcontract,
|
|
b.prs_bedrijf_naam bedrijf,
|
|
a1.prs_afdeling_naam afdeling,
|
|
d.ins_discipline_omschrijving discipline,
|
|
p1.prs_perslid_naam_full eigenaar,
|
|
p2.prs_perslid_naam_full beheerder,
|
|
kp.prs_kostenplaats_omschrijving,
|
|
ks.prs_kostensoort_oms kostensoort,
|
|
t1.cnt_termijn_omschrijving opzegtermijn,
|
|
pd.prs_dienst_omschrijving dienst,
|
|
cp.prs_contactpersoon_naam contactpersoon_extern,
|
|
c.ins_discipline_key fclt_3d_discipline_key,
|
|
c.cnt_prs_afdeling_key fclt_3d_afdeling_key
|
|
FROM cnt_contract c,
|
|
cnt_contract cm,
|
|
prs_bedrijf b,
|
|
prs_afdeling a1,
|
|
ins_tab_discipline d,
|
|
prs_v_perslid_fullnames_all p1,
|
|
prs_v_perslid_fullnames_all p2,
|
|
prs_kostenplaats kp,
|
|
prs_kostensoort ks,
|
|
cnt_termijn t1,
|
|
prs_dienst pd,
|
|
prs_contactpersoon cp
|
|
WHERE c.cnt_prs_bedrijf_key = b.prs_bedrijf_key(+)
|
|
AND c.cnt_prs_afdeling_key = a1.prs_afdeling_key(+)
|
|
AND c.prs_contactpersoon_key = cp.prs_contactpersoon_key(+)
|
|
AND c.ins_discipline_key = d.ins_discipline_key(+)
|
|
AND c.prs_perslid_key_eig = p1.prs_perslid_key(+)
|
|
AND c.prs_perslid_key_beh = p2.prs_perslid_key(+)
|
|
AND c.prs_kostenplaats_key = kp.prs_kostenplaats_key(+)
|
|
AND c.prs_kostensoort_key = ks.prs_kostensoort_key(+)
|
|
AND c.cnt_contract_mantel_key = cm.cnt_contract_key(+)
|
|
AND c.cnt_contract_opzegtermijn = t1.cnt_termijn_key
|
|
AND c.prs_dienst_key = pd.prs_dienst_key(+)
|
|
AND c.cnt_contract_verwijder IS NULL;
|
|
|
|
REGISTERRUN('$Workfile: CNT_VIE.SRC $','$Revision$')
|
|
|
|
#endif // CNT
|