WZUV#64637: Notificatiejob en prioritering bestelling
svn path=/Customer/trunk/; revision=49622
This commit is contained in:
@@ -2373,6 +2373,74 @@ SELECT i.ins_deel_omschrijving hide_f_sort,
|
||||
AND g.ins_srtgroep_key = s.ins_srtgroep_key
|
||||
AND d.ins_discipline_key = g.ins_discipline_key;
|
||||
|
||||
CREATE OR REPLACE VIEW WZUV_V_NOTI_BESGOE
|
||||
(
|
||||
SENDER,
|
||||
RECEIVER,
|
||||
TEXT,
|
||||
CODE,
|
||||
FAC_SRTNOTIFICATIE_KEY,
|
||||
KEY,
|
||||
XKEY,
|
||||
XEMAIL,
|
||||
XMOBILE
|
||||
)
|
||||
AS
|
||||
SELECT DISTINCT
|
||||
NULL
|
||||
sender,
|
||||
NULL
|
||||
receiver,
|
||||
'Bestelaanvraag '
|
||||
|| b.bes_bestelling_key
|
||||
|| ' moet goedgekeurd worden',
|
||||
n.fac_srtnotificatie_code,
|
||||
n.fac_srtnotificatie_key,
|
||||
b.bes_bestelling_key,
|
||||
NULL
|
||||
xkey,
|
||||
'kwaliteitenveiligheid@wzuveluwe.nl'
|
||||
xemail,
|
||||
NULL
|
||||
xmobile
|
||||
FROM bes_bestelling b,
|
||||
bes_srtgroep sg,
|
||||
ins_tab_discipline d,
|
||||
bes_disc_params dp,
|
||||
fac_tracking f,
|
||||
fac_srtnotificatie n,
|
||||
( SELECT bi.bes_bestelling_key,
|
||||
sd.bes_srtgroep_key,
|
||||
SUM (
|
||||
bi.bes_bestelling_item_aantal
|
||||
* bi.bes_bestelling_item_prijs) AS totaal
|
||||
FROM bes_bestelling_item bi, bes_srtdeel sd
|
||||
WHERE bi.bes_srtdeel_key = sd.bes_srtdeel_key
|
||||
GROUP BY bi.bes_bestelling_key, sd.bes_srtgroep_key) bedrag
|
||||
WHERE b.bes_bestelling_key = bedrag.bes_bestelling_key
|
||||
AND bedrag.bes_srtgroep_key = sg.bes_srtgroep_key
|
||||
AND sg.ins_discipline_key = d.ins_discipline_key
|
||||
AND dp.bes_ins_discipline_key = d.ins_discipline_key
|
||||
AND bedrag.totaal > dp.bes_disc_params_bestellimiet --- alleen goedkeuring nodig als order bedrag boven bestellimiet
|
||||
AND n.fac_srtnotificatie_key = f.fac_srtnotificatie_key
|
||||
AND b.bes_bestelling_key = f.fac_tracking_refkey
|
||||
AND b.bes_bestelling_status NOT IN (1, 5, 8)
|
||||
AND n.fac_srtnotificatie_xmlnode = 'bestelling'
|
||||
AND dp.bes_ins_discipline_key_inkoop is not null
|
||||
AND ( ( dp.bes_disc_params_fiatflow = 1
|
||||
AND n.fac_srtnotificatie_key = 7)
|
||||
OR ( dp.bes_disc_params_fiatflow = 0
|
||||
AND n.fac_srtnotificatie_key = 5))
|
||||
AND f.fac_tracking_datum >
|
||||
(SELECT fac_notificatie_job_nextrun
|
||||
- fac_notificatie_job_interval / 24
|
||||
FROM fac_notificatie_job
|
||||
WHERE UPPER (fac_notificatie_job_view) = 'WZUV_V_NOTI_BESGOE')
|
||||
AND f.fac_tracking_datum <
|
||||
(SELECT fac_notificatie_job_nextrun
|
||||
FROM fac_notificatie_job
|
||||
WHERE UPPER (fac_notificatie_job_view) = 'WZUV_V_NOTI_BESGOE');
|
||||
|
||||
BEGIN
|
||||
DBMS_UTILITY.COMPILE_SCHEMA (USER, FALSE);
|
||||
END;
|
||||
|
||||
Reference in New Issue
Block a user