Address #303 - removed <br> from friendly constraint messages.

Amend Qmax values defined within MESC.ctl
Fix bulk_load errors related to loading drawings through MIP_FILES
Amend mip_quotation to produce labour costs where meter size or service pressure is not a cost constraint.
Amend mip_quotation email messages.
Perform additional compilations during install to account for dependency links.
Make meter dimensions optional (mip.tab)

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3721 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
hardya
2008-02-26 17:54:21 +00:00
parent c3e754f7da
commit 1f0c8e4f90
12 changed files with 621 additions and 504 deletions

View File

@@ -11,12 +11,12 @@ code
,valid_for_new_meter
)
BEGINDATA
U16|U16|12.8|YES|YES
U25|U25|20|YES|YES
U40|U40|32|YES|YES
U65|U65|52|YES|YES
U100|U100|80|YES|YES
U160|U160|128|YES|YES
U16|U16|16|YES|YES
U25|U25|25|YES|YES
U40|U40|40|YES|YES
U65|U65|65|YES|YES
U100|U100|100|YES|YES
U160|U160|160|YES|YES
Rotary/Turbine 2inch|Rotary/Turbine 2inch|999|YES|NO
Rotary/Turbine 3inch|Rotary/Turbine 3inch|9999|YES|NO
Rotary/Turbine 4inch|Rotary/Turbine 4inch|99999|YES|NO

View File

@@ -40,7 +40,7 @@ COST_MODU_FK|Application Error: Attempting to violate foreign key constraint COS
COST_PK|Attempting to create a duplicate Costs entry
COST_REGI_FK|Application Error: Attempting to violate foreign key constraint COST_REGI_FK. Please report this error to Advantica.
COST_SVCPT_FK|Application Error: Attempting to violate foreign key constraint COST_SVCPT_FK. Please report this error to Advantica.
COST_UK|Attempting to create a duplicate Costs entry. <br>Labour costs should be unique across enquiry type, service pressure, meter size, meter type, valid from and region. <br>Costs for modules, housings, bases and additional items should be unique across valid from and region.
COST_UK|Attempting to create a duplicate Costs entry. Labour costs should be unique across enquiry type, service pressure, meter size, meter type, valid from and region. Costs for modules, housings, bases and additional items should be unique across valid from and region.
DIR_ENTY_FK|Application Error: Attempting to violate foreign key constraint DIR_ENTY_FK. Please report this error to Advantica.
DIR_PK|Attempting to create a duplicate Data_Item_Roles entry
DOCU_PK|Attempting to create a duplicate Documents entry

View File

