-- Customer specific once-script UWVA97.
--
-- (c) 2015 SG|facilitor bv
SET ECHO ON
SPOOL xuwva97.lst
SET DEFINE OFF

-- UWVA#34650
DELETE FROM fac_usrrap WHERE fac_usrrap_key IN (1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 905, 906, 907, 908, 386, 387, 388, 389, 391, 466);
DROP VIEW uwva_v_rap_schn_mi_opdr;
DROP VIEW uwva_v_rap_schz_mi_opdr;
DROP VIEW uwva_v_rap_sch_mi_opdr;
DROP VIEW uwva_v_rap_schn_mi_rsp;
DROP VIEW uwva_v_rap_schz_mi_rsp;
DROP VIEW uwva_v_rap_sch_mi_rsp;
DROP VIEW uwva_v_rap_schn_mi_afh;
DROP VIEW uwva_v_rap_schz_mi_afh;
DROP VIEW uwva_v_rap_sch_mi_afh;
DROP VIEW uwva_v_rap_schn_klachten;
DROP VIEW uwva_v_rap_schz_klachten;
DROP VIEW uwva_v_rap_sch_klachten;
DROP VIEW uwva_v_sch_mi_opdr;

DROP VIEW UWVA_V_RAP_CAT1_ACTUAL;
DROP VIEW UWVA_V_RAP_CAT2_ACTUAL;
DROP VIEW UWVA_V_RAP_CAT1_FROZEN;
DROP VIEW UWVA_V_RAP_CAT2_FROZEN;

DROP VIEW uwva_v_rap_hv_doorbel_actual;
DROP VIEW uwva_v_rap_hv_doorbel_frozen;
DROP VIEW uwva_v_rap_hv_doorbel_tot;
DROP VIEW uwva_v_rap_hv_ruimte_controle;
DROP VIEW uwva_v_rap_hv_pandenlijst;
DROP VIEW uwva_v_rap_hv_leegstandslijst;
DROP VIEW uwva_v_hv_actual;

-- Label 101=HV-Mutaties deze maand
DELETE FROM cad_label WHERE cad_label_key = 101;
DROP VIEW uwva_v_label_track_algcad;

-- Thema 161=HV-Mutaties deze maand (met legenda 241=Legenda_HV:Divisie)
DELETE FROM cad_thema WHERE cad_thema_key = 161;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 241;
DELETE FROM cad_legenda WHERE cad_legenda_key = 241;
DROP VIEW uwva_v_thema_mutsincefreeze;

DROP TABLE uwva_hv_freeze PURGE;

-- Thema 41=HV:NOR-Divisie (met legenda 52=Legenda_HV:NOR-Divisie)
DELETE FROM cad_thema WHERE cad_thema_key = 41;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 52;
DELETE FROM cad_legenda WHERE cad_legenda_key = 52;
DROP VIEW uwva_v_thema_nor_divisie;
-- Thema 42=HV:NOR-Afdeling (met legenda 51=Legenda_HV:NOR-Afdeling)
DELETE FROM cad_thema WHERE cad_thema_key = 42;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 51;
DELETE FROM cad_legenda WHERE cad_legenda_key = 51;
DROP VIEW uwva_v_thema_nor_afdeling;

-- Thema 101=HV:Divisie (met legenda 161=Legenda_HV:Divisie)
DELETE FROM cad_thema WHERE cad_thema_key = 101;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 161;
DELETE FROM cad_legenda WHERE cad_legenda_key = 161;
DROP VIEW uwva_v_thema_hvdivisie;
-- Thema 44=HV:Divisie-kostenplaats (met legenda 50=Legenda_HV:Divisie-kostenplaats)
DELETE FROM cad_thema WHERE cad_thema_key = 44;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 50;
DELETE FROM cad_legenda WHERE cad_legenda_key = 50;
DROP VIEW uwva_v_thema_hvdivisiekp;
-- Thema 45=HV:Afdeling (old) (met legenda 47=Legenda_HV:Afdeling)
DELETE FROM cad_thema WHERE cad_thema_key = 45;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 47;
DELETE FROM cad_legenda WHERE cad_legenda_key = 47;
DROP VIEW uwva_v_thema_hvafdeling;
-- Thema 46=HV:Afdeling-kostenplaats (met legenda 48=Legenda_HV:Afdeling-kostenplaats)
DELETE FROM cad_thema WHERE cad_thema_key = 46;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 48;
DELETE FROM cad_legenda WHERE cad_legenda_key = 48;
DROP VIEW uwva_v_thema_hvafdelingkp;

