--
-- $Id$
--
-- Indexeren van kosten periodieke taken met 5% voor WOSA

DEFINE thisfile = 'WOXX#79945.sql'
DEFINE dbuser   = 'WOSA'

SET ECHO ON
SET DEFINE ON
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
COLUMN fcltcusttxt NEW_VALUE fcltcusttxt NOPRINT;
WHENEVER SQLERROR CONTINUE;
SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL;
SPOOL &fcltlogfile
WHENEVER SQLERROR EXIT;
SELECT adm.checkscriptcust('&dbuser') AS fcltcusttxt FROM DUAL;
WHENEVER SQLERROR CONTINUE;
---------------------------------------
PROMPT &fcltcusttxt
---------------------------------------
SET DEFINE OFF

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

BEGIN
   DECLARE
      CURSOR c1
      IS
         SELECT ins_srtcontrole_key FROM ins_srtcontrole;
   BEGIN
      FOR rec IN c1
      LOOP
         BEGIN
            UPDATE ins_srtcontrole
               SET ins_srtcontrole_kosten2 = ins_srtcontrole_kosten2 * 1.05
             WHERE ins_srtcontrole_key = rec.ins_srtcontrole_key;

            FAC.trackaction ('CTRSUP',
                             rec.ins_srtcontrole_key,
                             3,
                             SYSDATE,
                             'Indexatie van 5% uitgevoerd door systeem.');
         END;
      END LOOP;

      UPDATE ins_srtcontroledl_xcp
         SET ins_srtcontroledl_xcp_kosten2 =
                ins_srtcontroledl_xcp_kosten2 * 1.05;
   END;
END;
/
    
------ payload end   ------

SET DEFINE OFF
BEGIN adm.systrackscriptId ('$Id$', 0); END;
/

COMMIT;
SET ECHO OFF
SPOOL OFF
SET DEFINE ON
PROMPT Logfile of this upgrade is: &fcltlogfile