Merged in changes from RB-1.0 related to #524 (Add-Ons not being quoted for).
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@5624 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -2151,6 +2151,30 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
RETURN l_rec_costs;
|
RETURN l_rec_costs;
|
||||||
END get_laco;
|
END get_laco;
|
||||||
|
|
||||||
|
FUNCTION get_svcpt_for_svcp(p_svcp_code IN service_pressures.code%TYPE)
|
||||||
|
RETURN service_pressure_types.code%TYPE IS
|
||||||
|
l_svcpt_code service_pressure_types.code%TYPE;
|
||||||
|
BEGIN
|
||||||
|
pl('get_svcpt_for_svcp:entry:p_svcp_code=' || p_svcp_code
|
||||||
|
,$$PLSQL_LINE);
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
SELECT svcpt_code
|
||||||
|
INTO l_svcpt_code
|
||||||
|
FROM service_pressures
|
||||||
|
WHERE code = p_svcp_code;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN no_data_found THEN
|
||||||
|
l_svcpt_code := NULL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
pl('get_svcpt_for_svcp:exit:' || l_svcpt_code
|
||||||
|
,$$PLSQL_LINE);
|
||||||
|
|
||||||
|
RETURN l_svcpt_code;
|
||||||
|
|
||||||
|
END get_svcpt_for_svcp;
|
||||||
|
|
||||||
FUNCTION get_lead_time(p_enty_code enquiry_types.code%TYPE
|
FUNCTION get_lead_time(p_enty_code enquiry_types.code%TYPE
|
||||||
,p_mety_code meter_types.code%TYPE
|
,p_mety_code meter_types.code%TYPE
|
||||||
,p_svcp_code service_pressures.code%TYPE
|
,p_svcp_code service_pressures.code%TYPE
|
||||||
@@ -2885,7 +2909,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_rfq_prty_id => p_rfq_prty_id
|
,p_rfq_prty_id => p_rfq_prty_id
|
||||||
,p_owner_prty_id => p_owner_prty_id
|
,p_owner_prty_id => p_owner_prty_id
|
||||||
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
||||||
|
pl('produce_exchange_quotes:exit'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
END produce_exchange_quotes;
|
END produce_exchange_quotes;
|
||||||
|
|
||||||
PROCEDURE produce_change_capacity_quotes(p_enqu IN t_enqu
|
PROCEDURE produce_change_capacity_quotes(p_enqu IN t_enqu
|
||||||
@@ -2909,6 +2934,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_owner_prty_id => p_owner_prty_id
|
,p_owner_prty_id => p_owner_prty_id
|
||||||
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
||||||
|
|
||||||
|
pl('produce_change_capacity_quotes:exit'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
END produce_change_capacity_quotes;
|
END produce_change_capacity_quotes;
|
||||||
|
|
||||||
PROCEDURE produce_labour_only_quotes(p_enqu IN t_enqu
|
PROCEDURE produce_labour_only_quotes(p_enqu IN t_enqu
|
||||||
@@ -3100,6 +3127,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
pl('produce_labour_only_quotes:exit'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
|
|
||||||
END produce_labour_only_quotes;
|
END produce_labour_only_quotes;
|
||||||
|
|
||||||
PROCEDURE produce_removal_quotes(p_enqu IN t_enqu
|
PROCEDURE produce_removal_quotes(p_enqu IN t_enqu
|
||||||
@@ -3107,6 +3137,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
||||||
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
||||||
BEGIN
|
BEGIN
|
||||||
|
pl('produce_removal_quotes:entry'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
|
|
||||||
cout_assert.istrue(p_enqu.enty_code IN
|
cout_assert.istrue(p_enqu.enty_code IN
|
||||||
('REMOVE', 'STD REMOVE', 'ADVERSARIAL')
|
('REMOVE', 'STD REMOVE', 'ADVERSARIAL')
|
||||||
,'Attempted to produce a removal quote for enquiry of type ' ||
|
,'Attempted to produce a removal quote for enquiry of type ' ||
|
||||||
@@ -3115,6 +3148,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_rfq_prty_id => p_rfq_prty_id
|
,p_rfq_prty_id => p_rfq_prty_id
|
||||||
,p_owner_prty_id => p_owner_prty_id
|
,p_owner_prty_id => p_owner_prty_id
|
||||||
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
||||||
|
pl('produce_removal_quotes:exit'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
END produce_removal_quotes;
|
END produce_removal_quotes;
|
||||||
|
|
||||||
PROCEDURE produce_ofmat_quotes(p_enqu IN t_enqu
|
PROCEDURE produce_ofmat_quotes(p_enqu IN t_enqu
|
||||||
@@ -3122,6 +3157,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
||||||
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
||||||
BEGIN
|
BEGIN
|
||||||
|
pl('produce_ofmat_quotes:entry'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
cout_assert.istrue(p_enqu.enty_code IN ('OFMAT')
|
cout_assert.istrue(p_enqu.enty_code IN ('OFMAT')
|
||||||
,'Attempted to produce an OFMAT quote for enquiry of type ' ||
|
,'Attempted to produce an OFMAT quote for enquiry of type ' ||
|
||||||
p_enqu.enty_code);
|
p_enqu.enty_code);
|
||||||
@@ -3131,6 +3168,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_owner_prty_id => p_owner_prty_id
|
,p_owner_prty_id => p_owner_prty_id
|
||||||
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
||||||
|
|
||||||
|
pl('produce_ofmat_quotes:exit'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
END produce_ofmat_quotes;
|
END produce_ofmat_quotes;
|
||||||
|
|
||||||
PROCEDURE produce_alteration_quotes(p_enqu IN t_enqu
|
PROCEDURE produce_alteration_quotes(p_enqu IN t_enqu
|
||||||
@@ -3138,6 +3177,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
||||||
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
||||||
BEGIN
|
BEGIN
|
||||||
|
pl('produce_alteration_quotes:entry'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
cout_assert.istrue(p_enqu.enty_code IN ('ALTERATION')
|
cout_assert.istrue(p_enqu.enty_code IN ('ALTERATION')
|
||||||
,'Attempted to produce an ALTERATION quote for enquiry of type ' ||
|
,'Attempted to produce an ALTERATION quote for enquiry of type ' ||
|
||||||
p_enqu.enty_code);
|
p_enqu.enty_code);
|
||||||
@@ -3147,6 +3188,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_owner_prty_id => p_owner_prty_id
|
,p_owner_prty_id => p_owner_prty_id
|
||||||
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
||||||
|
|
||||||
|
pl('produce_alteration_quotes:exit'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
END produce_alteration_quotes;
|
END produce_alteration_quotes;
|
||||||
|
|
||||||
PROCEDURE produce_addon_quotes(p_enqu IN t_enqu
|
PROCEDURE produce_addon_quotes(p_enqu IN t_enqu
|
||||||
@@ -3157,13 +3200,14 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
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_svcpt_code service_pressure_types.code%TYPE;
|
||||||
l_lifting_gear_costs t_rec_additional_costs;
|
l_lifting_gear_costs t_rec_additional_costs;
|
||||||
l_amr_costs t_rec_additional_costs;
|
l_amr_costs t_rec_additional_costs;
|
||||||
l_ems_costs t_rec_additional_costs;
|
l_ems_costs t_rec_additional_costs;
|
||||||
l_bypass_costs t_rec_additional_costs;
|
l_bypass_costs t_rec_additional_costs;
|
||||||
l_quote_document VARCHAR2(240);
|
l_quote_document VARCHAR2(240);
|
||||||
BEGIN
|
BEGIN
|
||||||
pl('produce_addon_quotes'
|
pl('produce_addon_quotes:entry'
|
||||||
,$$PLSQL_LINE);
|
,$$PLSQL_LINE);
|
||||||
|
|
||||||
cout_assert.istrue(p_enqu.enty_code IN ('ADDON')
|
cout_assert.istrue(p_enqu.enty_code IN ('ADDON')
|
||||||
@@ -3235,21 +3279,26 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
/* Always get costs for LIFTING GEAR */
|
|
||||||
|
|
||||||
l_lifting_gear_costs := get_aico(p_adit_code => 'LIFTING GEAR'
|
l_svcpt_code := get_svcpt_for_svcp(p_enqu.required_svcp_code);
|
||||||
,p_regi_code => l_regi_code);
|
|
||||||
IF l_lifting_gear_costs.selling_price IS NULL THEN
|
/* Lifting gear required UNLESS LP Diaphragm */
|
||||||
l_this_is_automatic_quote := FALSE;
|
IF NOT (p_enqu.existing_mety_code = 'DIAPHRAGM' AND l_svcpt_code = 'LP') THEN
|
||||||
add_quote_reason(p_enqu.id
|
l_lifting_gear_costs := get_aico(p_adit_code => 'LIFTING GEAR'
|
||||||
,p_reason => 'Unable to find selling price for LIFTING GEAR.'
|
,p_regi_code => l_regi_code);
|
||||||
,p_internal_or_external => gc_internal_reason);
|
IF l_lifting_gear_costs.selling_price IS NULL THEN
|
||||||
END IF;
|
l_this_is_automatic_quote := FALSE;
|
||||||
IF l_lifting_gear_costs.lead_time IS NULL THEN
|
add_quote_reason(p_enqu.id
|
||||||
l_this_is_automatic_quote := FALSE;
|
,p_reason => 'Unable to find selling price for LIFTING GEAR.'
|
||||||
add_quote_reason(p_enqu.id
|
,p_internal_or_external => gc_internal_reason);
|
||||||
,p_reason => 'Unable to find lead time for LIFTING GEAR.'
|
END IF;
|
||||||
,p_internal_or_external => gc_internal_reason);
|
IF l_lifting_gear_costs.lead_time IS NULL THEN
|
||||||
|
l_this_is_automatic_quote := FALSE;
|
||||||
|
add_quote_reason(p_enqu.id
|
||||||
|
,p_reason => 'Unable to find lead time for LIFTING GEAR.'
|
||||||
|
,p_internal_or_external => gc_internal_reason);
|
||||||
|
END IF;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF l_this_is_automatic_quote THEN
|
IF l_this_is_automatic_quote THEN
|
||||||
@@ -3267,7 +3316,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(id
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
,bas_code
|
,enty_code
|
||||||
|
,mety_code
|
||||||
|
,adit_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
,delivery_price
|
,delivery_price
|
||||||
@@ -3275,6 +3326,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
VALUES
|
VALUES
|
||||||
(quit_seq.NEXTVAL
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
|
,p_enqu.enty_code
|
||||||
|
,p_enqu.existing_mety_code
|
||||||
,l_amr_costs.adit_code
|
,l_amr_costs.adit_code
|
||||||
,l_amr_costs.cost_price
|
,l_amr_costs.cost_price
|
||||||
,l_amr_costs.selling_price
|
,l_amr_costs.selling_price
|
||||||
@@ -3286,6 +3339,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(id
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
|
,enty_code
|
||||||
|
,mety_code
|
||||||
,adit_code
|
,adit_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
@@ -3295,6 +3350,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
VALUES
|
VALUES
|
||||||
(quit_seq.NEXTVAL
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
|
,p_enqu.enty_code
|
||||||
|
,p_enqu.existing_mety_code
|
||||||
,l_ems_costs.adit_code
|
,l_ems_costs.adit_code
|
||||||
,l_ems_costs.cost_price
|
,l_ems_costs.cost_price
|
||||||
,l_ems_costs.selling_price
|
,l_ems_costs.selling_price
|
||||||
@@ -3307,6 +3364,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
INSERT INTO quote_items
|
INSERT INTO quote_items
|
||||||
(id
|
(id
|
||||||
,qute_id
|
,qute_id
|
||||||
|
,enty_code
|
||||||
|
,mety_code
|
||||||
,adit_code
|
,adit_code
|
||||||
,cost_price
|
,cost_price
|
||||||
,selling_price
|
,selling_price
|
||||||
@@ -3316,6 +3375,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
VALUES
|
VALUES
|
||||||
(quit_seq.NEXTVAL
|
(quit_seq.NEXTVAL
|
||||||
,l_qute_id
|
,l_qute_id
|
||||||
|
,p_enqu.enty_code
|
||||||
|
,p_enqu.existing_mety_code
|
||||||
,l_ems_costs.adit_code
|
,l_ems_costs.adit_code
|
||||||
,l_ems_costs.cost_price
|
,l_ems_costs.cost_price
|
||||||
,l_ems_costs.selling_price
|
,l_ems_costs.selling_price
|
||||||
@@ -3324,35 +3385,30 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,'AQI');
|
,'AQI');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
/* Always include LIFTING GEAR */
|
IF l_lifting_gear_costs.selling_price IS NOT NULL THEN
|
||||||
|
INSERT INTO quote_items
|
||||||
INSERT INTO quote_items
|
(id
|
||||||
(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)
|
||||||
,quit_type)
|
VALUES
|
||||||
VALUES
|
(quit_seq.NEXTVAL
|
||||||
(quit_seq.NEXTVAL
|
,l_qute_id
|
||||||
,l_qute_id
|
,l_lifting_gear_costs.adit_code
|
||||||
,l_lifting_gear_costs.adit_code
|
,l_lifting_gear_costs.cost_price
|
||||||
,l_lifting_gear_costs.cost_price
|
,l_lifting_gear_costs.selling_price
|
||||||
,l_lifting_gear_costs.selling_price
|
,l_lifting_gear_costs.delivery_cost
|
||||||
,l_lifting_gear_costs.delivery_cost
|
,l_lifting_gear_costs.lead_time
|
||||||
,l_lifting_gear_costs.lead_time
|
,'AQI');
|
||||||
,'AQI');
|
END IF;
|
||||||
|
|
||||||
-- Generate the quote PDF
|
-- Generate the quote PDF
|
||||||
/*BEGIN*/
|
|
||||||
l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id);
|
l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id);
|
||||||
/* EXCEPTION
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
cout_err.report_and_stop;
|
|
||||||
END;
|
|
||||||
*/
|
|
||||||
add_quote_reason(p_enqu_id => p_enqu.id
|
add_quote_reason(p_enqu_id => p_enqu.id
|
||||||
,p_reason => 'Produced Quote Document ' ||
|
,p_reason => 'Produced Quote Document ' ||
|
||||||
l_quote_document || '.'
|
l_quote_document || '.'
|
||||||
@@ -3375,6 +3431,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
pl('produce_addon_quotes:exit'
|
||||||
|
,$$PLSQL_LINE);
|
||||||
END produce_addon_quotes;
|
END produce_addon_quotes;
|
||||||
|
|
||||||
PROCEDURE produce_automatic_quotes(p_enqu IN t_enqu
|
PROCEDURE produce_automatic_quotes(p_enqu IN t_enqu
|
||||||
@@ -3382,7 +3440,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
|
||||||
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
|
||||||
BEGIN
|
BEGIN
|
||||||
pl('produce_automatic_quotes'
|
pl('produce_automatic_quotes:entry'
|
||||||
,$$PLSQL_LINE);
|
,$$PLSQL_LINE);
|
||||||
|
|
||||||
cout_assert.istrue(p_manual_or_automatic_quote = gc_automatic_quote
|
cout_assert.istrue(p_manual_or_automatic_quote = gc_automatic_quote
|
||||||
@@ -3413,6 +3471,11 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
|||||||
,p_rfq_prty_id => p_rfq_prty_id
|
,p_rfq_prty_id => p_rfq_prty_id
|
||||||
,p_owner_prty_id => p_owner_prty_id
|
,p_owner_prty_id => p_owner_prty_id
|
||||||
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
||||||
|
ELSIF p_enqu.enty_code IN ('ADDON') THEN
|
||||||
|
produce_addon_quotes(p_enqu => p_enqu
|
||||||
|
,p_rfq_prty_id => p_rfq_prty_id
|
||||||
|
,p_owner_prty_id => p_owner_prty_id
|
||||||
|
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
|
||||||
ELSE
|
ELSE
|
||||||
cout_err.report_and_stop(p_exception_message => 'Attempted to produce automatic quote for unexpected enquiry type of ' ||
|
cout_err.report_and_stop(p_exception_message => 'Attempted to produce automatic quote for unexpected enquiry type of ' ||
|
||||||
p_enqu.enty_code);
|
p_enqu.enty_code);
|
||||||
|
|||||||
Reference in New Issue
Block a user