-- Thema 47=HV:Aantal werkplekken (met legenda 82=Legenda_HV:Aantal werkplekken)
DELETE FROM cad_thema WHERE cad_thema_key = 47;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 82;
DELETE FROM cad_legenda WHERE cad_legenda_key = 82;
DROP VIEW uwva_v_thema_hvnwp;
-- Thema 50=FM:Aantal werkplekken (met legenda 41=Legenda_FM:Aantal werkplekken)
DELETE FROM cad_thema WHERE cad_thema_key = 50;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 41;
DELETE FROM cad_legenda WHERE cad_legenda_key = 41;
DROP VIEW uwva_v_thema_nwp;

-- Thema 81=FM:Afdeling mismatch (met legenda 141=Legenda_FM:Afdeling mismatch)
DELETE FROM cad_thema WHERE cad_thema_key = 81;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 141;
DELETE FROM cad_legenda WHERE cad_legenda_key = 141;
DROP VIEW uwva_v_thema_afdeling_mismatch; 
-- Thema 82=FM:Kostenplaats personen (met legenda 43=Legenda_FM:Kostenplaats)
-- Thema 83=FM:Kostenplaats afdelingen (met legenda 43=Legenda_FM:Kostenplaats)
DELETE FROM cad_thema WHERE cad_thema_key = 82;
DELETE FROM cad_thema WHERE cad_thema_key = 83;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 43;
DELETE FROM cad_legenda WHERE cad_legenda_key = 43;
DROP VIEW uwva_v_thema_kostenplaats_prs;
DROP VIEW uwva_v_thema_kostenplaats_afd;

-- Thema 125=HV-Controle (met legenda 183=HV-Controle)
DELETE FROM cad_thema WHERE cad_thema_key = 125;
DELETE FROM cad_legendawaarde WHERE cad_legenda_key = 183;
DELETE FROM cad_legenda WHERE cad_legenda_key = 183;
DROP VIEW uwva_v_thema_ruimte_controle;

DELETE FROM fac_notificatie_job WHERE fac_notificatie_job_key = 101;
DROP VIEW uwva_v_noti_lfmopenmelding;

-- UWVA#33269 Diverse management rapportages
-- Bron-view 'uwva_v_afh_geb_grp' loopt via tabelizer tbv. performance!
CREATE OR REPLACE VIEW UWVA_V_ST_KL_GEB AS SELECT NULL x FROM DUAL;
INSERT INTO fac_usrrap (fac_usrrap_omschrijving,
                        fac_usrrap_view_name,
                        fac_usrrap_vraagbegindatum,
                        fac_usrrap_vraageinddatum,
                        fac_usrrap_functie,
                        fac_usrrap_info,
                        fac_functie_key,
                        fac_usrrap_autorefresh)
   SELECT 'BEHEER: Hidden tbv. tabelizer/performance 1467+1468',
          'UWVA_V_ST_KL_GEB',
          0,
          0,
          8,                                                 -- Via tabelizer!
          'Alleen zichtbaar onder de motorkap!',
          fac_functie_key,
          0
     FROM fac_functie
    WHERE fac_functie_code = 'WEB_USER50';

COMMIT;
BEGIN adm.systrackscriptId('$Id$'); END;
/
SPOOL OFF

@@uwva_prs.sql
@@uwva_fin.sql
@@uwva_hv.sql
@@uwva_misc.sql

BEGIN fac.registercustversion('UWVA', 97); END;
/
COMMIT;
