Addresses #376. Correct detection of a bypass_required reason.
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@4006 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -3,7 +3,7 @@ CREATE OR REPLACE PACKAGE mip_quotation IS
|
||||
-- Author : HARDYA
|
||||
-- Created : 15/11/2007 11:27:58
|
||||
-- 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
|
||||
|
||||
@@ -122,8 +122,8 @@ CREATE OR REPLACE PACKAGE mip_quotation IS
|
||||
*/
|
||||
FUNCTION tripartite_agreement_message(p_rec IN mip_enquiries_helper.t_rec_enquiries)
|
||||
RETURN VARCHAR2;
|
||||
|
||||
FUNCTION get_qmax_from_mesc(p_mesc_code IN meter_size_codes.code%TYPE)
|
||||
|
||||
FUNCTION get_qmax_from_mesc(p_mesc_code IN meter_size_codes.code%TYPE)
|
||||
RETURN meter_size_codes.qmax%TYPE;
|
||||
END mip_quotation;
|
||||
/
|
||||
@@ -1526,7 +1526,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
AND p_enqu.required_svcp_code IN ('LP', 'MP') THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for alteration (relocation or reposition) of an existing meter.',gc_external_reason);
|
||||
,'Site Survey is required for alteration (relocation or reposition) of an existing meter.'
|
||||
,gc_external_reason);
|
||||
END IF; -- ALTERATION
|
||||
|
||||
IF p_enqu.enty_code IN ('EXCHANGE', 'STD EXCHANGE', 'CHANGE CAPACITY') THEN
|
||||
@@ -1546,13 +1547,15 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for exchange of an existing ' ||
|
||||
l_svcpt_code || ' meter.',gc_external_reason);
|
||||
l_svcpt_code || ' meter.'
|
||||
,gc_external_reason);
|
||||
ELSE
|
||||
-- Exchange, MP
|
||||
IF p_enqu.existing_mety_code <> 'DIAPHRAGM' THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for exchange of an existing non-diaphragm meter.',gc_external_reason);
|
||||
,'Site Survey is required for exchange of an existing non-diaphragm meter.'
|
||||
,gc_external_reason);
|
||||
ELSE
|
||||
-- Exchange, MP, Diaphragm
|
||||
l_required_mesc_code := p_enqu.required_mesc_code;
|
||||
@@ -1567,7 +1570,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for exchange of diaphragm meter from size ' ||
|
||||
l_rec_metr_details.mesc_code || ' to ' ||
|
||||
l_required_mesc_code || '.',gc_external_reason);
|
||||
l_required_mesc_code || '.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
END IF; -- DIAPHRAGM
|
||||
END IF; -- svcpt_code <> 'MP'
|
||||
@@ -1623,8 +1627,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
l_idx := l_tab_messages.FIRST;
|
||||
LOOP
|
||||
EXIT WHEN l_idx IS NULL;
|
||||
add_quote_reason(p_enqu_id => p_enqu_id
|
||||
,p_reason => l_tab_messages(l_idx),p_internal_or_external=>gc_external_reason);
|
||||
add_quote_reason(p_enqu_id => p_enqu_id
|
||||
,p_reason => l_tab_messages(l_idx)
|
||||
,p_internal_or_external => gc_external_reason);
|
||||
l_idx := l_tab_messages.NEXT(l_idx);
|
||||
END LOOP;
|
||||
|
||||
@@ -1640,6 +1645,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
|
||||
PROCEDURE manual_or_automatic_quote(p_enqu IN t_enqu
|
||||
,p_manual_or_automatic_quote OUT t_manual_or_automatic_quote) IS
|
||||
l_dummy NUMBER;
|
||||
BEGIN
|
||||
pl('manual_or_automatic_quote'
|
||||
,$$PLSQL_LINE);
|
||||
@@ -1649,7 +1655,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Enquiry type is ''' ||
|
||||
get_enty_description(p_enqu.id) || '''.',gc_external_reason);
|
||||
get_enty_description(p_enqu.id) || '''.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
survey_required(p_enqu => p_enqu
|
||||
@@ -1658,57 +1665,78 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
IF p_enqu.twin_stream_required = 'YES' THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Twin stream required.',gc_external_reason);
|
||||
,'Twin stream required.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.bypass_required = 'YES' THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Bypass required.',gc_external_reason);
|
||||
IF p_enqu.bypass_required IS NOT NULL THEN
|
||||
BEGIN
|
||||
SELECT 1
|
||||
INTO l_dummy
|
||||
FROM bypass_reasons
|
||||
WHERE description = p_enqu.bypass_required
|
||||
AND code <> '1';
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Bypass required.'
|
||||
,gc_external_reason);
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
-- bypass reason 1
|
||||
-- no action required
|
||||
NULL;
|
||||
END;
|
||||
END IF;
|
||||
|
||||
IF p_enqu.required_metering_pressure > 21 THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Required metering pressure is greater than 21mbar.',gc_external_reason);
|
||||
,'Required metering pressure is greater than 21mbar.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.convertor_required = 'YES' THEN
|
||||
IF p_enqu.convertor_required = 'YES' THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Convertor required.',gc_external_reason);
|
||||
,'Convertor required.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
|
||||
IF p_enqu.job_description IS NOT NULL THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Job Description field was entered.',gc_external_reason);
|
||||
,'Job Description field was entered.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.downstream_booster_or_compress = 'YES' THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Booster or compressor is present downstream of the meter module.',gc_external_reason);
|
||||
,'Booster or compressor is present downstream of the meter module.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.annual_quantity > 732 * 1000 THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Required Annual Quantity is in excess of 732MWh.',gc_external_reason);
|
||||
,'Required Annual Quantity is in excess of 732MWh.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.existing_convertor = 'YES'
|
||||
AND p_enqu.enty_code NOT IN ('REMOVE', 'STD REMOVE', 'ADVERSARIAL') THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Convertor is present.',gc_external_reason);
|
||||
,'Convertor is present.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.existing_logger = 'YES'
|
||||
AND p_enqu.enty_code IN ('EXCHANGE', 'STD EXCHANGE') THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Logger is present.',gc_external_reason);
|
||||
,'Logger is present.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.enty_code IN ('OFMAT')
|
||||
@@ -1718,7 +1746,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
,1) <> 'U') THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'OFMAT request for a non-''U''-sized Diaphragm meter.',gc_external_reason);
|
||||
,'OFMAT request for a non-''U''-sized Diaphragm meter.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.enty_code IN ('OFMAT', 'EXCHANGE', 'STD EXCHANGE', 'REMOVE',
|
||||
@@ -1730,18 +1759,21 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,get_enty_description(p_enqu.enty_code) ||
|
||||
' request has insufficient details describing the existing meter.',gc_external_reason);
|
||||
' request has insufficient details describing the existing meter.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
-- check postcode
|
||||
IF NOT mip_regions.valid_postcode_format(p_enqu.install_postcode) THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Installation postcode is of an unrecognized format.',gc_external_reason);
|
||||
,'Installation postcode is of an unrecognized format.'
|
||||
,gc_external_reason);
|
||||
ELSIF mip_regions.get_region_for_postcode(p_enqu.install_postcode) IS NULL THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Unable to determine pricing region for given installation postcode.',gc_external_reason);
|
||||
,'Unable to determine pricing region for given installation postcode.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
|
||||
IF p_manual_or_automatic_quote = gc_manual_quote THEN
|
||||
@@ -2139,9 +2171,11 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for exchange of diaphragm meter from size ' ||
|
||||
l_existing_rec_metr_details.mesc_code || ' to ' ||
|
||||
l_required_mesc_code || '.',gc_external_reason);
|
||||
l_required_mesc_code || '.'
|
||||
,gc_external_reason);
|
||||
ELSE
|
||||
add_quote_reason(p_enqu.id,'Required meter size code is ' ||
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Required meter size code is ' ||
|
||||
l_required_mesc_code
|
||||
,gc_internal_reason);
|
||||
pl('Required Meter Size Code=' || l_required_mesc_code
|
||||
@@ -2150,7 +2184,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
ELSE
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for exchange of meter.',gc_external_reason);
|
||||
,'Site Survey is required for exchange of meter.'
|
||||
,gc_external_reason);
|
||||
END IF;
|
||||
ELSE
|
||||
pl('required_mesc_code=' || p_enqu.required_mesc_code
|
||||
@@ -3331,6 +3366,5 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
RAISE;
|
||||
END produce_quotes;
|
||||
|
||||
|
||||
END mip_quotation;
|
||||
/
|
||||
|
||||
Reference in New Issue
Block a user