Add calc_meter_reqs to mip_quotation.pck.

Ensure that all calls to add_quote_reason use correct parameters (mip_quotation.pck).

Change grant from 'CREATE ANY VIEW' to 'CREATE VIEW' in InstallMIP.sql following problems installing 'supporting objects' into MIP_TEST.


git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3989 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
hardya
2008-03-13 18:36:18 +00:00
parent c94f48c9f2
commit 24c31ebc45
3 changed files with 221 additions and 77 deletions

View File

@@ -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,7 +122,9 @@ 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)
RETURN meter_size_codes.qmax%TYPE;
END mip_quotation;
/
CREATE OR REPLACE PACKAGE BODY mip_quotation IS
@@ -1309,7 +1311,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
PROCEDURE add_quote_reason(p_enqu_id IN enquiries.id%TYPE
,p_reason IN VARCHAR2 --quote_reasoning.reason%TYPE
,p_internal_or_external IN quote_reasoning.internal_or_external%TYPE DEFAULT gc_external_reason) IS
,p_internal_or_external IN quote_reasoning.internal_or_external%TYPE) IS
BEGIN
pl('add_quote_reason:' || p_enqu_id || ':' || p_reason
,$$PLSQL_LINE);
@@ -1524,7 +1526,7 @@ 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.');
,'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
@@ -1544,13 +1546,13 @@ 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.');
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.');
,'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;
@@ -1565,7 +1567,7 @@ 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 || '.');
l_required_mesc_code || '.',gc_external_reason);
END IF;
END IF; -- DIAPHRAGM
END IF; -- svcpt_code <> 'MP'
@@ -1622,7 +1624,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
LOOP
EXIT WHEN l_idx IS NULL;
add_quote_reason(p_enqu_id => p_enqu_id
,p_reason => l_tab_messages(l_idx));
,p_reason => l_tab_messages(l_idx),p_internal_or_external=>gc_external_reason);
l_idx := l_tab_messages.NEXT(l_idx);
END LOOP;
@@ -1647,7 +1649,7 @@ 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) || '''.');
get_enty_description(p_enqu.id) || '''.',gc_external_reason);
END IF;
survey_required(p_enqu => p_enqu
@@ -1656,51 +1658,51 @@ 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.');
,'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.');
,'Bypass required.',gc_external_reason);
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.');
,'Required metering pressure is greater than 21mbar.',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.');
,'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.');
,'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.');
,'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.');
,'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.');
,'Logger is present.',gc_external_reason);
END IF;
IF p_enqu.enty_code IN ('OFMAT')
@@ -1710,7 +1712,7 @@ 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.');
,'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',
@@ -1722,18 +1724,18 @@ 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.');
' 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.');
,'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.');
,'Unable to determine pricing region for given installation postcode.',gc_external_reason);
END IF;
IF p_manual_or_automatic_quote = gc_manual_quote THEN
@@ -2131,9 +2133,9 @@ 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 || '.');
l_required_mesc_code || '.',gc_external_reason);
ELSE
add_quote_reason('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
@@ -2142,13 +2144,13 @@ 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.');
,'Site Survey is required for exchange of meter.',gc_external_reason);
END IF;
ELSE
pl('required_mesc_code=' || p_enqu.required_mesc_code
,$$PLSQL_UNIT);
,$$PLSQL_LINE);
pl('qmax=' || p_enqu.qmax
,$$PLSQL_UNIT);
,$$PLSQL_LINE);
-- the user can only request meter sizes of:
-- 'U' meter size code, these have associated Qmax values; OR
-- 'OTHER' - the user didn't know the meter size code!
@@ -3323,9 +3325,6 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RAISE;
END produce_quotes;
BEGIN
-- Initialization
pl('mip_quotation'
,$$PLSQL_LINE);
END mip_quotation;
/