Updated mip_regions.pck to include a reference to the source information.
mip_quotation.pck now able to produce 'module' part of install quotes - missing labour costs. gen_mandatory.prc modified to pass more of the 'condition' information into the application. git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3060 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -55,14 +55,9 @@ BEGIN
|
|||||||
add_sql(l_sql
|
add_sql(l_sql
|
||||||
,' ,table_name');
|
,' ,table_name');
|
||||||
add_sql(l_sql
|
add_sql(l_sql
|
||||||
,' ,substr(diri.' ||
|
,' ,diri.' || REPLACE(l_enty.code
|
||||||
REPLACE(l_enty.code
|
|
||||||
,' '
|
,' '
|
||||||
,'_'));
|
,'_'));
|
||||||
add_sql(l_sql
|
|
||||||
,' ,1');
|
|
||||||
add_sql(l_sql
|
|
||||||
,' ,1)');
|
|
||||||
add_sql(l_sql
|
add_sql(l_sql
|
||||||
,' ,diri.description');
|
,' ,diri.description');
|
||||||
add_sql(l_sql
|
add_sql(l_sql
|
||||||
|
|||||||
@@ -4,12 +4,29 @@ CREATE OR REPLACE PACKAGE mip_quotation IS
|
|||||||
-- Created : 15/11/2007 11:27:58
|
-- Created : 15/11/2007 11:27:58
|
||||||
-- Purpose : Handle life-cycle of quotations
|
-- Purpose : Handle life-cycle of quotations
|
||||||
|
|
||||||
|
/** Determines whether the given enquiry is ready to quote for
|
||||||
|
i.e. have all the mandatory fields been completed
|
||||||
|
|
||||||
|
%param p_id the id of the enquiry to be checked
|
||||||
|
%return TRUE if the enquiry can be quoted for
|
||||||
|
*/
|
||||||
FUNCTION ready_for_quote(p_id IN enquiries.id%TYPE) RETURN BOOLEAN;
|
FUNCTION ready_for_quote(p_id IN enquiries.id%TYPE) RETURN BOOLEAN;
|
||||||
|
|
||||||
|
/** Determines whether the given enquiry is ready to quote for
|
||||||
|
i.e. have all the mandatory fields been completed
|
||||||
|
|
||||||
|
%param p_id the id of the enquiry to be checked
|
||||||
|
%p_mandatory_checks contains reasons for the enquiry *not* being ready to quote for
|
||||||
|
%p_quote_is_ready TRUE if the enquiry can be quoted for
|
||||||
|
*/
|
||||||
PROCEDURE ready_for_quote(p_id IN enquiries.id%TYPE
|
PROCEDURE ready_for_quote(p_id IN enquiries.id%TYPE
|
||||||
,p_mandatory_checks OUT mip_mandatory.t_mandatory_checks
|
,p_mandatory_checks OUT mip_mandatory.t_mandatory_checks
|
||||||
,p_quote_is_ready OUT BOOLEAN);
|
,p_quote_is_ready OUT BOOLEAN);
|
||||||
|
|
||||||
|
/** Generate quotes in response to a 'request for quote' against an enquiry
|
||||||
|
|
||||||
|
%param p_id the id of the enquiry to be checked
|
||||||
|
*/
|
||||||
PROCEDURE produce_quotes(p_id IN enquiries.id%TYPE);
|
PROCEDURE produce_quotes(p_id IN enquiries.id%TYPE);
|
||||||
END mip_quotation;
|
END mip_quotation;
|
||||||
/
|
/
|
||||||
@@ -243,7 +260,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
OR regi_code IS NULL
|
OR regi_code IS NULL
|
||||||
ORDER BY 1) cost
|
ORDER BY 1) cost
|
||||||
,additional_items adit
|
,additional_items adit
|
||||||
WHERE adit.code = cost.adit_code
|
WHERE adit.code = cost.adit_code(+)
|
||||||
AND rownum < 2;
|
AND rownum < 2;
|
||||||
|
|
||||||
RETURN l_rec_costs;
|
RETURN l_rec_costs;
|
||||||
@@ -259,7 +276,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
l_this_is_automatic_quote BOOLEAN;
|
l_this_is_automatic_quote BOOLEAN;
|
||||||
l_regi_code regions.code%TYPE := mip_regions.get_region_for_postcode(p_enqu.install_postcode);
|
l_regi_code regions.code%TYPE := mip_regions.get_region_for_postcode(p_enqu.install_postcode);
|
||||||
l_qute_id quotes.id%TYPE;
|
l_qute_id quotes.id%TYPE;
|
||||||
l_item_sequence NUMBER;
|
|
||||||
l_aico_costs t_rec_additional_item_costs;
|
l_aico_costs t_rec_additional_item_costs;
|
||||||
BEGIN
|
BEGIN
|
||||||
cout_assert.istrue(p_enqu.enty_code IN ('INSTALL', 'STD INSTALL')
|
cout_assert.istrue(p_enqu.enty_code IN ('INSTALL', 'STD INSTALL')
|
||||||
@@ -325,107 +341,95 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
FROM (SELECT decode(regi_code
|
FROM (SELECT row_number() over(PARTITION BY modu_code ORDER BY(decode(regi_code, l_regi_code, 1, 999))) AS accuracy
|
||||||
,l_regi_code
|
|
||||||
,1
|
|
||||||
,999) AS accuracy
|
|
||||||
,modu_code
|
,modu_code
|
||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
|
,ROWID
|
||||||
FROM v_moco cost
|
FROM v_moco cost
|
||||||
WHERE SYSDATE BETWEEN
|
WHERE SYSDATE BETWEEN
|
||||||
cost.effective_from AND
|
cost.effective_from AND
|
||||||
cost.effective_to
|
cost.effective_to
|
||||||
AND regi_code =
|
AND regi_code =
|
||||||
l_regi_code
|
l_regi_code
|
||||||
OR regi_code IS NULL
|
OR regi_code IS NULL)
|
||||||
ORDER BY 1)
|
WHERE accuracy <= 1) cost
|
||||||
WHERE rownum < 2) cost
|
|
||||||
WHERE modu.code = cost.modu_code(+)) modu
|
WHERE modu.code = cost.modu_code(+)) modu
|
||||||
,(SELECT hou.code
|
,(SELECT code
|
||||||
,cost_price
|
|
||||||
,selling_price
|
,selling_price
|
||||||
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
FROM housings hou
|
FROM housings hou
|
||||||
,(SELECT hou_code
|
,(SELECT hou_code
|
||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
FROM (SELECT decode(regi_code
|
FROM (SELECT row_number() over(PARTITION BY hou_code ORDER BY(decode(regi_code, l_regi_code, 1, 999))) AS accuracy
|
||||||
,l_regi_code
|
|
||||||
,1
|
|
||||||
,999) AS accuracy
|
|
||||||
,hou_code
|
,hou_code
|
||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
|
,ROWID
|
||||||
FROM v_hoco cost
|
FROM v_hoco cost
|
||||||
WHERE SYSDATE BETWEEN
|
WHERE SYSDATE BETWEEN
|
||||||
cost.effective_from AND
|
cost.effective_from AND
|
||||||
cost.effective_to
|
cost.effective_to
|
||||||
AND regi_code =
|
AND regi_code =
|
||||||
l_regi_code
|
l_regi_code
|
||||||
OR regi_code IS NULL
|
OR regi_code IS NULL)
|
||||||
ORDER BY 1)
|
WHERE accuracy <= 1) cost
|
||||||
WHERE rownum < 2) cost
|
|
||||||
WHERE hou.code = cost.hou_code(+)) hou
|
WHERE hou.code = cost.hou_code(+)) hou
|
||||||
,(SELECT bas.code
|
,(SELECT code
|
||||||
,cost_price
|
|
||||||
,selling_price
|
,selling_price
|
||||||
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
FROM bases bas
|
FROM bases bas
|
||||||
,(SELECT bas_code
|
,(SELECT bas_code
|
||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
FROM (SELECT decode(regi_code
|
FROM (SELECT row_number() over(PARTITION BY bas_code ORDER BY(decode(regi_code, l_regi_code, 1, 999))) AS accuracy
|
||||||
,l_regi_code
|
|
||||||
,1
|
|
||||||
,999) AS accuracy
|
|
||||||
,bas_code
|
,bas_code
|
||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
|
,ROWID
|
||||||
FROM v_baco cost
|
FROM v_baco cost
|
||||||
WHERE SYSDATE BETWEEN
|
WHERE SYSDATE BETWEEN
|
||||||
cost.effective_from AND
|
cost.effective_from AND
|
||||||
cost.effective_to
|
cost.effective_to
|
||||||
AND regi_code =
|
AND regi_code =
|
||||||
l_regi_code
|
l_regi_code
|
||||||
OR regi_code IS NULL
|
OR regi_code IS NULL)
|
||||||
ORDER BY 1)
|
WHERE accuracy <= 1) cost
|
||||||
WHERE rownum < 2) cost
|
WHERE bas.code = cost.bas_code(+)) bas
|
||||||
WHERE bas.code = cost.bas_code) bas
|
|
||||||
,(SELECT metr.code
|
,(SELECT metr.code
|
||||||
,metr.qmax
|
,metr.qmax
|
||||||
,metr.qmin
|
,metr.qmin
|
||||||
,metr.qnom
|
,metr.qnom
|
||||||
,cost_price
|
|
||||||
,selling_price
|
,selling_price
|
||||||
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
FROM meters metr
|
FROM meters metr
|
||||||
,(SELECT metr_code
|
,(SELECT metr_code
|
||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
FROM (SELECT decode(regi_code
|
FROM (SELECT row_number() over(PARTITION BY metr_code ORDER BY(decode(regi_code, l_regi_code, 1, 999))) AS accuracy
|
||||||
,l_regi_code
|
|
||||||
,1
|
|
||||||
,999) AS accuracy
|
|
||||||
,metr_code
|
,metr_code
|
||||||
,selling_price
|
,selling_price
|
||||||
,cost_price
|
,cost_price
|
||||||
,delivery_cost
|
,delivery_cost
|
||||||
|
,ROWID
|
||||||
FROM v_meco cost
|
FROM v_meco cost
|
||||||
WHERE SYSDATE BETWEEN
|
WHERE SYSDATE BETWEEN
|
||||||
cost.effective_from AND
|
cost.effective_from AND
|
||||||
cost.effective_to
|
cost.effective_to
|
||||||
AND regi_code =
|
AND regi_code =
|
||||||
l_regi_code
|
l_regi_code
|
||||||
OR regi_code IS NULL
|
OR regi_code IS NULL)
|
||||||
ORDER BY 1)
|
WHERE accuracy <= 1) cost
|
||||||
WHERE rownum < 2) cost
|
|
||||||
WHERE metr.code = cost.metr_code(+)) metr
|
WHERE metr.code = cost.metr_code(+)) metr
|
||||||
WHERE modu.svcp_code = p_enqu.required_svcp_code
|
WHERE modu.svcp_code = p_enqu.required_svcp_code
|
||||||
AND modu.outlet_pressure =
|
AND modu.outlet_pressure =
|
||||||
@@ -446,7 +450,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Considering module : ' ||
|
,p_reason => 'Considering module : ' ||
|
||||||
l_rec_module.modu_code
|
l_rec_module.modu_code
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
--
|
--
|
||||||
-- check whether we have the required prices
|
-- check whether we have the required prices
|
||||||
-- if we do not, then we may need to produce a manual quote
|
-- if we do not, then we may need to produce a manual quote
|
||||||
@@ -455,30 +459,32 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for module ' ||
|
,p_reason => 'Unable to find selling price for module ' ||
|
||||||
l_rec_module.modu_code || '.'
|
l_rec_module.modu_code || CASE
|
||||||
,p_internal_or_external => g_external_reason);
|
l_regi_code WHEN NULL THEN '' ELSE ' for region code ' || l_regi_code END || '.'
|
||||||
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
IF l_rec_module.modu_lead_time IS NULL THEN
|
IF l_rec_module.modu_lead_time IS NULL THEN
|
||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find lead time for module ' ||
|
,p_reason => 'Unable to find lead time for module ' ||
|
||||||
l_rec_module.modu_code || '.'
|
l_rec_module.modu_code || '.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
|
/* Meters do not have a price, they are rented
|
||||||
IF l_rec_module.metr_selling_price IS NULL THEN
|
IF l_rec_module.metr_selling_price IS NULL THEN
|
||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for meter ' ||
|
,p_reason => 'Unable to find selling price for meter ' ||
|
||||||
l_rec_module.metr_code || '.'
|
l_rec_module.metr_code || '.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;*/
|
||||||
IF p_enqu.base_required = 'YES'
|
IF p_enqu.base_required = 'YES'
|
||||||
AND l_rec_module.bas_selling_price IS NULL THEN
|
AND l_rec_module.bas_selling_price IS NULL THEN
|
||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for base ' ||
|
,p_reason => 'Unable to find selling price for base ' ||
|
||||||
l_rec_module.bas_code || '.'
|
l_rec_module.bas_code || '.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
IF p_enqu.housing_required = 'YES'
|
IF p_enqu.housing_required = 'YES'
|
||||||
AND l_rec_module.hou_selling_price IS NULL THEN
|
AND l_rec_module.hou_selling_price IS NULL THEN
|
||||||
@@ -486,7 +492,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for housing ' ||
|
,p_reason => 'Unable to find selling price for housing ' ||
|
||||||
l_rec_module.hou_code || '.'
|
l_rec_module.hou_code || '.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
IF p_enqu.amr_required = 'YES' THEN
|
IF p_enqu.amr_required = 'YES' THEN
|
||||||
l_aico_costs := get_aico(p_adit_code => 'AMR'
|
l_aico_costs := get_aico(p_adit_code => 'AMR'
|
||||||
@@ -499,13 +505,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for AMR.'
|
,p_reason => 'Unable to find selling price for AMR.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
IF l_rec_module.amr_lead_time IS NULL THEN
|
IF l_rec_module.amr_lead_time IS NULL THEN
|
||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find lead time for AMR.'
|
,p_reason => 'Unable to find lead time for AMR.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
IF p_enqu.ems_required = 'YES' THEN
|
IF p_enqu.ems_required = 'YES' THEN
|
||||||
@@ -519,13 +525,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for EMS.'
|
,p_reason => 'Unable to find selling price for EMS.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
IF l_rec_module.amr_lead_time IS NULL THEN
|
IF l_rec_module.amr_lead_time IS NULL THEN
|
||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find lead time for AMR.'
|
,p_reason => 'Unable to find lead time for AMR.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
IF p_enqu.bypass_required = 'YES' THEN
|
IF p_enqu.bypass_required = 'YES' THEN
|
||||||
@@ -539,13 +545,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for BYPASS.'
|
,p_reason => 'Unable to find selling price for BYPASS.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
IF l_rec_module.bypass_lead_time IS NULL THEN
|
IF l_rec_module.bypass_lead_time IS NULL THEN
|
||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find lead time for BYPASS.'
|
,p_reason => 'Unable to find lead time for BYPASS.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
@@ -559,13 +565,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find selling price for LOGGER.'
|
,p_reason => 'Unable to find selling price for LOGGER.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
IF l_rec_module.logger_lead_time IS NULL THEN
|
IF l_rec_module.logger_lead_time IS NULL THEN
|
||||||
l_this_is_automatic_quote := FALSE;
|
l_this_is_automatic_quote := FALSE;
|
||||||
add_quote_reason(p_enqu.id
|
add_quote_reason(p_enqu.id
|
||||||
,p_reason => 'Unable to find lead time for LOGGER.'
|
,p_reason => 'Unable to find lead time for LOGGER.'
|
||||||
,p_internal_or_external => g_external_reason);
|
,p_internal_or_external => g_internal_reason);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
@@ -578,13 +584,17 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
,qute_type
|
,qute_type
|
||||||
,enqu_id
|
,enqu_id
|
||||||
,valid_from
|
,valid_from
|
||||||
,valid_until)
|
,valid_until
|
||||||
|
,created_on
|
||||||
|
,created_by)
|
||||||
VALUES
|
VALUES
|
||||||
(qute_seq.NEXTVAL
|
(qute_seq.NEXTVAL
|
||||||
,'AQ' -- automatic quote
|
,'AQ' -- automatic quote
|
||||||
,p_enqu.id
|
,p_enqu.id
|
||||||
,trunc(SYSDATE)
|
,trunc(SYSDATE)
|
||||||
,trunc(SYSDATE + 90))
|
,trunc(SYSDATE + 90)
|
||||||
|
,SYSDATE
|
||||||
|
,USER)
|
||||||
RETURNING id INTO l_qute_id;
|
RETURNING id INTO l_qute_id;
|
||||||
|
|
||||||
INSERT INTO quote_events
|
INSERT INTO quote_events
|
||||||
@@ -596,136 +606,143 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
|||||||
,'INP' -- In Progress
|
,'INP' -- In Progress
|
||||||
,l_qute_id);
|
,l_qute_id);
|
||||||
|
|
||||||
l_item_sequence := 1;
|
|
||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(item_sequence
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,modu_code
|
,modu_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price)
|
,delivery_price
|
||||||
|
,quit_type)
|
||||||
VALUES
|
VALUES
|
||||||
(l_item_sequence
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
,l_rec_module.modu_code
|
,l_rec_module.modu_code
|
||||||
,l_rec_module.modu_cost_price
|
,l_rec_module.modu_cost_price
|
||||||
,l_rec_module.modu_selling_price
|
,l_rec_module.modu_selling_price
|
||||||
,l_rec_module.modu_delivery_cost);
|
,l_rec_module.modu_delivery_cost
|
||||||
|
,'MQI');
|
||||||
|
|
||||||
IF l_rec_module.hou_code IS NOT NULL THEN
|
IF l_rec_module.hou_code IS NOT NULL THEN
|
||||||
l_item_sequence := l_item_sequence + 1;
|
|
||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(item_sequence
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,hou_code
|
,hou_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price)
|
,delivery_price
|
||||||
|
,quit_type)
|
||||||
VALUES
|
VALUES
|
||||||
(l_item_sequence
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
,l_rec_module.hou_code
|
,l_rec_module.hou_code
|
||||||
,l_rec_module.hou_cost_price
|
,l_rec_module.hou_cost_price
|
||||||
,l_rec_module.hou_selling_price
|
,l_rec_module.hou_selling_price
|
||||||
,l_rec_module.hou_delivery_cost);
|
,l_rec_module.hou_delivery_cost
|
||||||
|
,'HQI');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF l_rec_module.bas_code IS NOT NULL THEN
|
IF l_rec_module.bas_code IS NOT NULL THEN
|
||||||
l_item_sequence := l_item_sequence + 1;
|
|
||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(item_sequence
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,bas_code
|
,bas_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price)
|
,delivery_price
|
||||||
|
,quit_type)
|
||||||
VALUES
|
VALUES
|
||||||
(l_item_sequence
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
,l_rec_module.bas_code
|
,l_rec_module.bas_code
|
||||||
,l_rec_module.bas_cost_price
|
,l_rec_module.bas_cost_price
|
||||||
,l_rec_module.bas_selling_price
|
,l_rec_module.bas_selling_price
|
||||||
,l_rec_module.bas_delivery_cost);
|
,l_rec_module.bas_delivery_cost
|
||||||
|
,'BQI');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF p_enqu.amr_required = 'YES' THEN
|
IF p_enqu.amr_required = 'YES' THEN
|
||||||
l_item_sequence := l_item_sequence + 1;
|
|
||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(item_sequence
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,adit_code
|
,adit_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price
|
,delivery_price
|
||||||
,lead_time)
|
,lead_time
|
||||||
|
,quit_type)
|
||||||
VALUES
|
VALUES
|
||||||
(l_item_sequence
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
,'AMR'
|
,'AMR'
|
||||||
,l_rec_module.amr_cost_price
|
,l_rec_module.amr_cost_price
|
||||||
,l_rec_module.amr_selling_price
|
,l_rec_module.amr_selling_price
|
||||||
,l_rec_module.amr_delivery_cost
|
,l_rec_module.amr_delivery_cost
|
||||||
,l_rec_module.amr_lead_time);
|
,l_rec_module.amr_lead_time
|
||||||
|
,'AQI');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF p_enqu.ems_required = 'YES' THEN
|
IF p_enqu.ems_required = 'YES' THEN
|
||||||
l_item_sequence := l_item_sequence + 1;
|
|
||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(item_sequence
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,adit_code
|
,adit_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price
|
,delivery_price
|
||||||
,lead_time)
|
,lead_time
|
||||||
|
,quit_type)
|
||||||
VALUES
|
VALUES
|
||||||
(l_item_sequence
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
,'EMS'
|
,'EMS'
|
||||||
,l_rec_module.ems_cost_price
|
,l_rec_module.ems_cost_price
|
||||||
,l_rec_module.ems_selling_price
|
,l_rec_module.ems_selling_price
|
||||||
,l_rec_module.ems_delivery_cost
|
,l_rec_module.ems_delivery_cost
|
||||||
,l_rec_module.ems_lead_time);
|
,l_rec_module.ems_lead_time
|
||||||
|
,'AQI');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF p_enqu.bypass_required = 'YES' THEN
|
IF p_enqu.bypass_required = 'YES' THEN
|
||||||
l_item_sequence := l_item_sequence + 1;
|
|
||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(item_sequence
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,adit_code
|
,adit_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price
|
,delivery_price
|
||||||
,lead_time)
|
,lead_time
|
||||||
|
,quit_type)
|
||||||
VALUES
|
VALUES
|
||||||
(l_item_sequence
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
,'BYPASS'
|
,'BYPASS'
|
||||||
,l_rec_module.bypass_cost_price
|
,l_rec_module.bypass_cost_price
|
||||||
,l_rec_module.bypass_selling_price
|
,l_rec_module.bypass_selling_price
|
||||||
,l_rec_module.bypass_delivery_cost
|
,l_rec_module.bypass_delivery_cost
|
||||||
,l_rec_module.bypass_lead_time);
|
,l_rec_module.bypass_lead_time
|
||||||
|
,'AQI');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF p_enqu.logger_required = 'YES' THEN
|
IF p_enqu.logger_required = 'YES' THEN
|
||||||
l_item_sequence := l_item_sequence + 1;
|
|
||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(item_sequence
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,adit_code
|
,adit_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price
|
,delivery_price
|
||||||
,lead_time)
|
,lead_time
|
||||||
|
,quit_type)
|
||||||
VALUES
|
VALUES
|
||||||
(l_item_sequence
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
,'LOGGER'
|
,'LOGGER'
|
||||||
,l_rec_module.logger_cost_price
|
,l_rec_module.logger_cost_price
|
||||||
,l_rec_module.logger_selling_price
|
,l_rec_module.logger_selling_price
|
||||||
,l_rec_module.logger_delivery_cost
|
,l_rec_module.logger_delivery_cost
|
||||||
,l_rec_module.logger_lead_time);
|
,l_rec_module.logger_lead_time
|
||||||
|
,'AQI');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END IF; -- automatic quote
|
END IF; -- automatic quote
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ END mip_regions;
|
|||||||
/
|
/
|
||||||
CREATE OR REPLACE PACKAGE BODY mip_regions IS
|
CREATE OR REPLACE PACKAGE BODY mip_regions IS
|
||||||
|
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
* Postcode format based on the UK Government Data Standards Catalogue
|
||||||
|
* http://www.govtalk.gov.uk/gdsc/html/frames/Postcode.htm
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
/** Attempts to determine whether general the format the given string to match a standard postcode format
|
/** Attempts to determine whether general the format the given string to match a standard postcode format
|
||||||
|
|
||||||
%param p_string the string whose format is to be checked
|
%param p_string the string whose format is to be checked
|
||||||
|
|||||||
Reference in New Issue
Block a user