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
This commit is contained in:
hardya
2008-03-10 16:20:04 +00:00
parent 4fadc5b458
commit ed16b182ef

View File

@@ -570,8 +570,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
FUNCTION get_system_name RETURN system_configuration.VALUE%TYPE IS FUNCTION get_system_name RETURN system_configuration.VALUE%TYPE IS
BEGIN BEGIN
RETURN 'WEBMIP '|| v('SYSTEM_ENVIRONMENT');
RETURN get_system_configuration_value('SYSTEM_NAME');
END get_system_name; END get_system_name;
FUNCTION get_customer_support_telephone FUNCTION get_customer_support_telephone
@@ -916,7 +915,6 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
al('Phone: 02476 286 322'); al('Phone: 02476 286 322');
al('Fax: 02476 286 044'); al('Fax: 02476 286 044');
al('Email: ic.nonstandard1@uk.ngrid.com'); 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 ELSIF p_email_reason = gc_agent_q_acc_notification THEN
-- Scenario two: Quotation acceptance notification -- Scenario two: Quotation acceptance notification
l_email_subject := get_system_name || ': Quote Acceptance'; 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; END email_agent_mq_available;
PROCEDURE email_agent_request_for_mq(p_enqu_id IN enquiries.id%TYPE) IS 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 BEGIN
pl('email_request_for_mq:enter' pl('email_request_for_mq:enter'
,$$PLSQL_LINE); ,$$PLSQL_LINE);
@@ -1882,8 +1878,10 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RETURN t_rec_additional_costs IS RETURN t_rec_additional_costs IS
l_rec_costs t_rec_additional_costs; l_rec_costs t_rec_additional_costs;
BEGIN 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); ,$$PLSQL_LINE);
SELECT selling_price SELECT selling_price
,cost_price ,cost_price
,delivery_cost ,delivery_cost
@@ -1924,6 +1922,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
ORDER BY 1) ORDER BY 1)
WHERE rownum < 2; WHERE rownum < 2;
pl('get_laco:exit:' || l_rec_costs.selling_price);
RETURN l_rec_costs; RETURN l_rec_costs;
EXCEPTION 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 ,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
l_produced_automatic_quote BOOLEAN; l_produced_automatic_quote BOOLEAN;
l_this_is_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_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_additional_costs t_rec_additional_costs; 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 || ':' || pl('produce_module_quotes:entry:' || p_enqu.id || ':' ||
p_enqu.enty_code p_enqu.enty_code
,$$PLSQL_LINE); ,$$PLSQL_LINE);
cout_assert.istrue(p_enqu.enty_code IN ('INSTALL', 'STD INSTALL', cout_assert.istrue(p_enqu.enty_code IN
'EXCHANGE', 'CAPACITY CHANGE') ('INSTALL', 'STD INSTALL', 'EXCHANGE',
'CAPACITY CHANGE', 'STD EXCHANGE')
,'Attempted to produce an install or exchange quote for enquiry of type ' || ,'Attempted to produce an install or exchange quote for enquiry of type ' ||
p_enqu.enty_code); p_enqu.enty_code);
@@ -2299,7 +2299,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
', Meter Type Code:' || ', Meter Type Code:' ||
l_rec_module.mety_code || l_rec_module.mety_code ||
', Meter Size Code:' || ', Meter Size Code:' ||
p_enqu.required_mesc_code || l_rec_module.mesc_code ||
', Service Pressure Code:' || ', Service Pressure Code:' ||
p_enqu.required_svcp_code || CASE p_enqu.required_svcp_code || CASE
l_regi_code WHEN NULL THEN '' ELSE ' for region code ' || l_regi_code END || '.' l_regi_code WHEN NULL THEN '' ELSE ' for region code ' || l_regi_code END || '.'
@@ -2737,8 +2737,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_qute_id quotes.id%TYPE; l_qute_id quotes.id%TYPE;
l_labour_costs t_rec_additional_costs; l_labour_costs t_rec_additional_costs;
l_quote_document VARCHAR2(240); l_quote_document VARCHAR2(240);
l_existing_mesc_code meter_size_codes.code%TYPE;
l_additional_costs t_rec_additional_costs; l_additional_costs t_rec_additional_costs;
l_existing_rec_metr_details t_rec_metr_details;
BEGIN BEGIN
pl('produce_labour_only_quotes' pl('produce_labour_only_quotes'
,$$PLSQL_LINE); ,$$PLSQL_LINE);
@@ -2764,24 +2764,21 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_this_is_automatic_quote := TRUE; l_this_is_automatic_quote := TRUE;
l_existing_mesc_code := p_enqu.existing_mesc_code; l_existing_rec_metr_details := get_existing_metr_details(p_enqu);
IF l_existing_mesc_code IS NULL THEN
l_existing_mesc_code := get_u_meter_size(p_enqu.qmax);
END IF;
l_labour_costs := get_laco(p_enty_code => p_enqu.enty_code l_labour_costs := get_laco(p_enty_code => p_enqu.enty_code
,p_regi_code => l_regi_code ,p_regi_code => l_regi_code
,p_mety_code => p_enqu.existing_mety_code ,p_mety_code => l_existing_rec_metr_details.mety_code
,p_mesc_code => l_existing_mesc_code ,p_mesc_code => l_existing_rec_metr_details.mesc_code
,p_svcp_code => p_enqu.required_svcp_code); ,p_svcp_code => p_enqu.required_svcp_code);
IF l_labour_costs.selling_price IS NULL THEN IF l_labour_costs.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 Labour Cost (selling price) for this Enquiry Type Code: ' || ,p_reason => 'Unable to find Labour Cost (selling price) for this Enquiry Type Code: ' ||
p_enqu.enty_code || ', Meter Type Code:' || p_enqu.enty_code || ', Meter Type Code:' ||
p_enqu.existing_mety_code || l_existing_rec_metr_details.mety_code ||
', Meter Size Code:' || ', Meter Size Code:' ||
l_existing_mesc_code || l_existing_rec_metr_details.mesc_code ||
', Service Pressure Code:' || ', Service Pressure Code:' ||
p_enqu.required_svcp_code || CASE p_enqu.required_svcp_code || CASE
l_regi_code WHEN NULL THEN '' ELSE ' for region code ' || l_regi_code END || '.' 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; END IF;
l_lead_time := get_lead_time(p_enty_code => p_enqu.enty_code 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_svcp_code => p_enqu.required_svcp_code
,p_qmax => p_enqu.qmax); ,p_qmax => p_enqu.qmax);
IF l_lead_time IS NULL THEN 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 add_quote_reason(p_enqu.id
,p_reason => 'Unable to find lead time for ' || ,p_reason => 'Unable to find lead time for ' ||
get_lead_time_desc(p_enty_code => p_enqu.enty_code 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_svcp_code => p_enqu.required_svcp_code
,p_qmax => p_enqu.qmax) ,p_qmax => p_enqu.qmax)
,p_internal_or_external => gc_internal_reason); ,p_internal_or_external => gc_internal_reason);
@@ -2850,8 +2847,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,l_qute_id ,l_qute_id
,p_enqu.enty_code ,p_enqu.enty_code
,l_labour_costs.svcpt_code ,l_labour_costs.svcpt_code
,l_existing_mesc_code ,l_existing_rec_metr_details.mesc_code
,p_enqu.existing_mety_code ,l_existing_rec_metr_details.mety_code
,l_labour_costs.cost_price ,l_labour_costs.cost_price
,l_labour_costs.selling_price ,l_labour_costs.selling_price
,l_labour_costs.delivery_cost ,l_labour_costs.delivery_cost