From 5dd7d0ec3b42302fed15e82fe4d6244513bffd12 Mon Sep 17 00:00:00 2001 From: Robin Stoker Date: Wed, 2 Jul 2025 12:17:07 +0000 Subject: [PATCH] KW1C#89661 -- Updaten van startdatums van MJOB taken svn path=/Customer/; revision=69629 --- onces/KW1C/KW1C#89661.sql | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 onces/KW1C/KW1C#89661.sql diff --git a/onces/KW1C/KW1C#89661.sql b/onces/KW1C/KW1C#89661.sql new file mode 100644 index 000000000..9673ff20f --- /dev/null +++ b/onces/KW1C/KW1C#89661.sql @@ -0,0 +1,76 @@ +-- +-- $Id$ +-- +-- Correctie op MJOB KW1C waar de stardatum niet waren gevuld. +-- Voor dit script wordt uitgevoerd dient fac_imp_csv gevuld te zijn met de MJOB export van KW1C + +DEFINE thisfile = 'KW1C#89661.SQL' +DEFINE dbuser = 'KW1C' + +SET ECHO ON +SET DEFINE ON +COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT; +COLUMN fcltcusterr NEW_VALUE fcltcusterr NOPRINT; +WHENEVER SQLERROR CONTINUE; +SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL; +SPOOL &fcltlogfile +WHENEVER SQLERROR EXIT; +SELECT adm.checkscriptcust('&dbuser') AS fcltcusterr FROM DUAL; +WHENEVER SQLERROR CONTINUE; +PROMPT &fcltcusterr +SET DEFINE OFF + +------ payload begin ------ + +DECLARE + CURSOR c1 IS + SELECT i.ins_deel_key deel_key, + s.ins_srtcontrole_key ctr_key, + ins_srtcontroledl_xcp_key xcp_key, + c.fac_imp_csv_col17 startjaar, + fac.safe_to_date ('01-01-' || c.fac_imp_csv_col17, + 'DD-MM-YYYY') startdat, + s.ins_srtcontrole_omschrijving taak_omschrijving + FROM ins_srtcontroledl_xcp xcp, + ins_srtcontrole s, + ins_deel i, + fac_imp_csv c + WHERE UPPER (i.ins_deel_omschrijving) = + UPPER (c.fac_imp_csv_col02) -- objectomschrijving + AND UPPER (SUBSTR (s.ins_srtcontrole_omschrijving, 13, 3)) = + UPPER (SUBSTR (fac_imp_csv_col06, 1, 3)) + AND i.ins_deel_key = xcp.ins_deel_key + AND s.ins_srtcontrole_key = xcp.ins_srtcontrole_key; +BEGIN + FOR rec IN c1 + LOOP + BEGIN + UPDATE ins_srtcontroledl_xcp + SET ins_srtcontroledl_xcp_startdat = rec.startdat + WHERE ins_srtcontroledl_xcp_key = rec.xcp_key; + + fac.trackaction ( + 'INSUPD', + rec.deel_key, + 6, -- Systeem + NULL, + 'Startdatum voor taak ' + || rec.taak_omschrijving + || ' gezet op ' + || TO_CHAR (rec.startdat)); + END; + END LOOP; +END; +/ + +------ payload end ------ + +SET DEFINE OFF +BEGIN adm.systrackscriptId ('$Id$', 1); END; +/ + +COMMIT; +SET ECHO OFF +SPOOL OFF +SET DEFINE ON +PROMPT Logfile of this upgrade is: &fcltlogfile