@@ -1,38 +1,39 @@
create or replace package MIP_FILES is
CREATE OR REPLACE PACKAGE mip_files IS
-- Author : PRIESTJ
-- Created : 02/11/2007 10:59:52
-- Purpose : Handle files for the webMIP system
-- Public function and procedure declarations
function quote_file_exists(p_qute_id number) return boolean;
function delete_file(p_id number,p_doc_status varchar2,p_reason varchar2) return boolean;
function drawing_file_exists(p_drwg_code varchar2) return boolean;
function update_file_association(p_uri in varchar2,
p_description in varchar2,
p_docu_type in varchar2,
p_qute_id in number,
p_enqu_id in number,
p_drwg_code in varchar2) return boolean;
function set_file_association(p_uri in varchar2,
p_description in varchar2,
p_docu_type in varchar2,
p_rt_code in varchar2,
p_qute_id in number,
p_enqu_id in number,
p_drwg_code in varchar2,
p_doro_type in varchar2) return boolean;
FUNCTION quote_file_exists(p_qute_id NUMBER) RETURN BOOLEAN;
FUNCTION delete_file(p_id NUMBER
,p_doc_status VARCHAR2
,p_reason VARCHAR2) RETURN BOOLEAN;
FUNCTION drawing_file_exists(p_drwg_code VARCHAR2) RETURN BOOLEAN;
FUNCTION update_file_association(p_uri IN VARCHAR2
,p_description IN VARCHAR2
,p_docu_type IN VARCHAR2
,p_qute_id IN NUMBER
,p_enqu_id IN NUMBER
,p_drwg_code IN VARCHAR2) RETURN BOOLEAN;
FUNCTION set_file_association(p_uri IN VARCHAR2
,p_description IN VARCHAR2
,p_docu_type IN VARCHAR2
,p_rt_code IN VARCHAR2
,p_qute_id IN NUMBER
,p_enqu_id IN NUMBER
,p_drwg_code IN VARCHAR2
,p_doro_type IN VARCHAR2) RETURN BOOLEAN;
PROCEDURE export_table_to_csv(p_table IN VARCHAR2,
p_column_headers IN VARCHAR2,
p_delimiter IN VARCHAR2 DEFAULT ',');
PROCEDURE export_table_to_csv(p_table IN VARCHAR2
,p_column_headers IN VARCHAR2
,p_delimiter IN VARCHAR2 DEFAULT ',');
end MIP_FILES;
END mip_files;
/
create or replace package body MIP_FILES as
CREATE OR REPLACE PACKAGE BODY mip_files AS
PROCEDURE pl(p_in VARCHAR2) IS
PROCEDURE pl(p_in VARCHAR2) IS
l_fh utl_file.file_type;
BEGIN
dbms_application_info.set_module('MIP_FILES'
@@ -46,27 +47,26 @@ PROCEDURE pl(p_in VARCHAR2) IS
utl_file.fclose(l_fh);
END pl;
/*
FUNCTION is_file_over_size_limit
- takes the uri of the file to test for size and returns true if the file
- is over 3 meg (3145728 bytes) in size
%param p_uri - the uri of the file
*/
function is_file_over_size_limit(p_uri varchar2) return boolean is
l_file_size wwv_flow_files.doc_size%type;
FUNCTION is_file_over_size_limit(p_uri VARCHAR2) RETURN BOOLEAN IS
l_file_size wwv_flow_files.doc_size%TYPE;
BEGIN
pl('is_file_over_size_limit:'||p_uri);
pl('is_file_over_size_limit:' || p_uri);
SELECT doc_size
INTO l_file_size
FROM wwv_flow_files
WHERE NAME = p_uri;
pl('l_file_size:'||l_file_size);
pl('l_file_size:' || l_file_size);
RETURN(l_file_size > 3 * 1024 * 1024);
end is_file_over_size_limit;
END is_file_over_size_limit;
/*
FUNCTION are_files_over_size_limit
- takes the enquiry id and an additional uri of the file to test for size
@@ -74,10 +74,10 @@ pl('l_file_size:'||l_file_size);
- by the uri are over 10 meg (10485760 bytes) in size
%param p_enqu_id - id of the enquiry to check the files for
*/
function are_files_over_size_limit(p_enqu_id NUMBER) return boolean is
l_total_size number;
FUNCTION are_files_over_size_limit(p_enqu_id NUMBER) RETURN BOOLEAN IS
l_total_size NUMBER;
BEGIN
pl('are_files_over_size_limit:'||p_enqu_id);
pl('are_files_over_size_limit:' || p_enqu_id);
SELECT SUM(doc_size)
INTO l_total_size
FROM documents d
@@ -87,10 +87,11 @@ pl('are_files_over_size_limit:'||p_enqu_id);
AND d.id = dr.docu_id
AND d.uri = f.NAME;
pl('l_total_size:'||l_total_size);
RETURN (nvl(l_total_size,0) > 10 * 1024 * 1024);
pl('l_total_size:' || l_total_size);
RETURN(nvl(l_total_size
,0) > 10 * 1024 * 1024);
end are_files_over_size_limit;
END are_files_over_size_limit;
/*
FUNCTION delete_file
- takes the id of a file held in the documents table and deletes the associated document
@@ -99,13 +100,15 @@ pl('l_total_size:'||l_total_size);
%param p_doc_status - the new status of the document one of "REMOVED USER", "REMOVED MALICIOUS", "REMOVED SIZE"
%param p_reason - a description of what the reason for deleting the file is
*/
function delete_file(p_id number,p_doc_status varchar2,p_reason varchar2) return boolean is
l_uri documents.uri%type;
CURSOR c_get_uri(cp_id number) is
select uri
from documents
where id=cp_id;
begin
FUNCTION delete_file(p_id NUMBER
,p_doc_status VARCHAR2
,p_reason VARCHAR2) RETURN BOOLEAN IS
l_uri documents.uri%TYPE;
CURSOR c_get_uri(cp_id NUMBER) IS
SELECT uri
FROM documents
WHERE id = cp_id;
BEGIN
IF NOT c_get_uri%ISOPEN THEN
OPEN c_get_uri(p_id);
END IF;
@@ -113,70 +116,83 @@ pl('l_total_size:'||l_total_size);
INTO l_uri;
CLOSE c_get_uri;
--set up a deletion event for the document
insert into document_events(docu_id, dost_code,event_date,description,id)
values (p_id,
p_doc_status,
sysdate,
p_reason,
doev_seq.NEXTVAL);
INSERT INTO document_events
(docu_id
,dost_code
,event_date
,description
,id)
VALUES
(p_id
,p_doc_status
,SYSDATE
,p_reason
,doev_seq.NEXTVAL);
--delete the actual file from the database
delete wwv_flow_files where wwv_flow_files.name = l_uri;
return true;
end delete_file;
DELETE wwv_flow_files
WHERE wwv_flow_files.NAME = l_uri;
RETURN TRUE;
END delete_file;
/*
FUNCTION quote_file_exists
- takes the quote id and searches for associated file in APEX Application
- Files, returns true if the file exists or false if it does not exist
%param p_qute_id - the quote id
*/
function quote_file_exists(p_qute_id number) return boolean is
l_file_exists number;
CURSOR c_file_exists(cp_qute_id number) IS
select 1
from wwv_flow_files
where name=(select d.uri
from documents d, document_roles dr
where dr.qute_id = cp_qute_id and d.id = dr.docu_id);
begin
FUNCTION quote_file_exists(p_qute_id NUMBER) RETURN BOOLEAN IS
l_file_exists NUMBER;
CURSOR c_file_exists(cp_qute_id NUMBER) IS
SELECT 1
FROM wwv_flow_files
WHERE NAME = (SELECT d.uri
FROM documents d
,document_roles dr
WHERE dr.qute_id = cp_qute_id
AND d.id = dr.docu_id);
BEGIN
IF NOT c_file_exists%ISOPEN THEN
OPEN c_file_exists(p_qute_id);
END IF;
FETCH c_file_exists
INTO l_file_exists;
CLOSE c_file_exists;
if l_file_exists is not null and l_file_exists>0 then
return true;
else
return false;
end if;
end quote_file_exists;
IF l_file_exists IS NOT NULL
AND l_file_exists > 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END quote_file_exists;
/*
FUNCTION drawing_file_exists
- takes the drawing code and searches for associated file in APEX Application
- Files, returns true if the file exists or false if it does not exist
%param p_drwg_code - the drawing code
*/
function drawing_file_exists(p_drwg_code varchar2) return boolean is
l_file_exists number;
CURSOR c_file_exists(cp_drwg_code varchar2) IS
select 1
from wwv_flow_files
where name=(select d.uri
from documents d, document_roles dr
where dr.drwg_code = cp_drwg_code and d.id = dr.docu_id);
begin
FUNCTION drawing_file_exists(p_drwg_code VARCHAR2) RETURN BOOLEAN IS
l_file_exists NUMBER;
CURSOR c_file_exists(cp_drwg_code VARCHAR2) IS
SELECT 1
FROM wwv_flow_files
WHERE NAME = (SELECT d.uri
FROM documents d
,document_roles dr
WHERE dr.drwg_code = cp_drwg_code
AND d.id = dr.docu_id);
BEGIN
IF NOT c_file_exists%ISOPEN THEN
OPEN c_file_exists(p_drwg_code);
END IF;
FETCH c_file_exists
INTO l_file_exists;
CLOSE c_file_exists;
if l_file_exists is not null and l_file_exists>0 then
return true;
else
return false;
end if;
end drawing_file_exists;
IF l_file_exists IS NOT NULL
AND l_file_exists > 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END drawing_file_exists;
/*
FUNCTION update_file_association
- updates the association between a object within webmip to a file held in the
@@ -189,35 +205,52 @@ pl('l_total_size:'||l_total_size);
%param p_enqu_id - the enquiry id if applicable otherwise supply null
%param p_drwg_code - the drawing code if applicable otherwise supply null
*/
function update_file_association(p_uri in varchar2,
p_description in varchar2,
p_docu_type in varchar2,
p_qute_id in number,
p_enqu_id in number,
p_drwg_code in varchar2) return boolean is
l_doc_id number;
FUNCTION update_file_association(p_uri IN VARCHAR2
,p_description IN VARCHAR2
,p_docu_type IN VARCHAR2
,p_qute_id IN NUMBER
,p_enqu_id IN NUMBER
,p_drwg_code IN VARCHAR2) RETURN BOOLEAN IS
l_doc_id NUMBER;
begin
BEGIN
--reference it in the documents table
insert into documents( uri, description, id, docu_type )
values (p_uri,
p_description,
docu_seq.NEXTVAL,
p_docu_type)
returning id into l_doc_id;
INSERT INTO documents
(uri
,description
,id
,docu_type)
VALUES
(p_uri
,p_description
,docu_seq.NEXTVAL
,p_docu_type)
RETURNING id INTO l_doc_id;
--set up a role for the document
update document_roles set docu_id = l_doc_id
where drwg_code = nvl(p_drwg_code,'') or qute_id = nvl(p_qute_id,0) or enqu_id = nvl(p_enqu_id,0);
UPDATE document_roles
SET docu_id = l_doc_id
WHERE drwg_code = nvl(p_drwg_code
,'')
OR qute_id = nvl(p_qute_id
,0)
OR enqu_id = nvl(p_enqu_id
,0);
--set up an event for the document
insert into document_events(docu_id, dost_code,event_date,description,id)
values (l_doc_id,
'AWAIT SCAN',
sysdate,
p_description,
doev_seq.NEXTVAL);
INSERT INTO document_events
(docu_id
,dost_code
,event_date
,description
,id)
VALUES
(l_doc_id
,'AWAIT SCAN'
,SYSDATE
,p_description
,doev_seq.NEXTVAL);
--if it works then return true
return true;
end update_file_association;
RETURN TRUE;
END update_file_association;
/*
FUNCTION set_file_association
- sets the association between a object within webmip to a file held in the
@@ -231,55 +264,83 @@ pl('l_total_size:'||l_total_size);
%param p_drwg_code - the drawing code if applicable otherwise supply null
%param p_doro_type - DRRO (for a drawing), ENDO (for an enquiry), QUDO (for a quote)
*/
function set_file_association(p_uri in varchar2,
p_description in varchar2,
p_docu_type in varchar2,
p_rt_code in varchar2,
p_qute_id in number,
p_enqu_id in number,
p_drwg_code in varchar2,
p_doro_type in varchar2) return BOOLEAN is
l_doc_id number;
l_success boolean;
FUNCTION set_file_association(p_uri IN VARCHAR2
,p_description IN VARCHAR2
,p_docu_type IN VARCHAR2
,p_rt_code IN VARCHAR2
,p_qute_id IN NUMBER
,p_enqu_id IN NUMBER
,p_drwg_code IN VARCHAR2
,p_doro_type IN VARCHAR2) RETURN BOOLEAN IS
l_doc_id NUMBER;
l_success BOOLEAN;
BEGIN
pl('set_file_association, p_uri='||p_uri||', p_drwg_code='||p_drwg_code);
pl('set_file_association, p_uri=' || p_uri || ', p_drwg_code=' ||
p_drwg_code);
--reference it in the documents table
insert into documents( uri, description, id, docu_type )
values (p_uri,
p_description,
docu_seq.NEXTVAL,
p_docu_type)
returning id into l_doc_id;
INSERT INTO documents
(uri
,description
,id
,docu_type)
VALUES
(p_uri
,p_description
,docu_seq.NEXTVAL
,p_docu_type)
RETURNING id INTO l_doc_id;
--set up a role for the document
insert into document_roles(rt_code, start_date,description,qute_id,enqu_id,drwg_code,id,doro_type,docu_id)
values (p_rt_code,
sysdate,
p_description,
p_qute_id,
p_enqu_id,
p_drwg_code,
doro_seq.NEXTVAL,
p_doro_type,
l_doc_id);
INSERT INTO document_roles
(rt_code
,start_date
,description
,qute_id
,enqu_id
,drwg_code
,id
,doro_type
,docu_id)
VALUES
(p_rt_code
,SYSDATE
,p_description
,p_qute_id
,p_enqu_id
,p_drwg_code
,doro_seq.NEXTVAL
,p_doro_type
,l_doc_id);
--set up an event for the document
insert into document_events(docu_id, dost_code,event_date,description,id)
values (l_doc_id,
'AWAIT SCAN',
sysdate,
p_description,
doev_seq.NEXTVAL);
INSERT INTO document_events
(docu_id
,dost_code
,event_date
,description
,id)
VALUES
(l_doc_id
,'AWAIT SCAN'
,SYSDATE
,p_description
,doev_seq.NEXTVAL);
pl('check_file_sizes');
if (are_files_over_size_limit(p_enqu_id) or is_file_over_size_limit(p_uri)) and p_rt_code = 'ENQUIRY SUPPORTING DOC' and not p_enqu_id is null then
l_success := delete_file(l_doc_id,'REMOVED SIZE','webMIP determined the file or files to be too big');
IF p_rt_code = 'ENQUIRY SUPPORTING DOC'
AND NOT p_enqu_id IS NULL THEN
IF (are_files_over_size_limit(p_enqu_id) OR
is_file_over_size_limit(p_uri)) THEN
l_success := delete_file(l_doc_id
,'REMOVED SIZE'
,'webMIP determined the file or files to be too big');
pl('returning false');
return false;
else
RETURN FALSE;
END IF;
END IF;
--if it works then return true
pl('returning true');
return true;
end if;
end set_file_association;
RETURN TRUE;
END set_file_association;
/*
PROCEDURE export_data_to_csv
- allows an admin user to create a CSV export of a table in webMIP.
@@ -289,9 +350,9 @@ pl('l_total_size:'||l_total_size);
%param p_column_headers - tables column names be exported as a header
%param p_delimiter - what is the delimiter value is for each field (default ',')
*/
PROCEDURE export_table_to_csv(p_table IN VARCHAR2,
p_column_headers IN VARCHAR2,
p_delimiter IN VARCHAR2 DEFAULT ',') is
PROCEDURE export_table_to_csv(p_table IN VARCHAR2
,p_column_headers IN VARCHAR2
,p_delimiter IN VARCHAR2 DEFAULT ',') IS
l_select VARCHAR2(2000); --will hold our dynamically created sql query
l_cursor INTEGER DEFAULT dbms_sql.open_cursor; --a handle for the recordset we can then loop through
@@ -309,7 +370,8 @@ pl('l_total_size:'||l_total_size);
--
-- AG's clever delimiting ensures that the rows from the table are output
-- in a nice CSV format
l_select := l_select ||'''"''||'|| f.column_name || '||''"'||p_delimiter||'''||';
l_select := l_select || '''"''||' || f.column_name || '||''"' ||
p_delimiter || '''||';
--
-- Get the header row, slightly inefficient in that we may not need to
-- do it every time
@@ -319,10 +381,13 @@ pl('l_total_size:'||l_total_size);
--
-- Trim the unnecessary additional delimiting chars on the headers and
-- add a carriage return
l_headers := RTRIM(l_headers,p_delimiter) || CHR(13);
l_headers := rtrim(l_headers
,p_delimiter) || chr(13);
--
-- build the dynamic SQL that will return all the table rows
l_select := 'SELECT ' || RTRIM(l_select,'||') || CHR(13)||CHR(10) ||' FROM ' || p_table;
l_select := 'SELECT ' || rtrim(l_select
,'||') || chr(13) || chr(10) || ' FROM ' ||
p_table;
--
-- Now we have the select, let's execute it
--
@@ -336,16 +401,18 @@ pl('l_total_size:'||l_total_size);
,l_return
,4000);
--
l_status := dbms_sql.execute(l_cursor); --could be used for further manipulation
l_status := dbms_sql.EXECUTE(l_cursor); --could be used for further manipulation
--
WHILE (dbms_sql.fetch_rows(l_cursor) > 0) LOOP
--
IF l_found THEN
--
-- Set the header MIME type
owa_util.mime_header( 'application/octet', FALSE );
owa_util.mime_header('application/octet'
,FALSE);
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="'||lower(p_table)||'.csv"');
htp.p('Content-Disposition: attachment; filename="' ||
lower(p_table) || '.csv"');
-- Close the HTTP Header
owa_util.http_header_close;
--
@@ -353,10 +420,10 @@ pl('l_total_size:'||l_total_size);
--
-- If the user has requested that the tables column names be exported
-- then display them
if upper(p_column_headers) = 'YES' then
IF upper(p_column_headers) = 'YES' THEN
--print column headers
htp.p(l_headers);
end if;
END IF;
--
END IF;
--
@@ -371,5 +438,5 @@ pl('l_total_size:'||l_total_size);
--
END export_table_to_csv;
end MIP_FILES;
END mip_files;
/

