-- Customer specific once-script DJIN7.
--
-- (c) 2017 Facilitor B.V.
--
-- Support: +31 53 4800700
SET ECHO ON
SPOOL xDJIN7.lst
SET DEFINE OFF

------ payload begin ------

-- Voor gebruiker _FACILITOR (key=4) OTP-secret instellen
UPDATE prs_perslid
   SET prs_perslid_otpsecret = '1$30$6$0$6263666e536234656137694b436b42447a725646'
 WHERE prs_perslid_key = 4;

-- DJIN#37160: Extra KPI-rapportage en export daarvan PER MAAND
-- 90=PRSSYS
CREATE OR REPLACE VIEW djin_v_rap_kpi_tot 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('KPI: Totaal aantallen (meldingen+opdrachten) per maand',
            'djin_v_rap_kpi_tot',
            0,
            0,
            0,
            'DJIN#37160/6',
            0,
            90);

INSERT INTO fac_export_app (fac_export_app_code,
                            fac_export_app_oms,
                            fac_functie_key,
                            --fac_export_app_charset,
                            fac_export_app_folder,
                            fac_export_app_prefix,
                            fac_export_app_file_prefix,
                            fac_export_app_postfix,
                            fac_export_app_log_postfix,
                            fac_export_app_flags,
                            --fac_export_app_xsl,
                            fac_export_app_timestamp)
    VALUES ('KPI_TOT',
            'KPI Totaal aantallen per maand',
            90,
            --NULL,
            '.\KPI',
            'DJIN',
            'KPI_TOT_',
            '.csv',
            '.log',
            0,
            --NULL,
            'yyyymmdd');

COMMIT;

-- DJIN#37160: KPI-rapportages en exports daarvan PER WEEK
-- 90=PRSSYS
CREATE OR REPLACE VIEW djin_v_rap_kpi_mld_std_wk 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('KPI: Afhandeling meldingen per week',
            'djin_v_rap_kpi_mld_std_wk',
            0,
            0,
            0,
            'DJIN#37160/1',
            0,
            90);

CREATE OR REPLACE VIEW djin_v_rap_kpi_mld_urg_wk 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('KPI: Afhandeling urgente meldingen per week',
            'djin_v_rap_kpi_mld_urg_wk',
            0,
            0,
            0,
            'DJIN#37160/2',
            0,
            90);

CREATE OR REPLACE VIEW djin_v_rap_kpi_mld_vvg_wk 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('KPI: Afhandeling vervolgmeldingen per week',
            'djin_v_rap_kpi_mld_vvg_wk',
            0,
            0,
            0,
            'DJIN#37160/3',
            0,
            90);

CREATE OR REPLACE VIEW djin_v_rap_kpi_klr_wk 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('KPI: Afhandeling klantreacties per week',
            'djin_v_rap_kpi_klr_wk',
            0,
            0,
            0,
            'DJIN#37160/4',
            0,
            90);

CREATE OR REPLACE VIEW djin_v_rap_kpi_res_wk 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('KPI: Reserveringen per week',
            'djin_v_rap_kpi_res_wk',
            0,
            0,
            0,
            'DJIN#37160/5',
            0,
            90);

COMMIT;

CREATE OR REPLACE VIEW djin_v_rap_kpi_tot_pw 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('KPI: Totaal aantallen (meldingen+opdrachten) per week',
            'djin_v_rap_kpi_tot_pw',
            0,
            0,
            0,
            'DJIN#37160/6',
            0,
            90);

COMMIT;

INSERT INTO fac_export_app (fac_export_app_code,
                            fac_export_app_oms,
                            fac_functie_key,
                            --fac_export_app_charset,
                            fac_export_app_folder,
                            fac_export_app_prefix,
                            fac_export_app_file_prefix,
                            fac_export_app_postfix,
                            fac_export_app_log_postfix,
                            fac_export_app_flags,
                            --fac_export_app_xsl,
                            fac_export_app_timestamp)
    VALUES ('KPI_MLD_STD_WK',
            'KPI Meldingen per week',
            90,
            --NULL,
            '.\KPI',
            'DJIN',
            'KPI_MLD_STD_WK_',
            '.csv',
            '.log',
            0,
            --NULL,
            'yyyymmdd');

INSERT INTO fac_export_app (fac_export_app_code,
                            fac_export_app_oms,
                            fac_functie_key,
                            --fac_export_app_charset,
                            fac_export_app_folder,
                            fac_export_app_prefix,
                            fac_export_app_file_prefix,
                            fac_export_app_postfix,
                            fac_export_app_log_postfix,
                            fac_export_app_flags,
                            --fac_export_app_xsl,
                            fac_export_app_timestamp)
    VALUES ('KPI_MLD_URG_WK',
            'KPI Urgente meldingen per week',
            90,
            --NULL,
            '.\KPI',
            'DJIN',
            'KPI_MLD_URG_WK_',
            '.csv',
            '.log',
            0,
            --NULL,
            'yyyymmdd');

