VGLD#55670 extra rapport met bestelstatusen

svn path=/Customer/trunk/; revision=42700
This commit is contained in:
Ruud Lipper
2019-05-24 08:11:13 +00:00
parent e7c321b353
commit 62555df85f

View File

@@ -2351,6 +2351,55 @@ BEGIN
END;
/
CREATE OR REPLACE VIEW vgld_v_rap_besstatuslist
AS
SELECT bes_bestelling_key,
TO_CHAR (bes_bestelling_key) bestelling,
bes_bestellingstatuses_omschr status,
DECODE (bes_bestelling_status,
2, 'Actief',
3, 'Actief',
4, 'Actief',
5, 'Actief',
'Gesloten')
actief,
b.prs_perslid_key,
b.prs_perslid_key_voor,
pf1.prs_perslid_naam_full besteller,
pf2.prs_perslid_naam_full besteld_voor,
bes_bestelling_datum aanvraagdatum,
(SELECT MAX (fac_tracking_datum)
FROM fac_tracking ft, fac_srtnotificatie sn
WHERE fac_tracking_refkey = b.bes_bestelling_key
AND sn.fac_srtnotificatie_key = ft.fac_srtnotificatie_key
AND fac_srtnotificatie_xmlnode = 'bestelling'
AND fac_srtnotificatie_code = 'BESACP')
facilitair_bedrijfsbureau,
(SELECT MAX (fac_tracking_datum)
FROM fac_tracking ft, fac_srtnotificatie sn
WHERE fac_tracking_refkey = b.bes_bestelling_key
AND sn.fac_srtnotificatie_key = ft.fac_srtnotificatie_key
AND fac_srtnotificatie_xmlnode = 'bestelling'
AND fac_srtnotificatie_code = 'BESFIT')
fiat_manager,
(SELECT MAX (fac_tracking_datum)
FROM fac_tracking ft, fac_srtnotificatie sn
WHERE fac_tracking_refkey = b.bes_bestelling_key
AND sn.fac_srtnotificatie_key = ft.fac_srtnotificatie_key
AND fac_srtnotificatie_xmlnode = 'bestelling'
AND fac_srtnotificatie_code = 'BESBES')
besteld,
bes_bestelling_leverdatum afgeleverd,
bes_bestelling_opmerking opmerking
FROM bes_bestelling b,
bes_bestellingstatuses bs,
prs_v_perslid_fullnames_all pf1,
prs_v_perslid_fullnames_all pf2
WHERE b.bes_bestelling_status = bs.bes_bestellingstatuses_key
AND b.prs_perslid_key = pf1.prs_perslid_key
AND b.prs_perslid_key_voor = pf2.prs_perslid_key
AND fac_activiteit_key IS NULL;
------ payload end ------
SET DEFINE OFF