View File

@@ -24,9 +24,9 @@ exec gen_mandatory
@@get_quote_items.fnc
@@mip_bulk_Load.pck
@@mip_tripartite.pck
@@mip_documents.pck
@@mip_virus_check.pck
@@mip_email.pck
@@mip_friendly_messages.pck
@@compile.sql
@@mip_documents.pck
exit

View File

@@ -5,6 +5,8 @@ PROMPT * Compile Schema
exec dbms_utility.compile_schema(USER)
exec dbms_utility.compile_schema(USER)
SET SCAN ON
SET DEFINE ON
SET ARRAYSIZE 1

View File

@@ -92,7 +92,7 @@ CREATE OR REPLACE PACKAGE BODY mip_friendly_messages IS
l_msg := l_ora_msg;
END IF;
htp.prn(l_msg);
return(l_msg);
END get_friendly_message;
END mip_friendly_messages;

View File

@@ -127,22 +127,20 @@ END mip_quotation;
/
CREATE OR REPLACE PACKAGE BODY mip_quotation IS
-- PROCEDURE email_aq_generated(p_enqu_id IN enquiries.id%TYPE);
PROCEDURE email_quotes_available(p_enqu_id IN enquiries.id%TYPE);
PROCEDURE email_rfq_submitted(p_enqu_id IN enquiries.id%TYPE);
-- PROCEDURE email_request_for_mq(p_enqu_id IN enquiries.id%TYPE);
PROCEDURE email_agent_aq_available(p_enqu_id IN enquiries.id%TYPE);
PROCEDURE email_agent_quote_acceptance(p_enqu_id enquiries.id%TYPE);
PROCEDURE email_agent_mq_available(p_enqu_id enquiries.id%TYPE);
PROCEDURE email_iu_quote_acceptance(p_enqu_id enquiries.id%TYPE);
PROCEDURE email_support(p_subject IN VARCHAR2
,p_enqu_id IN enquiries.id%TYPE);
SUBTYPE t_internal_or_external IS VARCHAR2(8);
gc_internal_reason CONSTANT t_internal_or_external := 'INTERNAL';
gc_external_reason CONSTANT t_internal_or_external := 'EXTERNAL';
SUBTYPE t_manual_or_automatic_quote IS VARCHAR2(2);
SUBTYPE t_enqu IS enquiries%ROWTYPE;
gc_manual_quote CONSTANT t_manual_or_automatic_quote := 'MQ';
gc_automatic_quote CONSTANT t_manual_or_automatic_quote := 'AQ';
@@ -150,6 +148,16 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
g_email_html_body CLOB;
gc_newline CONSTANT CHAR(2) DEFAULT chr(10) || chr(13);
SUBTYPE t_enqu IS enquiries%ROWTYPE;
SUBTYPE t_email_reason IS VARCHAR2(80);
gc_agent_rmq_notification t_email_reason := 'AGENT_RMQ_NOTIFICATION';
gc_agent_qa_notification t_email_reason := 'AGENT_QA_NOTIFICATION';
gc_agent_mqa_notification t_email_reason := 'AGENT_MQA_NOTIFICATION';
gc_internal_qa_notification t_email_reason := 'INTERNAL_QA_NOTIFICATION';
gc_internal_rmq_notification t_email_reason := 'AGENT_RMQ_NOTIFICATION';
TYPE t_rec_additional_costs IS RECORD(
adit_code additional_items.code%TYPE
,svcpt_code service_pressure_types.code%TYPE
@@ -237,6 +245,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
,p_description quote_events.description%TYPE DEFAULT NULL
,p_event_date IN DATE DEFAULT SYSDATE) IS
l_enqu_id enquiries.id%TYPE;
BEGIN
add_quote_event(p_qute_id => p_qute_id
,p_qust_code => 'ACCEPTED'
@@ -253,6 +262,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_prty_id => p_prty_id
,p_rt_code => 'Q SUBACC'
,p_start_date => p_event_date);
SELECT enqu_id
INTO l_enqu_id
FROM quotes
WHERE id = p_qute_id;
email_agent_quote_acceptance(p_enqu_id => l_enqu_id);
email_iu_quote_acceptance(p_enqu_id => l_enqu_id);
END accept_quote;
PROCEDURE reject_quote(p_qute_id IN quotes.id%TYPE
@@ -431,6 +449,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
END start_quote;
PROCEDURE make_quote_available(p_qute_id IN quotes.id%TYPE) IS
l_qute_type quotes.qute_type%TYPE;
l_enqu_id enquiries.id%TYPE;
BEGIN
pl('make_quote_available');
@@ -438,6 +458,19 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_qust_code => 'AV'
,p_event_date => SYSDATE);
SELECT qute_type
,enqu_id
INTO l_qute_type
,l_enqu_id
FROM quotes
WHERE id = p_qute_id;
IF l_qute_type = 'MQ' THEN
email_agent_mq_available(l_enqu_id);
ELSE
email_agent_aq_available(l_enqu_id);
END IF;
END make_quote_available;
PROCEDURE mark_enquiry_submitted(p_enqu_id IN enquiries.id%TYPE) IS
@@ -448,7 +481,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_enst_code => 'SUBMITTED'
,p_event_date => SYSDATE);
email_rfq_submitted(p_enqu_id);
END mark_enquiry_submitted;
PROCEDURE mark_enquiry_quoted(p_enqu_id IN enquiries.id%TYPE) IS
@@ -459,8 +491,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_enst_code => 'QUOTED'
,p_event_date => SYSDATE);
email_quotes_available(p_enqu_id);
END mark_enquiry_quoted;
PROCEDURE mark_enquiry_invalid(p_enqu_id IN enquiries.id%TYPE) IS
@@ -723,102 +753,133 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
END produce_reasoning_summary;
/* PROCEDURE email_aq_generated(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
open_body;
al('Quotations produced in response to Enquiry refererence: ' ||
p_enqu_id || ' (' || get_enty_description(p_enqu_id) || ')');
FOR l_qute IN (SELECT id
FROM quotes
,v_quote_details v
WHERE enqu_id = p_enqu_id
AND v.quote_id = id
ORDER BY total_cost) LOOP
produce_quote_summary(l_qute.id);
al(' ');
END LOOP;
produce_reasoning_summary(p_enqu_id);
close_body;
mip_email.send_email_clob(p_recipient => get_automatic_quote_recipient
,p_body => g_email_plain_body
,p_body_html => g_email_html_body
,p_subject => get_system_name ||
': Notification of generation of automatic quotes for Enquiry reference: ' ||
p_enqu_id);
END email_aq_generated;*/
PROCEDURE email_quotes_available(p_enqu_id IN enquiries.id%TYPE) IS
l_agent_comt_code enquiries.agent_comt_code%TYPE;
l_agent_contact_value enquiries.agent_contact_value%TYPE;
l_email_recipient system_configuration.VALUE%TYPE;
PROCEDURE email_to_agent(p_enqu_id IN enquiries.id%TYPE
,p_email_reason IN t_email_reason) IS
l_agent_prty_id parties.id%TYPE;
l_agent_comt_code contact_mechanism_types.code%TYPE;
l_agent_comt_description contact_mechanism_types.description%TYPE;
l_agent_contact_value contact_mechanisms.contact_value%TYPE;
l_email_subject VARCHAR2(240);
l_email_recipient VARCHAR2(240);
l_agent_first_name parties.first_name%TYPE;
l_agent_last_name parties.last_name%TYPE;
l_agent_prty_id parties.id%TYPE;
l_date_submitted DATE;
BEGIN
pl('email_quotes_available');
open_body;
SELECT agent_comt_code
,agent_contact_value
,event_date
INTO l_agent_comt_code
,l_agent_contact_value
,l_date_submitted
FROM enquiries
,enquiry_events
WHERE enquiries.id = p_enqu_id
AND enquiry_events.enqu_id = enquiries.id
AND enquiry_events.enst_code = 'SUBMITTED';
pl('email_to_agent:enter:p_enqu_id=' || p_enqu_id ||
', p_email_reason=' || p_email_reason);
BEGIN
l_agent_prty_id := mip_enquiry.get_enquiry_role(p_enquiryid => p_enqu_id
,p_rolecode => 'ENQ OWN');
EXCEPTION
WHEN OTHERS THEN
pl('mip_enquiry.get_enquiry_role returned ' || SQLERRM);
RAISE;
END;
SELECT agent_comt_code
,comt.description
,agent_contact_value
INTO l_agent_comt_code
,l_agent_comt_description
,l_agent_contact_value
FROM enquiries
,contact_mechanism_types comt
WHERE enquiries.id = p_enqu_id
AND comt.code = enquiries.agent_comt_code;
open_body;
IF l_agent_comt_code = 'EMAIL' THEN
l_email_recipient := l_agent_contact_value;
ELSE
l_email_recipient := get_automatic_quote_recipient;
SELECT first_name
,last_name
INTO l_agent_first_name
,l_agent_last_name
FROM parties
WHERE id = l_agent_prty_id;
IF l_agent_comt_code = 'EMAIL' THEN
l_email_recipient := l_agent_contact_value;
l_email_subject := get_system_name ||
': Confirmation of availability of quotation(s)';
al('Confirmation of availability of quotation.');
al(' ');
al('Thank you for using ' || get_system_name ||
' online. Your quotation(s) are now available.');
al(' ');
al('Enquiry refererence: ' || p_enqu_id || ' (' ||
get_enty_description(p_enqu_id) || ')');
al('Request made on: ' ||
to_char(l_date_submitted
,'ddth Month YYYY HH24:MI:SS'));
al(' ');
ELSE
l_email_recipient := get_automatic_quote_recipient;
l_email_subject := get_system_name ||
': Confirmation of availability of quotation(s), Agent requires notification.';
al('Enquiry refererence: ' || p_enqu_id || ' (' ||
get_enty_description(p_enqu_id) || ')');
al('Request made on: ' ||
to_char(l_date_submitted
,'ddth Month YYYY HH24:MI:SS'));
al(' ');
al('The Agent, ' || l_agent_first_name || ' ' || l_agent_last_name ||
' has requested that they be contacted via ' || l_agent_comt_code || '(' ||
l_agent_contact_value || ')');
' has requested that they be contacted via ' ||
l_agent_comt_description || '(' || l_agent_contact_value || ')');
al(' ');
al('The information to be passed on is:');
al(' ');
END IF;
IF p_email_reason = gc_agent_qa_notification THEN
l_email_subject := get_system_name || ': Quote Acceptance';
al('Dear Sir/Madam,');
al(' ');
al('Enquiry reference number: ' || p_enqu_id);
al(' ');
al('Thank you for accepting National Grid Metering<6E>s quotation using the Online I&C Quotations System. We will acknowledge your acceptance and provide you with a planning letter within the agreed timescales for the work type involved. ');
al(' ');
al('Please use the Enquiry reference number at the top of this email on any future correspondence relating to this request.');
al(' ');
al('For further information or clarity, please do not hesitate to get in contact');
al(' ');
al('Regards');
al(' ');
al('The I&C Non Standard Team');
al('National Grid Metering');
al('Abbotts Lane');
al('Coventry');
al('CV1 4AY');
al(' ');
al('Phone: 02476 286 322');
al('Fax: 02476 286 044');
al('Email: ic.nonstandard1@uk.ngrid.com');
ELSIF p_email_reason = gc_agent_rmq_notification THEN
l_email_subject := get_system_name || ': Request for Manual Quote';
al('Dear Sir/Madam,');
al(' ');
al('Enquiry reference number: ' || p_enqu_id);
al(' ');
al('Thank you for requesting a quotation using the National Grid Metering Online I&C Quotations System. There are no automatic quotations available for this request, and a manual quotation will be prepared and uploaded to the website within the agreed timescales for the work type involved. We will notify you when this quotation is ready for your consideration.');
al(' ');
al('Please use the Enquiry reference number at the top of this email on any future correspondence relating to this request.');
al(' ');
al('Regards');
al(' ');
al('The I&C Non Standard Team');
al('National Grid Metering');
al('Abbotts Lane');
al('Coventry');
al('CV1 4AY');
al(' ');
al('Phone: 02476 286 322');
al('Fax: 02476 286 044');
al('Email: ic.nonstandard1@uk.ngrid.com');
ELSIF p_email_reason = gc_agent_mqa_notification THEN
l_email_subject := get_system_name || ': Manual Quote Available';
al('Dear Sir/Madam,');
al(' ');
al('Enquiry reference number: ' || p_enqu_id);
al(' ');
al('Your quotation is now ready to view on the National Grid Metering I&C Online Quotation System.');
al(' ');
al('Please note that this quotation is valid for 90 days from the date specified in the quotation. To accept this quotation, please submit a work request via IX, complete the acceptance form on the quotation letter, or click the accept button on the Online I&C quotations system. Please note that this quotation is valid for 90 days from the date specified in the quotation.');
al(' ');
al('Please use the Enquiry reference number at the top of this email on any future correspondence relating to this request.');
al(' ');
al('Regards');
al(' ');
al('The I&C Non Standard Team');
al('National Grid Metering');
al('Abbotts Lane');
al('Coventry');
al('CV1 4AY');
al(' ');
al('Phone: 02476 286 322');
al('Fax: 02476 286 044');
al('Email: ic.nonstandard1@uk.ngrid.com');
ELSIF p_email_reason = gc_agent_qa_notification THEN
l_email_subject := get_system_name || ': Automatic Quote Available';
al('Dear Sir/Madam,');
al(' ');
al('Enquiry reference number: ' || p_enqu_id);
al(' ');
al('Thank you for using the National Grid Metering Online I&C quotations system. Your enquiry has generated an automatic quotation. To accept this quotation; either submit a work request via IX, complete the acceptance form on the quotation letter, or click the accept button on the Online I&C quotations system. Please note that this quotation is valid for 90 days from the date specified in the quotation.');
al(' ');
al('The following quotations are available:');
@@ -837,106 +898,20 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
al(' ');
END LOOP;
close_body;
BEGIN
mip_email.send_email_clob(p_recipient => l_email_recipient
,p_body => g_email_plain_body
,p_body_html => g_email_html_body
,p_subject => l_email_subject);
EXCEPTION
WHEN OTHERS THEN
pl('mip_email.send_email_clob returned ' || SQLERRM);
END;
pl('email_quotes_available:exit');
END email_quotes_available;
PROCEDURE email_rfq_submitted(p_enqu_id IN enquiries.id%TYPE) IS
l_agent_comt_code enquiries.agent_comt_code%TYPE;
l_agent_contact_value enquiries.agent_contact_value%TYPE;
l_email_recipient system_configuration.VALUE%TYPE;
l_email_subject VARCHAR2(240);
l_agent_first_name parties.first_name%TYPE;
l_agent_last_name parties.last_name%TYPE;
l_agent_prty_id parties.id%TYPE;
l_date_submitted DATE;
BEGIN
pl('email_rfq_submitted');
open_body;
SELECT agent_comt_code
,agent_contact_value
,event_date
INTO l_agent_comt_code
,l_agent_contact_value
,l_date_submitted
FROM enquiries
,enquiry_events
WHERE enquiries.id = p_enqu_id
AND enquiry_events.enqu_id = enquiries.id
AND enquiry_events.enst_code = 'SUBMITTED';
BEGIN
l_agent_prty_id := mip_enquiry.get_enquiry_role(p_enquiryid => p_enqu_id
,p_rolecode => 'ENQ OWN');
EXCEPTION
WHEN OTHERS THEN
pl('mip_enquiry.get_enquiry_role returned ' || SQLERRM);
RAISE;
END;
BEGIN
SELECT first_name
,last_name
INTO l_agent_first_name
,l_agent_last_name
FROM parties
WHERE id = l_agent_prty_id;
EXCEPTION
WHEN OTHERS THEN
pl('Error finding agent - prty_id=' || l_agent_prty_id);
END;
IF l_agent_comt_code = 'EMAIL' THEN
l_email_recipient := l_agent_contact_value;
l_email_subject := get_system_name ||
': Confirmation of Request for Quotation';
al('Confirmation of Request for Quotation');
al('Please use the Enquiry reference number at the top of this email on any future correspondence relating to this request.');
al(' ');
al('Thank you for using ' || get_system_name ||
' online. Your request for quotation has been received.');
al('Regards');
al(' ');
al('Enquiry Refererence Number: ' || p_enqu_id || ' (' ||
get_enty_description(p_enqu_id) || ')');
al('Request made on: ' ||
to_char(l_date_submitted
,'ddth Month YYYY HH24:MI:SS'));
al(' ');
al('You should receive notification of your quotation(s) within 6 days.');
al(' ');
al('Should notification of your quotation(s) not arrive after 6 days, then please phone us on ' ||
get_customer_support_telephone ||
'. Be prepared to quote the Enquiry Reference Number.');
ELSE
l_email_recipient := get_automatic_quote_recipient;
l_email_subject := get_system_name ||
': Confirmation of Request for Quotation, Agent requires notification.';
al('Enquiry Refererence Number: ' || p_enqu_id || ' (' ||
get_enty_description(p_enqu_id) || ')');
al('Request made on: ' ||
to_char(l_date_submitted
,'ddth Month YYYY HH24:MI:SS'));
al(' ');
al('The Agent, ' || l_agent_first_name || ' ' || l_agent_last_name ||
' has requested that they be contacted via ' || l_agent_comt_code || '(' ||
l_agent_contact_value || ')');
al('The I&C Non Standard Team');
al('National Grid Metering');
al('Abbotts Lane');
al('Coventry');
al('CV1 4AY');
al(' ');
al('Phone: 02476 286 322');
al('Fax: 02476 286 044');
al('Email: ic.nonstandard1@uk.ngrid.com');
END IF;
close_body;
BEGIN
@@ -947,62 +922,131 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
EXCEPTION
WHEN OTHERS THEN
pl('mip_email.send_email_clob returned ' || SQLERRM);
RAISE;
END;
END email_rfq_submitted;
pl('email_to_agent:exit');
END email_to_agent;
PROCEDURE email_request_for_mq(p_enqu_id IN enquiries.id%TYPE) IS
PROCEDURE email_to_internal_users(p_enqu_id IN enquiries.id%TYPE
,p_email_reason IN t_email_reason) IS
l_email_subject VARCHAR2(240);
l_email_recipient VARCHAR2(240);
l_qute_id quotes.id%TYPE;
BEGIN
pl('email_internal_users:entry:p_enqu_id=' || p_enqu_id ||
', p_email_reason=' || p_email_reason);
open_body;
IF p_email_reason = gc_internal_qa_notification THEN
l_email_subject := get_system_name ||
': Quote Acceptance Notification';
al('Hi team,');
al(' ');
al('Enquiry reference number: ' || p_enqu_id);
al(' ');
al('Please process this enquiry, as the quotation has been accepted.');
al(' ');
SELECT qute_id
INTO l_qute_id
FROM quote_events quev
,quotes qute
WHERE qute.enqu_id = p_enqu_id
AND quev.qute_id = qute.id
AND quev.qust_code = 'ACCEPTED';
produce_enquiry_entry_details(p_enqu_id);
produce_quote_summary(l_qute_id);
al(' ');
al('Regards');
al(' ');
al('I&C Online Quotations System');
ELSIF p_email_reason = gc_internal_rmq_notification THEN
l_email_subject := get_system_name ||
': Request For Manual Quotation Notification';
al('Hi team,');
al(' ');
al('Enquiry reference number: ' || p_enqu_id);
al(' ');
al('Please provide a manual quotation as the I&C Online Quotation System was unable to generate an automatic quote.');
al(' ');
SELECT qute_id
INTO l_qute_id
FROM quote_events quev
,quotes qute
WHERE qute.enqu_id = p_enqu_id
AND quev.qute_id = qute.id
AND quev.qust_code = 'INP';
produce_enquiry_entry_details(p_enqu_id);
produce_reasoning_summary(p_enqu_id);
al(' ');
al('Regards');
al(' ');
al('I&C Online Quotations System');
END IF;
close_body;
BEGIN
mip_email.send_email_clob(p_recipient => l_email_recipient
,p_body => g_email_plain_body
,p_body_html => g_email_html_body
,p_subject => l_email_subject);
EXCEPTION
WHEN OTHERS THEN
pl('mip_email.send_email_clob returned ' || SQLERRM);
END;
pl('email_internal_users:exit');
END email_to_internal_users;
PROCEDURE email_agent_aq_available(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
pl('email_agent_aq_available:entry');
email_to_agent(p_enqu_id => p_enqu_id
,p_email_reason => gc_agent_qa_notification);
pl('email_agent_aq_available:exit');
END email_agent_aq_available;
PROCEDURE email_agent_mq_available(p_enqu_id enquiries.id%TYPE) IS
BEGIN
email_to_agent(p_enqu_id => p_enqu_id
,p_email_reason => gc_agent_mqa_notification);
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');
pl('email_request_for_mq:enter');
SELECT *
INTO l_quote_row
FROM quotes
WHERE enqu_id = p_enqu_id;
email_to_agent(p_enqu_id => p_enqu_id
,p_email_reason => gc_agent_rmq_notification);
open_body;
email_to_internal_users(p_enqu_id => p_enqu_id
,p_email_reason => gc_internal_rmq_notification);
al('This email has been produced in response to Enquiry Refererence Number: ' ||
p_enqu_id || ' (' || get_enty_description(p_enqu_id) || ')');
al(' ');
al(l_system_name ||
' was unable to produce an automatic quote for this Enquiry, therefore a ' ||
'Manual Quote is to be completed against Quote Reference Number: ' ||
l_quote_row.id);
al('This quote will be valid from ' ||
to_char(l_quote_row.valid_from
,'ddth Month YYYY') || ' to ' ||
to_char(l_quote_row.valid_until
,'ddth Month YYYY'));
al(' ');
al('Current Service Level Agreements dictate that a manual quote be provided within 6 days');
al('Data Entered:');
al('Enquiry type: ' || get_enty_description(p_enqu_id));
produce_enquiry_entry_details(p_enqu_id);
produce_reasoning_summary(p_enqu_id);
close_body;
pl('email_request_for_mq:exit');
END email_agent_request_for_mq;
PROCEDURE email_agent_quote_acceptance(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
mip_email.send_email_clob(p_recipient => get_manual_quote_recipient
,p_body => g_email_plain_body
,p_body_html => g_email_html_body
,p_subject => l_system_name ||
': Request for a Manual Quote for Enquiry Reference Number: ' ||
p_enqu_id);
EXCEPTION
WHEN OTHERS THEN
pl('mip_email.send_email_clob returned ' || SQLERRM);
END;
email_to_agent(p_enqu_id => p_enqu_id
,p_email_reason => gc_agent_qa_notification);
END email_agent_quote_acceptance;
END email_request_for_mq;
PROCEDURE email_iu_quote_acceptance(p_enqu_id enquiries.id%TYPE) IS
BEGIN
email_to_internal_users(p_enqu_id
,gc_internal_qa_notification);
END email_iu_quote_acceptance;
PROCEDURE email_iu_request_for_mq(p_enqu_id enquiries.id%TYPE) IS
BEGIN
email_to_internal_users(p_enqu_id
,gc_internal_rmq_notification);
END email_iu_request_for_mq;
PROCEDURE email_support(p_subject IN VARCHAR2
,p_enqu_id IN enquiries.id%TYPE) IS
@@ -1050,8 +1094,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_rfq_prty_id => p_rfq_prty_id
,p_owner_prty_id => p_owner_prty_id);
email_request_for_mq(p_enqu_id => p_enqu_id);
email_agent_request_for_mq(p_enqu_id => p_enqu_id);
email_iu_request_for_mq(p_enqu_id => p_enqu_id);
END request_manual_quote;
PROCEDURE ready_for_quote(p_enqu_id IN enquiries.id%TYPE
@@ -1225,7 +1269,6 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
PROCEDURE survey_required(p_enqu IN t_enqu
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
l_svcpt_code service_pressure_types.code%TYPE;
l_existing_meter_size_code meter_size_codes.code%TYPE;
l_required_meter_size_code meter_size_codes.code%TYPE;
BEGIN
@@ -1578,8 +1621,15 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,l_rec_costs.svcpt_code
FROM (SELECT decode(regi_code
,p_regi_code
,0
,1) * 100 + decode(cost.svcpt_code
,NULL
,1
,999) AS accuracy
,0) * 10 +
decode(cost.mesc_code
,NULL
,1
,0) AS accuracy
,enty_code
,mety_code
,cost.svcpt_code
@@ -1593,13 +1643,11 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,service_pressures svcp
WHERE SYSDATE BETWEEN cost.effective_from AND cost.effective_to
AND (regi_code = p_regi_code OR regi_code IS NULL)
AND cost.svcpt_code = svcp.svcpt_code
AND cost.svcpt_code(+) = svcp.svcpt_code
AND enty_code = p_enty_code
AND mety_code = p_mety_code
AND ((svcp.code = p_svcp_code) OR
(svcp.code IS NULL AND p_svcp_code IS NULL))
AND ((mesc_code = p_mesc_code) OR
(mesc_code IS NULL AND p_mesc_code IS NULL))
AND svcp.code = p_svcp_code
AND ((cost.mesc_code = p_mesc_code) OR (mesc_code IS NULL))
ORDER BY 1)
WHERE rownum < 2;
@@ -2802,7 +2850,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_manual_or_automatic_quote => l_manual_or_automatic_quote);
IF l_manual_or_automatic_quote = gc_automatic_quote THEN
mark_enquiry_quoted(p_enqu_id);
email_quotes_available(p_enqu_id);
email_agent_aq_available(p_enqu_id);
ELSE
request_manual_quote(p_enqu_id => l_enqu.id
,p_rfq_prty_id => p_rfq_prty_id

View File

@@ -1,6 +1,6 @@
-- C:\Andy\svn\WEBMIP\Schema\mip.con
--
-- Generated for Oracle 10g on Thu Feb 21 11:43:47 2008 by Server Generator 10.1.2.6.18
-- Generated for Oracle 10g on Tue Feb 26 13:19:31 2008 by Server Generator 10.1.2.6.18
PROMPT Creating Primary Key on 'SYSTEM_CONFIGURATION'
ALTER TABLE SYSTEM_CONFIGURATION
@@ -501,28 +501,28 @@ ALTER TABLE REGI_ENQU_EXCLUSIONS
PROMPT Creating Check Constraint on 'METER_SIZE_CODES'
ALTER TABLE METER_SIZE_CODES
ADD (CONSTRAINT AVCON_1203594226_VALID_000 CHECK (VALID_FOR_EXISTING_METER IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_VALID_000 CHECK (VALID_FOR_EXISTING_METER IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'METER_SIZE_CODES'
ALTER TABLE METER_SIZE_CODES
ADD (CONSTRAINT AVCON_1203594226_VALID_001 CHECK (VALID_FOR_NEW_METER IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_VALID_001 CHECK (VALID_FOR_NEW_METER IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'COSTS'
ALTER TABLE COSTS
ADD (CONSTRAINT AVCON_1203594226_COST__000 CHECK (COST_TYPE
ADD (CONSTRAINT AVCON_1204031970_COST__000 CHECK (COST_TYPE
IN ('LACO', 'BACO', 'MOCO', 'MECO', 'AICO', 'HOCO', 'COST')))
/
PROMPT Creating Check Constraint on 'DOCUMENTS'
ALTER TABLE DOCUMENTS
ADD (CONSTRAINT AVCON_1203594226_DOCU__000 CHECK (DOCU_TYPE IN ('DOCU', 'INDO', 'EXDO', 'FIDO')))
ADD (CONSTRAINT AVCON_1204031970_DOCU__000 CHECK (DOCU_TYPE IN ('DOCU', 'INDO', 'EXDO', 'FIDO')))
/
PROMPT Creating Check Constraint on 'QUOTES'
ALTER TABLE QUOTES
ADD (CONSTRAINT AVCON_1203594226_QUTE__000 CHECK (QUTE_TYPE IN ('AQ', 'MQ', 'QUTE')))
ADD (CONSTRAINT AVCON_1204031970_QUTE__000 CHECK (QUTE_TYPE IN ('AQ', 'MQ', 'QUTE')))
/
PROMPT Creating Check Constraint on 'PARTY_RELATIONSHIPS'
@@ -534,17 +534,17 @@ to_parl_rt_code = to_prtp_rt_code))
PROMPT Creating Check Constraint on 'PARTIES'
ALTER TABLE PARTIES
ADD (CONSTRAINT AVCON_1203594226_TRIPA_000 CHECK (TRIPARTITE_MEMBER IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_TRIPA_000 CHECK (TRIPARTITE_MEMBER IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'PARTIES'
ALTER TABLE PARTIES
ADD (CONSTRAINT AVCON_1203594226_STATU_000 CHECK (STATUS IN ('OPEN', 'EXPIRED', 'LOCKED')))
ADD (CONSTRAINT AVCON_1204031970_STATU_000 CHECK (STATUS IN ('OPEN', 'EXPIRED', 'LOCKED')))
/
PROMPT Creating Check Constraint on 'PARTIES'
ALTER TABLE PARTIES
ADD (CONSTRAINT AVCON_1203594226_PRTY__000 CHECK (PRTY_TYPE
ADD (CONSTRAINT AVCON_1204031970_PRTY__000 CHECK (PRTY_TYPE
IN ('PRTY', 'IO', 'EO', 'MKTP', 'PERS', 'MANU', 'NEMP', 'EMP', 'ORG'
)))
/
@@ -562,82 +562,82 @@ OR
PROMPT Creating Check Constraint on 'DOCUMENT_ROLES'
ALTER TABLE DOCUMENT_ROLES
ADD (CONSTRAINT AVCON_1203594226_DORO__000 CHECK (DORO_TYPE IN ('DRRO', 'DORO', 'ENDO', 'QUDO')))
ADD (CONSTRAINT AVCON_1204031970_DORO__000 CHECK (DORO_TYPE IN ('DRRO', 'DORO', 'ENDO', 'QUDO')))
/
PROMPT Creating Check Constraint on 'QUOTE_ITEMS'
ALTER TABLE QUOTE_ITEMS
ADD (CONSTRAINT AVCON_1203594226_QUIT__000 CHECK (QUIT_TYPE IN ('LQI', 'AQI', 'BQI', 'MQI', 'QUIT', 'HQI')))
ADD (CONSTRAINT AVCON_1204031970_QUIT__000 CHECK (QUIT_TYPE IN ('LQI', 'AQI', 'BQI', 'MQI', 'QUIT', 'HQI')))
/
PROMPT Creating Check Constraint on 'ROLE_TYPES'
ALTER TABLE ROLE_TYPES
ADD (CONSTRAINT AVCON_1203594226_RT_TY_000 CHECK (RT_TYPE IN ('DORT', 'PART', 'RT', 'PCMRT', 'QURT', 'ENRT', 'PRT')))
ADD (CONSTRAINT AVCON_1204031970_RT_TY_000 CHECK (RT_TYPE IN ('DORT', 'PART', 'RT', 'PCMRT', 'QURT', 'ENRT', 'PRT')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_DOWNS_000 CHECK (DOWNSTREAM_BOOSTER_OR_COMPRESS IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_DOWNS_000 CHECK (DOWNSTREAM_BOOSTER_OR_COMPRESS IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_INDIC_000 CHECK (INDICATIVE_TIME IN ('DY', 'AM', 'PM')))
ADD (CONSTRAINT AVCON_1204031970_INDIC_000 CHECK (INDICATIVE_TIME IN ('DY', 'AM', 'PM')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_HOUSI_000 CHECK (HOUSING_REQUIRED IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_HOUSI_000 CHECK (HOUSING_REQUIRED IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_BASE__000 CHECK (BASE_REQUIRED IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_BASE__000 CHECK (BASE_REQUIRED IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_CONVE_000 CHECK (CONVERTOR_REQUIRED IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_CONVE_000 CHECK (CONVERTOR_REQUIRED IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_AMR_R_000 CHECK (AMR_REQUIRED IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_AMR_R_000 CHECK (AMR_REQUIRED IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_EMS_R_000 CHECK (EMS_REQUIRED IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_EMS_R_000 CHECK (EMS_REQUIRED IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_TWIN__000 CHECK (TWIN_STREAM_REQUIRED IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_TWIN__000 CHECK (TWIN_STREAM_REQUIRED IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_EXIST_000 CHECK (EXISTING_LOGGER IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_EXIST_000 CHECK (EXISTING_LOGGER IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_LOAD__000 CHECK (LOAD_CONTROL_TYPE IN ('Constant', 'On/Off', 'Modulating')))
ADD (CONSTRAINT AVCON_1204031970_LOAD__000 CHECK (LOAD_CONTROL_TYPE IN ('Constant', 'On/Off', 'Modulating')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_EXIST_001 CHECK (EXISTING_METER_OWNER IN ('S', 'T', 'C')))
ADD (CONSTRAINT AVCON_1204031970_EXIST_001 CHECK (EXISTING_METER_OWNER IN ('S', 'T', 'C')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_EXIST_002 CHECK (EXISTING_CONVERTOR IN ('YES', 'NO')))
ADD (CONSTRAINT AVCON_1204031970_EXIST_002 CHECK (EXISTING_CONVERTOR IN ('YES', 'NO')))
/
PROMPT Creating Check Constraint on 'ENQUIRIES'
ALTER TABLE ENQUIRIES
ADD (CONSTRAINT AVCON_1203594226_MARKE_000 CHECK (MARKET_SECTOR_CODE IN ('I', 'D')))
ADD (CONSTRAINT AVCON_1204031970_MARKE_000 CHECK (MARKET_SECTOR_CODE IN ('I', 'D')))
/
PROMPT Creating Check Constraint on 'REGI_ENQU_EXCLUSIONS'

View File

@@ -1,6 +1,6 @@
-- C:\Andy\svn\WEBMIP\Schema\mip.ind
--
-- Generated for Oracle 10g on Thu Feb 21 11:43:47 2008 by Server Generator 10.1.2.6.18
-- Generated for Oracle 10g on Tue Feb 26 13:19:31 2008 by Server Generator 10.1.2.6.18
PROMPT Creating Index 'REGU_RETY_FK_I'

View File

@@ -1,6 +1,6 @@
-- C:\Andy\svn\WEBMIP\Schema\mip.sql
--
-- Generated for Oracle 10g on Thu Feb 21 11:43:47 2008 by Server Generator 10.1.2.6.18
-- Generated for Oracle 10g on Tue Feb 26 13:19:31 2008 by Server Generator 10.1.2.6.18
SPOOL mip.lst

View File

@@ -1,6 +1,6 @@
-- C:\Andy\svn\WEBMIP\Schema\mip.sqs
--
-- Generated for Oracle 10g on Thu Feb 21 11:43:47 2008 by Server Generator 10.1.2.6.18
-- Generated for Oracle 10g on Tue Feb 26 13:19:31 2008 by Server Generator 10.1.2.6.18
PROMPT Creating Sequence 'FLTR_SEQ'
CREATE SEQUENCE FLTR_SEQ

View File

@@ -1,6 +1,6 @@
-- C:\Andy\svn\WEBMIP\Schema\mip.tab
--
-- Generated for Oracle 10g on Thu Feb 21 11:43:46 2008 by Server Generator 10.1.2.6.18
-- Generated for Oracle 10g on Tue Feb 26 13:19:30 2008 by Server Generator 10.1.2.6.18
@@ -444,16 +444,16 @@ CREATE TABLE METERS
(CODE VARCHAR2(80) NOT NULL
,METY_CODE VARCHAR2(80) NOT NULL
,PRTY_ID NUMBER NOT NULL
,DIM_A NUMBER NOT NULL
,DIM_B NUMBER NOT NULL
,DIM_C NUMBER NOT NULL
,CENTRES NUMBER NOT NULL
,WEIGHT NUMBER NOT NULL
,QMAX NUMBER NOT NULL
,DRWG_CODE VARCHAR2(80)
,DIM_A NUMBER
,DIM_B NUMBER
,DIM_C NUMBER
,CENTRES NUMBER
,WEIGHT NUMBER
,QMIN NUMBER NOT NULL
,QNOM NUMBER NOT NULL
,VALID_FROM DATE NOT NULL
,DRWG_CODE VARCHAR2(80)
,VALID_TO DATE
)
/