120 lines
4.7 KiB
SQL
120 lines
4.7 KiB
SQL
--
|
||
-- $Id$
|
||
--
|
||
-- Customer specific once-script BLCC#86198.SQL.
|
||
DEFINE thisfile = 'BLCC#86198.sql'
|
||
DEFINE dbuser = '^BLCC'
|
||
|
||
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 ------
|
||
|
||
-- BLCC#86198
|
||
-- Voor alle in januari 2025 lopende (en definieve) contracten onder de
|
||
-- contractsoorten 2122=LA, 2123=LA CRF, 2181=SLA Brightlands CRF - CV en
|
||
-- 2185=SLA Managed Connectivity de betreffende velden x 1.031 (met 3,1%
|
||
-- indexeren).
|
||
SET SERVEROUTPUT ON size 1000000;
|
||
|
||
DECLARE
|
||
CURSOR c
|
||
IS
|
||
SELECT DISTINCT kc.cnt_contract_key
|
||
FROM cnt_kenmerkcontract kc
|
||
WHERE kc.cnt_kenmerkcontract_verwijder IS NULL
|
||
AND EXISTS
|
||
(SELECT 1
|
||
FROM cnt_kenmerk
|
||
WHERE (cnt_srtkenmerk_key IN (385, 386, 387, 388, 389) -- Contracttarief H/K/L/O/T [LA+LA CRF]
|
||
OR cnt_kenmerk_key IN (663, 664, 671) -- Rent Infra/Rent Utilities/Rent Expedition space [SLA CRF-CV]
|
||
OR cnt_kenmerk_key = 637) -- Managed Connectivity [SLA MC]
|
||
AND cnt_kenmerk_key = kc.cnt_kenmerk_key)
|
||
AND EXISTS
|
||
(SELECT 1
|
||
FROM cnt_v_aanwezigcontract
|
||
WHERE ins_discipline_key IN (2122, 2123, 2181, 2185) -- LA/LA CRF/SLA CRF-CV/SLA MC
|
||
AND TRUNC (cnt_contract_looptijd_van) < fac.safe_to_date ('31012025', 'ddmmyyyy') -- Van-datum < einde te factureren maand
|
||
AND cnt_contract_looptijd_tot > fac.safe_to_date ('01012025', 'ddmmyyyy') -- Tot-datum > begin te factureren maand
|
||
AND cnt_contract_status IN (0, 2) -- Definitief
|
||
AND cnt_contract_key = kc.cnt_contract_key)
|
||
ORDER BY kc.cnt_contract_key;
|
||
|
||
v_count NUMBER := 0;
|
||
BEGIN
|
||
FOR rec IN c
|
||
LOOP
|
||
BEGIN
|
||
UPDATE cnt_kenmerkcontract kc
|
||
SET kc.cnt_kenmerkcontract_waarde = ROUND (1.031 * kc.cnt_kenmerkcontract_waarde, 2)
|
||
WHERE EXISTS
|
||
(SELECT 1
|
||
FROM cnt_kenmerk
|
||
WHERE (cnt_srtkenmerk_key IN (385, 386, 387, 388, 389) -- Contracttarief H/K/L/O/T[LA+LA CRF]
|
||
OR cnt_kenmerk_key IN (663, 664, 671) -- Rent Infra/Rent Utilities/Rent Expedition space[SLA CRF-CV]
|
||
OR cnt_kenmerk_key = 637) -- Managed Connectivity[SLA MC]
|
||
AND cnt_kenmerk_key = kc.cnt_kenmerk_key)
|
||
AND kc.cnt_contract_key = rec.cnt_contract_key;
|
||
fac.trackaction ('CNTUPD', rec.cnt_contract_key, NULL, NULL, 'Contracttarieven ge<67>ndexeerd (3,1%)');
|
||
v_count := v_count + 1;
|
||
END;
|
||
END LOOP;
|
||
|
||
DBMS_OUTPUT.PUT_LINE ('S: ' || TO_CHAR (v_count) || ' contracten gewijzigd');
|
||
END;
|
||
/
|
||
|
||
-- Alle Gebouw-tarieven x 1.08225 (met 8,225% indexeren).
|
||
DECLARE
|
||
CURSOR c
|
||
IS
|
||
SELECT DISTINCT ok.alg_onrgoed_key
|
||
FROM alg_onrgoedkenmerk ok
|
||
WHERE ok.alg_onrgoedkenmerk_verwijder IS NULL
|
||
AND ok.alg_onrgoed_niveau = 'G'
|
||
AND ok.alg_kenmerk_key IN (1180, 1181, 1182, 1183, 1184) -- Standaardtarief Rent L/H/K/O/T
|
||
AND EXISTS (SELECT 1 FROM alg_v_aanweziggebouw WHERE alg_gebouw_key = ok.alg_onrgoed_key)
|
||
ORDER BY ok.alg_onrgoed_key;
|
||
|
||
v_count NUMBER := 0;
|
||
BEGIN
|
||
FOR rec IN c
|
||
LOOP
|
||
BEGIN
|
||
UPDATE alg_onrgoedkenmerk
|
||
SET alg_onrgoedkenmerk_waarde = ROUND (1.044 * alg_onrgoedkenmerk_waarde, 2)
|
||
WHERE alg_onrgoedkenmerk_verwijder IS NULL
|
||
AND alg_onrgoed_niveau = 'G'
|
||
AND alg_kenmerk_key IN (1180, 1181, 1182, 1183, 1184) -- Standaardtarief Rent L/H/K/O/T
|
||
AND alg_onrgoed_key = rec.alg_onrgoed_key;
|
||
fac.trackaction ('ALGGUP', rec.alg_onrgoed_key, NULL, NULL, 'Gebouw-tarieven ge<67>ndexeerd (8,225%)');
|
||
v_count := v_count + 1;
|
||
END;
|
||
END LOOP;
|
||
|
||
DBMS_OUTPUT.PUT_LINE('S: ' || TO_CHAR (v_count) || ' Gebouw-tarieven gewijzigd');
|
||
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
|