Modify additional item cost routines in mip_bulk_load.pck and mip_quotation.pck to make use of enquiry type as a cost parameter. Matching changes to the BULK_LOAD.xls spreadsheet.

Change get_quote_items.fnc to return the descriptions of additional items instead of the 'code'.

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@12542 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
andrew.hardy
2009-09-08 10:58:39 +00:00
parent 561266e548
commit a645a35335
5 changed files with 235 additions and 213 deletions

View File

@@ -1,26 +1,32 @@
create or replace function get_quote_items(p_quote_id in number) return varchar2 is
ret_items varchar2(250);
CREATE OR REPLACE FUNCTION get_quote_items(p_quote_id IN NUMBER)
RETURN VARCHAR2 IS
ret_items VARCHAR2(250);
first_item BOOLEAN := TRUE;
BEGIN
--blank string
ret_items := '';
FOR cur_item IN (SELECT * FROM quote_items quit
WHERE quit.qute_id = p_quote_id
AND quit.adit_code IS NOT NULL) LOOP
FOR cur_item IN (SELECT adit.description
FROM quote_items quit
JOIN additional_items adit ON (adit.code =
quit.adit_code)
WHERE quit.qute_id = p_quote_id
AND quit.adit_code IS NOT NULL
ORDER BY description) LOOP
IF first_item THEN
ret_items := cur_item.adit_code;
ret_items := cur_item.description;
first_item := FALSE;
ELSE --add a seperator
ret_items := ret_items ||', '|| cur_item.adit_code;
ELSE
--add a seperator
ret_items := ret_items || ', ' || cur_item.description;
END IF;
END LOOP;
return(ret_items);
RETURN(ret_items);
EXCEPTION
WHEN OTHERS THEN
--return an empty string just in case
RETURN(NULL);
end get_quote_items;
END get_quote_items;
/

View File

@@ -1212,9 +1212,10 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
END AS valid_to
,UPPER(trim(mety_code)) AS mety_code
,UPPER(trim(mesc_code)) AS mesc_code
,UPPER(trim(enty_code)) AS enty_code
FROM ext_material_costs
WHERE upper(TRIM(cost_type)) = 'AICO') e
ON (e.adit_code = cos.adit_code AND e.valid_from = cos.valid_from AND cos.cost_type = 'AICO' AND ((e. mesc_code IS NULL AND cos.mesc_code IS NULL) OR (e.mesc_code = cos.mesc_code)) AND ((e.mety_code IS NULL AND cos.mety_code IS NULL) OR (e.mety_code = cos.mety_code)))
ON (e.adit_code = cos.adit_code AND e.valid_from = cos.valid_from AND cos.cost_type = 'AICO' AND ((e. mesc_code IS NULL AND cos.mesc_code IS NULL) OR (e.mesc_code = cos.mesc_code)) AND ((e.mety_code IS NULL AND cos.mety_code IS NULL) OR (e.mety_code = cos.mety_code))AND ((e.enty_code IS NULL AND cos.enty_code IS NULL) OR (e.enty_code = cos.enty_code)))
WHEN MATCHED THEN
UPDATE
SET selling_price = e.selling_price
@@ -1232,7 +1233,8 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
,cost_type
,adit_code
,mety_code
,mesc_code)
,mesc_code
,enty_code)
VALUES
(cost_seq.NEXTVAL
,e.selling_price
@@ -1243,7 +1245,8 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
,'AICO'
,e.adit_code
,e.mety_code
,e.mesc_code) log errors reject LIMIT unlimited;
,e.mesc_code
,e.enty_code) log errors reject LIMIT unlimited;
pl(TO_CHAR(SQL%ROWCOUNT
,'FM099G999') || ': additional_items');

View File

@@ -2056,6 +2056,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
BEGIN
pl('get_aico:' || p_adit_code || ':' || p_regi_code
,$$PLSQL_LINE);
SELECT lead_time
,selling_price
,cost_price
@@ -2072,6 +2073,11 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,delivery_cost
,adit_code
FROM (SELECT CASE
WHEN cost.enty_code IS NULL THEN
0
ELSE
1000
END + CASE
WHEN cost.regi_code IS NULL THEN
0
ELSE
@@ -2882,7 +2888,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,'AQI');
END IF;
IF p_enqu.purging_required IN ('TM', 'FC') THEN
IF p_enqu.purging_required IN ('TM', 'FC')
OR p_enqu.enty_code = 'ADVERSARIAL' THEN
INSERT INTO quote_items
(id
,qute_id
@@ -3149,7 +3156,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
--
-- Purging required on Time and Materials basis
--
IF p_enqu.purging_required = 'TM' THEN
IF p_enqu.purging_required = 'TM'
OR p_enqu.enty_code = 'ADVERSARIAL' THEN
l_purging_costs.selling_price := NULL;
l_purging_costs.cost_price := NULL;
l_purging_costs.delivery_cost := NULL;
@@ -3469,7 +3477,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
--
-- Purging required on Time and Materials basis
--
IF p_enqu.purging_required = 'TM' THEN
IF p_enqu.purging_required = 'TM'
OR p_enqu.enty_code = 'ADVERSARIAL' THEN
l_purging_costs.selling_price := NULL;
l_purging_costs.cost_price := NULL;
l_purging_costs.delivery_cost := NULL;
@@ -3584,7 +3593,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,'AQI');
END IF;
IF p_enqu.purging_required IN ('TM', 'FC') THEN
IF p_enqu.purging_required IN ('TM', 'FC')
OR p_enqu.enty_code = 'ADVERSARIAL' THEN
INSERT INTO quote_items
(id
,qute_id