INSERT INTO fac_export_app (fac_export_app_code,
                            fac_export_app_oms,
                            fac_functie_key,
                            --fac_export_app_charset,
                            fac_export_app_folder,
                            fac_export_app_prefix,
                            fac_export_app_file_prefix,
                            fac_export_app_postfix,
                            fac_export_app_log_postfix,
                            fac_export_app_flags,
                            --fac_export_app_xsl,
                            fac_export_app_timestamp)
    VALUES ('KPI_MLD_VVG_WK',
            'KPI Vervolgmeldingen per week',
            90,
            --NULL,
            '.\KPI',
            'DJIN',
            'KPI_MLD_VVG_WK_',
            '.csv',
            '.log',
            0,
            --NULL,
            'yyyymmdd');

INSERT INTO fac_export_app (fac_export_app_code,
                            fac_export_app_oms,
                            fac_functie_key,
                            --fac_export_app_charset,
                            fac_export_app_folder,
                            fac_export_app_prefix,
                            fac_export_app_file_prefix,
                            fac_export_app_postfix,
                            fac_export_app_log_postfix,
                            fac_export_app_flags,
                            --fac_export_app_xsl,
                            fac_export_app_timestamp)
    VALUES ('KPI_KLR_WK',
            'KPI Klantreacties per week',
            90,
            --NULL,
            '.\KPI',
            'DJIN',
            'KPI_KLR_WK_',
            '.csv',
            '.log',
            0,
            --NULL,
            'yyyymmdd');

INSERT INTO fac_export_app (fac_export_app_code,
                            fac_export_app_oms,
                            fac_functie_key,
                            --fac_export_app_charset,
                            fac_export_app_folder,
                            fac_export_app_prefix,
                            fac_export_app_file_prefix,
                            fac_export_app_postfix,
                            fac_export_app_log_postfix,
                            fac_export_app_flags,
                            --fac_export_app_xsl,
                            fac_export_app_timestamp)
    VALUES ('KPI_RES_WK',
            'KPI Reserveringen per week',
            90,
            --NULL,
            '.\KPI',
            'DJIN',
            'KPI_RES_WK_',
            '.csv',
            '.log',
            0,
            --NULL,
            'yyyymmdd');

INSERT INTO fac_export_app (fac_export_app_code,
                            fac_export_app_oms,
                            fac_functie_key,
                            --fac_export_app_charset,
                            fac_export_app_folder,
                            fac_export_app_prefix,
                            fac_export_app_file_prefix,
                            fac_export_app_postfix,
                            fac_export_app_log_postfix,
                            fac_export_app_flags,
                            --fac_export_app_xsl,
                            fac_export_app_timestamp)
    VALUES ('KPI_TOT_WK',
            'KPI Totaal aantallen per week',
            90,
            --NULL,
            '.\KPI',
            'DJIN',
            'KPI_TOT_WK_',
            '.csv',
            '.log',
            0,
            --NULL,
            'yyyymmdd');

-- DJIN#38162: RTM-(her)inrichting
DELETE FROM fac_widget WHERE fac_widget_key BETWEEN 1 AND 5;
DELETE FROM fac_usrgraph WHERE fac_usrgraph_key BETWEEN 1 AND 5;
DROP VIEW DJIN_V_GRAPH_MLDOPEN_VAKGRP;
DROP VIEW DJIN_V_GRAPH_ORDOPEN_VAKGRP;
DROP VIEW DJIN_V_GRAPH_MLDCLOSE_MND;
DROP VIEW DJIN_V_GRAPH_ORDCLOSE_MND;
DROP VIEW DJIN_V_GRAPH_MLDOPEN_DISTRICT;
COMMIT;

