AAXX#65358: Freezekosten bij Objecten met aantal > 1.

svn path=/Database/trunk/; revision=50007
This commit is contained in:
Maykel Geerdink
2021-02-23 15:04:22 +00:00
parent eb568f6f10
commit 40c4a8ffa1

View File

@@ -324,7 +324,7 @@ ALTER TABLE prs_bedrijfadres ADD CONSTRAINT prs_c_prs_bedrijfadrestype CHECK (p
ALTER TABLE fac_notificatie ADD prs_bedrijfadres_key
NUMBER(10) CONSTRAINT prs_r_bedrijfadres_key1
REFERENCES prs_bedrijfadres(prs_bedrijfadres_key) ON DELETE CASCADE;
ALTER TABLE fac_notificatie_job ADD fac_notificatie_job_seconds NUMBER(5);
ALTER TABLE fac_notificatie_job ADD CONSTRAINT fac_c_notificatie_job1 CHECK((fac_notificatie_job_interval IS NOT NULL AND fac_notificatie_job_seconds IS NULL) OR (fac_notificatie_job_interval IS NULL AND fac_notificatie_job_seconds IS NOT NULL));
ALTER TABLE fac_notificatie_job ADD fac_notificatie_job_queue VARCHAR2(20) DEFAULT 'DEFAULT' NOT NULL;
@@ -366,6 +366,40 @@ ALTER TABLE bes_bestelling_item MODIFY bes_bestelling_item_aantalontv NUMBER (15
/////////////////////////////////////////////////////////////////////////////////////////// MNNL#65934
ALTER TABLE mld_melding ADD mld_melding_actiedatum DATE;
/////////////////////////////////////////////////////////////////////////////////////////// AAXX#65358
DECLARE
-- Bij afgemelden(5) of voltooien(6) van periodieke inspecties (NIET MJOB) wordt het veld ins_deelsrtcontrole_freezecost pas gevuld.
-- Het veld ins_deelsrtcontrole_freezedate veld wordt daarbij nooit gevuld. Dat gebeurd alleen bij MJOB taken.
-- Alle afgemelde of voltooide periodieke inspecties (NIET MJOB) ophalen waarvoor geldt:
-- 1) de freezecost zijn groter dan 0 en
-- 2) het aantal van het bijbehorende object is groter dan 1.
CURSOR c_freezecost IS
SELECT idsc.ins_deelsrtcontrole_key,
id.ins_deel_aantal
FROM ins_deelsrtcontrole idsc,
ins_deel id,
ins_srtcontrole isc,
ctr_disc_params cdp
WHERE idsc.ins_deel_key = id.ins_deel_key
AND idsc.ins_srtcontrole_key = isc.ins_srtcontrole_key
AND isc.ctr_discipline_key = cdp.ctr_ins_discipline_key
AND idsc.ins_deelsrtcontrole_status IN (5, 6)
AND idsc.ins_deelsrtcontrole_freezedate IS NULL
AND id.ins_deel_aantal > 1
AND idsc.ins_deelsrtcontrole_freezecost > 0
AND cdp.ctr_disc_params_ismjob = 0;
BEGIN
FOR f_freezecost IN c_freezecost
LOOP
-- Vermenigvuldig het totaalbedrag (freezecost) met het aantal opbjecten.
UPDATE ins_deelsrtcontrole
SET ins_deelsrtcontrole_freezecost = (f_freezecost.ins_deel_aantal * ins_deelsrtcontrole_freezecost)
WHERE ins_deelsrtcontrole_key = f_freezecost.ins_deelsrtcontrole_key;
END LOOP;
END;
/
/////////////////////////////////////////////////////////////////////////////////////////// FCLT#*****
///////////////////////////////////////////////////////////////////////////////////////////