From ed16b182ef54bfc952f79b8dda7865058ddaef17 Mon Sep 17 00:00:00 2001 From: hardya Date: Mon, 10 Mar 2008 16:20:04 +0000 Subject: [PATCH] Correction to labour cost only quotes to get costing parameters from existing meter (as for module quotes). git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3917 248e525c-4dfb-0310-94bc-949c084e9493 --- Modules/mip_quotation.pck | 59 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/Modules/mip_quotation.pck b/Modules/mip_quotation.pck index 2197ed3..48ccddb 100644 --- a/Modules/mip_quotation.pck +++ b/Modules/mip_quotation.pck @@ -570,8 +570,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS FUNCTION get_system_name RETURN system_configuration.VALUE%TYPE IS BEGIN - - RETURN get_system_configuration_value('SYSTEM_NAME'); + RETURN 'WEBMIP '|| v('SYSTEM_ENVIRONMENT'); END get_system_name; FUNCTION get_customer_support_telephone @@ -916,7 +915,6 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); al('Phone: 02476 286 322'); al('Fax: 02476 286 044'); al('Email: ic.nonstandard1@uk.ngrid.com'); - l_attachment := get_quote_document(p_enqu_id => p_enqu_id); ELSIF p_email_reason = gc_agent_q_acc_notification THEN -- Scenario two: Quotation acceptance notification l_email_subject := get_system_name || ': Quote Acceptance'; @@ -1116,8 +1114,6 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); END email_agent_mq_available; PROCEDURE email_agent_request_for_mq(p_enqu_id IN enquiries.id%TYPE) IS - l_system_name system_configuration.VALUE%TYPE := get_system_name; - l_quote_row quotes%ROWTYPE; BEGIN pl('email_request_for_mq:enter' ,$$PLSQL_LINE); @@ -1882,8 +1878,10 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); RETURN t_rec_additional_costs IS l_rec_costs t_rec_additional_costs; BEGIN - pl('get_laco' + pl('get_laco:entry:' || p_enty_code || ':' || p_regi_code || ':' || + p_mety_code || ':' || p_mesc_code || ':' || p_svcp_code ,$$PLSQL_LINE); + SELECT selling_price ,cost_price ,delivery_cost @@ -1924,6 +1922,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); ORDER BY 1) WHERE rownum < 2; + pl('get_laco:exit:' || l_rec_costs.selling_price); + RETURN l_rec_costs; EXCEPTION @@ -2022,7 +2022,6 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); ,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS l_produced_automatic_quote BOOLEAN; l_this_is_automatic_quote BOOLEAN; - l_cannot_quote BOOLEAN; l_regi_code regions.code%TYPE := mip_regions.get_region_for_postcode(p_enqu.install_postcode); l_qute_id quotes.id%TYPE; l_additional_costs t_rec_additional_costs; @@ -2034,8 +2033,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); pl('produce_module_quotes:entry:' || p_enqu.id || ':' || p_enqu.enty_code ,$$PLSQL_LINE); - cout_assert.istrue(p_enqu.enty_code IN ('INSTALL', 'STD INSTALL', - 'EXCHANGE', 'CAPACITY CHANGE') + cout_assert.istrue(p_enqu.enty_code IN + ('INSTALL', 'STD INSTALL', 'EXCHANGE', + 'CAPACITY CHANGE', 'STD EXCHANGE') ,'Attempted to produce an install or exchange quote for enquiry of type ' || p_enqu.enty_code); @@ -2299,7 +2299,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); ', Meter Type Code:' || l_rec_module.mety_code || ', Meter Size Code:' || - p_enqu.required_mesc_code || + l_rec_module.mesc_code || ', Service Pressure Code:' || p_enqu.required_svcp_code || CASE l_regi_code WHEN NULL THEN '' ELSE ' for region code ' || l_regi_code END || '.' @@ -2730,15 +2730,15 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); ,p_rfq_prty_id IN parties.id%TYPE ,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL ,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS - l_produced_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_lead_time NUMBER; - l_qute_id quotes.id%TYPE; - l_labour_costs t_rec_additional_costs; - l_quote_document VARCHAR2(240); - l_existing_mesc_code meter_size_codes.code%TYPE; - l_additional_costs t_rec_additional_costs; + l_produced_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_lead_time NUMBER; + l_qute_id quotes.id%TYPE; + l_labour_costs t_rec_additional_costs; + l_quote_document VARCHAR2(240); + l_additional_costs t_rec_additional_costs; + l_existing_rec_metr_details t_rec_metr_details; BEGIN pl('produce_labour_only_quotes' ,$$PLSQL_LINE); @@ -2764,24 +2764,21 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); l_this_is_automatic_quote := TRUE; - l_existing_mesc_code := p_enqu.existing_mesc_code; - IF l_existing_mesc_code IS NULL THEN - l_existing_mesc_code := get_u_meter_size(p_enqu.qmax); - END IF; + l_existing_rec_metr_details := get_existing_metr_details(p_enqu); l_labour_costs := get_laco(p_enty_code => p_enqu.enty_code ,p_regi_code => l_regi_code - ,p_mety_code => p_enqu.existing_mety_code - ,p_mesc_code => l_existing_mesc_code + ,p_mety_code => l_existing_rec_metr_details.mety_code + ,p_mesc_code => l_existing_rec_metr_details.mesc_code ,p_svcp_code => p_enqu.required_svcp_code); IF l_labour_costs.selling_price IS NULL THEN l_this_is_automatic_quote := FALSE; add_quote_reason(p_enqu.id ,p_reason => 'Unable to find Labour Cost (selling price) for this Enquiry Type Code: ' || p_enqu.enty_code || ', Meter Type Code:' || - p_enqu.existing_mety_code || + l_existing_rec_metr_details.mety_code || ', Meter Size Code:' || - l_existing_mesc_code || + l_existing_rec_metr_details.mesc_code || ', Service Pressure Code:' || p_enqu.required_svcp_code || CASE l_regi_code WHEN NULL THEN '' ELSE ' for region code ' || l_regi_code END || '.' @@ -2790,7 +2787,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); END IF; l_lead_time := get_lead_time(p_enty_code => p_enqu.enty_code - ,p_mety_code => p_enqu.existing_mety_code + ,p_mety_code => l_existing_rec_metr_details.mety_code ,p_svcp_code => p_enqu.required_svcp_code ,p_qmax => p_enqu.qmax); IF l_lead_time IS NULL THEN @@ -2798,7 +2795,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); add_quote_reason(p_enqu.id ,p_reason => 'Unable to find lead time for ' || get_lead_time_desc(p_enty_code => p_enqu.enty_code - ,p_mety_code => p_enqu.existing_mety_code + ,p_mety_code => l_existing_rec_metr_details.mety_code ,p_svcp_code => p_enqu.required_svcp_code ,p_qmax => p_enqu.qmax) ,p_internal_or_external => gc_internal_reason); @@ -2850,8 +2847,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); ,l_qute_id ,p_enqu.enty_code ,l_labour_costs.svcpt_code - ,l_existing_mesc_code - ,p_enqu.existing_mety_code + ,l_existing_rec_metr_details.mesc_code + ,l_existing_rec_metr_details.mety_code ,l_labour_costs.cost_price ,l_labour_costs.selling_price ,l_labour_costs.delivery_cost