CONN#18498

svn path=/Customer/trunk/; revision=14323
This commit is contained in:
Ruud Lipper
2010-08-31 07:42:42 +00:00
parent a1b2acfdd4
commit e62e1510d1
2 changed files with 73 additions and 2 deletions

32
CONN/Once/CONN#18498.sql Normal file
View File

@@ -0,0 +1,32 @@
-- Customer specific once-script CONN#18498.
--
-- (c) 2010 SG|facilitor bv
-- $Revision: 1 $
-- $Modtime: 31-08-10 9:40 $
--
-- Support: +31 53 4800700
SET ECHO ON;
SPOOL xuwva#18498.lst;
SET DEFINE OFF;
INSERT INTO FAC_USRRAP
(fac_usrrap_omschrijving,
fac_usrrap_view_name, fac_usrrap_in_huidige_locatie,
fac_usrrap_template, fac_usrrap_macro,
fac_usrrap_vraagbegindatum, fac_usrrap_vraageinddatum,
fac_usrrap_functie, fac_usrrap_info,
fac_functie_key, fac_usrrap_autorefresh
)
VALUES ('BES: Bestel Totaalbedragen',
'conn_rap.conn_p_bes_div_cat', NULL,
NULL, NULL,
1, 1,
2, 'Bestelbedragen per Divisie/Catalogus (datumformaat: dd-mm-jjjj)',
to_number(null), 0
);
-
COMMIT;
SPOOL OFF;

View File

@@ -1,7 +1,7 @@
-- Script containing customer specific configuration sql statements for CONN: Connexxion
-- (c) 2005-2010 SG|facilitor bv
-- $Revision: 153 $
-- $Modtime: 11-06-10 17:51 $
-- $Revision: 154 $
-- $Modtime: 31-08-10 8:56 $
--
-- Support: +31 53 4800710
@@ -614,6 +614,7 @@ CREATE OR REPLACE PACKAGE CONN_RAP AS
FUNCTION FindNearestSampleValue(p_ins_deel_key IN NUMBER,p_ins_kenmerk_key IN NUMBER ,p_sample_date IN DATE) RETURN NUMBER;
FUNCTION FindNearestSampleDate(p_ins_deel_key IN NUMBER,p_ins_kenmerk_key IN NUMBER ,p_sample_date IN DATE) RETURN DATE;
PROCEDURE conn_p_verbruik (user_key IN NUMBER, p_datum_van IN VARCHAR2, p_datum_tot IN VARCHAR2, p_cursor OUT t_cursor);
PROCEDURE conn_p_bes_div_cat (user_key IN NUMBER, p_datum_van IN VARCHAR2, p_datum_tot IN VARCHAR2, p_cursor OUT t_cursor);
END;
/
@@ -757,6 +758,44 @@ CREATE OR REPLACE PACKAGE BODY CONN_RAP AS
END IF;
END;
--
PROCEDURE conn_p_bes_div_cat ( user_key IN NUMBER,
p_datum_van IN VARCHAR2, -- Let wel: formaat '01-01-2015'
p_datum_tot IN VARCHAR2,
p_cursor OUT t_cursor) AS
BEGIN
OPEN p_cursor FOR
SELECT a.prs_afdeling_parent_oms divisie,
dis.ins_discipline_omschrijving catalogus,
COUNT (b.bes_bestelling_key) aantal_aanvragen,
SUM (COALESCE (boi.bes_bestelopdr_item_prijs, 0) * bi.bes_bestelling_item_aantal
) totaalbedrag
FROM BES_BESTELLING b,
BES_BESTELLING_ITEM bi,
INS_SRTDEEL sd,
INS_SRTGROEP sg,
INS_TAB_DISCIPLINE dis,
bes_bestelopdr_item boi,
(SELECT p.prs_perslid_key,
a.prs_afdeling_omschrijving prs_afdeling_parent_oms
FROM prs_v_afdeling_boom ab, PRS_AFDELING a, PRS_PERSLID p
WHERE ab.prs_afdeling_key1 = a.prs_afdeling_key
AND p.prs_afdeling_key = ab.prs_afdeling_key) a
WHERE bi.bes_bestelopdr_item_key = boi.bes_bestelopdr_item_key
AND b.bes_bestelling_datum >= Fac.safe_to_date(p_datum_van, 'dd-mm-yyyy')
AND b.bes_bestelling_datum < Fac.safe_to_date(p_datum_tot, 'dd-mm-yyyy')
AND bi.ins_srtdeel_key = sd.ins_srtdeel_key
AND sd.ins_srtgroep_key = sg.ins_srtgroep_key
AND sg.ins_discipline_key = dis.ins_discipline_key
AND b.bes_bestelling_status <> 1
AND bi.bes_bestelling_key = b.bes_bestelling_key
AND b.bes_bestelling_module = 'BES'
AND a.prs_perslid_key = b.prs_perslid_key
GROUP BY a.prs_afdeling_parent_oms, dis.ins_discipline_omschrijving
ORDER BY 1,2;
END;
--
END;
/