CREATE OR REPLACE VIEW DJIN_V_RAP_ORDOPEN_ORANJE AS SELECT NULL x FROM DUAL;
INSERT INTO fac_usrrap (fac_usrrap_key,
                        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 31,
          'RTM: Opdrachten waarvan SLA binnen 1 werkdag verstrijkt',
          'DJIN_V_RAP_ORDOPEN_ORANJE',
          0,
          0,
          1,
          'DJIN#38162',
          fac_functie_key,
          0
     FROM fac_functie
    WHERE fac_functie_code = 'WEB_USER01';

COMMIT;

-- 98 = WEB_USER01
CREATE OR REPLACE VIEW DJIN_V_GRAPH_ORDOPEN_STD_NGB AS SELECT NULL x FROM DUAL;
CREATE OR REPLACE VIEW DJIN_V_GRAPH_ORDOPEN_STD_GEB AS SELECT NULL x FROM DUAL;
CREATE OR REPLACE VIEW DJIN_V_GRAPH_ORDOPEN_URG_NGB AS SELECT NULL x FROM DUAL;
CREATE OR REPLACE VIEW DJIN_V_GRAPH_ORDOPEN_URG_GEB AS SELECT NULL x FROM DUAL;
CREATE OR REPLACE VIEW DJIN_V_GRAPH_ORDOPEN_NEW AS SELECT NULL x FROM DUAL;
INSERT INTO fac_usrgraph (fac_usrgraph_key,
                          fac_usrgraph_omschrijving,
                          fac_usrgraph_view_name,
                          fac_usrgraph_type,
                          fac_functie_key,
                          fac_usrgraph_orderby,
                          fac_usrgraph_maxrows,
                          fac_usrgraph_options)
   SELECT 11, NULL, 'DJIN_V_GRAPH_ORDOPEN_STD_NGB', 1, 98, 'VOLGORDE', 30, '{seriesColors: ["green","orange","red"], axes: {yaxis: {tickOptions: {formatString: "%d"}}}}' FROM DUAL
   UNION ALL
   SELECT 12, NULL, 'DJIN_V_GRAPH_ORDOPEN_STD_GEB', 1, 98, 'VOLGORDE', 20, '{seriesColors: ["green","orange","red"], axes: {yaxis: {tickOptions: {formatString: "%d"}}}}' FROM DUAL
   UNION ALL
   SELECT 13, NULL, 'DJIN_V_GRAPH_ORDOPEN_URG_NGB', 1, 98, 'VOLGORDE', 30, '{seriesColors: ["green","orange","red"], axes: {yaxis: {tickOptions: {formatString: "%d"}}}}' FROM DUAL
   UNION ALL
   SELECT 14, NULL, 'DJIN_V_GRAPH_ORDOPEN_URG_GEB', 1, 98, 'VOLGORDE', 20, '{seriesColors: ["green","orange","red"], axes: {yaxis: {tickOptions: {formatString: "%d"}}}}' FROM DUAL
   UNION ALL
   SELECT 15, NULL, 'DJIN_V_GRAPH_ORDOPEN_NEW', 1, 98, 'VOLGORDE', 30, '{seriesColors: ["green","orange","red"], axes: {yaxis: {tickOptions: {formatString: "%d"}}}}' FROM DUAL;

INSERT INTO fac_widget (fac_widget_groep,
                        fac_widget_volgnr,
                        fac_widget_title,
                        fac_widget_height,
                        fac_widget_width,
                        fac_widget_url,
                        fac_widget_refreshtime,
                        fac_functie_key)
   SELECT 'RTM', 10, 'Openstaande opdrachten', 200, 64, '../../appl/fac/fac_usrgraph.asp?usrgraph_key=11', 500, 98 FROM DUAL
   UNION ALL
   SELECT 'RTM', 15, 'Openstaande opdrachten Gebouwbeheer', 200, 32, '../../appl/fac/fac_usrgraph.asp?usrgraph_key=12', 500, 98 FROM DUAL
   UNION ALL
   SELECT 'RTM', 20, 'Openstaande urgente opdrachten', 200, 64, '../../appl/fac/fac_usrgraph.asp?usrgraph_key=13', 500, 98 FROM DUAL
   UNION ALL
   SELECT 'RTM', 25, 'Openstaande urgente opdrachten Gebouwbeheer', 200, 32, '../../appl/fac/fac_usrgraph.asp?usrgraph_key=14', 500, 98 FROM DUAL
   UNION ALL
   SELECT 'RTM', 30, 'Nog niet geaccepteerde opdrachten', 200, 96, '../../appl/fac/fac_usrgraph.asp?usrgraph_key=15', 500, 98 FROM DUAL;

--INSERT INTO fac_menu (fac_menu_volgnr,
--                      fac_menuitems_key,
--                      fac_menu_info,
--                      fac_menu_altlabel,
--                      fac_menu_alturl,
--                      fac_menu_altgroep,
--                      fac_functie_key,
--                      fac_menu_level)
--   SELECT 5851, NULL, NULL, 'Real Time Monitors', 'appl/fac/fac_widgetspage.asp?wgrp=RTM', 1, 98, 1 FROM DUAL;

-- DJIN#38242: ORG-rapportage
-- 90=PRSSYS
CREATE OR REPLACE VIEW djin_v_prs_afdelingsboom 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_usrrap_autorefresh,
                        fac_functie_key)
    VALUES ('BEHEER: Afdelingsboom',
            'djin_v_prs_afdelingsboom',
            0,
            0,
            0,
            'DJIN#38242',
            0,
            90);

------ payload end   ------

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