diff --git a/Data/BulkLoad/DATAITEM_ROLES.csv b/Data/BulkLoad/DATAITEM_ROLES.csv
index 18f9d01..113ef69 100644
--- a/Data/BulkLoad/DATAITEM_ROLES.csv
+++ b/Data/BulkLoad/DATAITEM_ROLES.csv
@@ -1,86 +1,86 @@
-COLUMN_NAME ,Appendix Reference,INSTALL,STD INSTALL,OFMAT,EXCHANGE,STD EXCHANGE,REMOVE,STD REMOVE,ADVERSARIAL,ALTERATION,CHANGE CAPACITY,"ADDONS(EMS,AMR)",OTHER,Notes,DisplaySequence
-ACCESS_ADDITIONAL,Site Detail.Access Instructions,O,O,O,O,O,O,O,O,O,O,O,O,,61
-ACCESS_PASSWORD,Site Detail.Access Password,O,O,O,O,O,O,O,O,O,O,O,O,,62
-AGENT_COMT_CODE,Supplier Agent.Telephone1/Telephone2/Fax/Email,M,M,M,M,M,M,M,M,M,M,M,M,,68
-AGENT_CONTACT_VALUE,Supplier Agent.Telephone1/Telephone2/Fax/Email,M,M,M,M,M,M,M,M,M,M,M,M,,69
-ALTY_CODE,Site Detail.Asset Location Code,M,M,M,M,M,M,M,M,M,M,M,M,,64
-AMR_REQUIRED,Job Information.Additional Services.AMR,O-M5,O-M5,H,O-M5,O-M5,H,H,H,O-M5,O-M5,O-M5,O-M5,"The AMR may only be available for the Tripartite suppliers or BG, GW to confirm!",25
-ANNUAL_QUANTITY,Job Information.Annual Quantity,O,O,O,O,O,H,H,H,O,O,O,O,if > 732 mwh go bespoke,32
-ASSET_LOCATION_NOTES,Site Detail.Asset Location Notes,O,O,O,O,O,O,O,O,O,O,O,O,,65
-BASE_REQUIRED,Job Information.Additional Services.Base,M,M,H,M,M,H,H,H,M,M,H,M,,26
-BYPASS_REQUIRED,Job Information.Additional Services.By-pass,O,O,H,O,O,H,H,H,O,O,O,O,"If yes, warn user if twin stream is no",27
-CACA_CODE,Site Detail.Care Category,O,O,O,O,O,O,O,O,O,O,O,O,,66
-CONVERTOR_REQUIRED,Job Information.Additional Services.Convertor,M,M,H,M,M,H,H,H,M,M,M,M,this can be an add-on for removals,28
-CREATED_ON,,,,,,,,,,,,,,,
-DOWNSTREAM_BOOSTER_OR_COMPRESS,Job Information.Booster/Compressor,M,M,M,M,M,H,H,H,M,M,M,M,,34
-EMS_REQUIRED,Job Information.Additional Services.EMS,M,M,H,M,M,H,H,H,M,M,M,M,,29
-ENTY_CODE,Job Information.Job Type,M,M,M,M,M,M,M,M,M,M,M,M,,43
-EXISTING_CONVERTOR,Job Information.Existing Convertor,H,H,O,M,M,M,M,M,O,O,O,O,,72
-EXISTING_LOGGER,Job Information.Logger,H,H,H,O,O,O,O,O,O,O,O,O,,71
-EXISTING_PRTY_ID,Job Information.Existing Manufacturer,H,H,M,M,M,M,M,M,O,O,O,O,,
-EXISTING_MESC_CODE,Job Information.Existing Meter Size,H,H,M,M,M,M,M,M,M,M,O,O,,36
-EXISTING_METER_ASSET_PROVIDER,Job Information.Supplier / Job Information.Consumer(Meter Asset Manager),O,O,O,O,O,O,O,O,O,O,O,O,,54
-EXISTING_METR_CODE,Job Information.Model Code,H,H,M,M,M,M,M,M,O,O,O,O,,49
-EXISTING_METER_OWNER,Job Information.Gas Act Owner,O,O,M,M,M,M,M,M,M,M,M,O,,38
-EXISTING_METER_SERIAL_NO,Job Information.Existing Asset Serial Number,H,H,M,M,M,M,M,M,M,M,M,O,,35
-EXISTING_METY_CODE,Job Information.Meter Type Existing ,H,H,M,M,M,M,M,M,M,M,O,O,,37
-FIRST_ALT_BUILDING,Contact Address.Building,O,O,O,O,O,O,O,O,O,O,O,O,,7
-FIRST_ALT_CITY,Contact Address.City,O,O,O,O,O,O,O,O,O,O,O,O,,8
-FIRST_ALT_POSTCODE,Contact Address.Post Code,O,O,O,O,O,O,O,O,O,O,O,O,,13
-FIRST_ALT_STREET,Contact Address.Street,O,O,O,O,O,O,O,O,O,O,O,O,,19
-FIRST_ALT_SUB_BUILDING,Contact Address.Sub Building,O,O,O,O,O,O,O,O,O,O,O,O,,20
-FIRST_CONTACT_EMAIL,Contact Address.Email,O,O,O,O,O,O,O,O,O,O,O,O,,9
-FIRST_CONTACT_FAX,Contact Address.Fax,O,O,O,O,O,O,O,O,O,O,O,O,,11
-FIRST_CONTACT_INITIALS,Contact Address.Contact Initials,O,O,O,O,O,O,O,O,O,O,O,O,,18
-FIRST_CONTACT_NAME,Address.Contact Name,M,M,M,M,M,M,M,M,M,M,M,M,,3
-FIRST_CONTACT_TELEPHONE_1,Contact Address.Telephone1,M,M,M,M,M,M,M,M,M,M,M,M,,21
-FIRST_CONTACT_TELEPHONE_2,Contact Address.Telephone2,O,O,O,O,O,O,O,O,O,O,O,O,,23
-FIRST_CONTACT_TITLE,Contact Address.Contact Title,O,O,O,O,O,O,O,O,O,O,O,O,,17
-HOUSING_REQUIRED,Job Information.Additional Services.Housing,M,M,H,M,M,H,H,H,M,M,H,M,,30
-ID,Enquiry Reference (not in spec appendix),M,M,M,M,M,M,M,M,M,M,M,M,,70
-INDICATIVE_DATE,Job Information.Indicative Substantial Completion Date,O,O,O,O,O,O,O,O,O,O,O,O,,39
-INDICATIVE_TIME,Job Information.Appointment Preference,O,O,O,O,O,O,O,O,O,O,O,O,,33
-INSTALL_BUILDING,Address.Building,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,,1
-INSTALL_CITY,Address.City,M,M,M,M,M,M,M,M,M,M,M,M,,2
-INSTALL_POSTCODE,Address.Post Code,M,M,M,M,M,M,M,M,M,M,M,M,,4
-INSTALL_STREET,Address.Street,M,M,M,M,M,M,M,M,M,M,M,M,,5
-INSTALL_SUB_BUILDING,Address.Sub Building,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,O-M1,,6
-JOB_DESCRIPTION,Job Information.Job Description,O,O,O,O,O,O,O,O,O,O,O,O,,42
-LOAD_CONTROL_TYPE,Job Information.Load Control Type,M,M,H,M,M,H,H,H,O,M,O,O,,44
-MARKET_SECTOR_CODE,Job Information.Market Sector Code,O,O,O,O,O,O,O,O,O,O,O,O,,45
-MPRN,Site Detail.MPRN,O-M4,O-M4,M,M,M,M,M,M,M,M,M,O,,67
-MPRN_ALT,Site Detail.Additional Information,O-M4,O-M4,O,O,O,O,O,O,O,O,O,O,,63
-OTHER_INFORMATION,Job Information.Other Information,O,O,O,O,O,O,O,O,O,O,O,O,,50
-OTHER_PROJECT_REFERENCE,Job Information.Other Related Projects,O,O,O,O,O,O,O,O,O,O,O,O,,51
-QMAX,Job Information.Measuring Capacity Qmax,M,O-M2,O,M,O-M2,O,O,O,O,M,O,O,,46
-QMIN,Job Information.Measuring Capacity Qmin,O,O,O,O,O,O,O,O,O,O,O,O,,47
-REQUIRED_IP_DETAILS,Job Information.IP Details,O-M3,H,O-M3,O-M3,H,O-M3,H,O-M3,O-M3,O-M3,O-M3,O-M3,if service pressure is IP,40
-REQUIRED_IP_MBAR,Job Information.IP Mbar,O-M3,H,O-M3,O-M3,H,O-M3,H,O-M3,O-M3,O-M3,O-M3,O-M3,if service pressure is IP,41
-REQUIRED_MESC_CODE,Job Information.Meter Size,H,O-M2,H,H,O-M2,H,H,H,H,O,H,O,,48
-REQUIRED_METERING_PRESSURE,Job Information.Required Meter Pressure,M,M,M,M,M,M,M,M,M,M,O,O,,52
-REQUIRED_SVCP_CODE,Job Information.Service Pressure,O-M3,M,O-M3,O-M3,M,O-M3,M,O-M3,O-M3,O-M3,O-M3,O-M3,,53
-SECOND_ALT_BUILDING,Second Contact Address.Building,O,O,O,O,O,O,O,O,O,O,O,O,,56
-SECOND_ALT_CITY,Second Contact Address.City,O,O,O,O,O,O,O,O,O,O,O,O,,57
-SECOND_ALT_POSTCODE,Second Contact Address.Post Code,O,O,O,O,O,O,O,O,O,O,O,O,,58
-SECOND_ALT_STREET,Second Contact Address.Street,O,O,O,O,O,O,O,O,O,O,O,O,,59
-SECOND_ALT_SUB_BUILDING,Second Contact Address.Sub Building,O,O,O,O,O,O,O,O,O,O,O,O,,60
-SECOND_CONTACT_EMAIL,Second Contact Address.Email,O,O,O,O,O,O,O,O,O,O,O,O,,10
-SECOND_CONTACT_FAX,Contact Address.Fax,O,O,O,O,O,O,O,O,O,O,O,O,,12
-SECOND_CONTACT_INITIALS,Second Contact Address.Contact Initials,O,O,O,O,O,O,O,O,O,O,O,O,,15
-SECOND_CONTACT_NAME,Second Contact Address.Second Contact Name,O,O,O,O,O,O,O,O,O,O,O,O,,16
-SECOND_CONTACT_TELEPHONE_1,Contact Address.Telephone1,O,O,O,O,O,O,O,O,O,O,O,O,,22
-SECOND_CONTACT_TELEPHONE_2,Contact Address.Telephone2,O,O,O,O,O,O,O,O,O,O,O,O,,24
-SECOND_CONTACT_TITLE,Second Contact Address.Contact Title,O,O,O,O,O,O,O,O,O,O,O,O,,14
-TRANSACTION_REFERENCE,Job Site Details.Transaction Reference,O,O,O,O,O,O,O,O,O,O,O,O,,55
-TWIN_STREAM_REQUIRED,Job Information.Additional Services.Twin Stream,M,M,H,M,M,H,H,H,M,M,H,M,,31
-UPDATED_BY,,,,,,,,,,,,,,,
-UPDATED_ON,,,,,,,,,,,,,,,
+"COLUMN_NAME ","Appendix Reference","INSTALL","STD INSTALL","OFMAT","EXCHANGE","STD EXCHANGE","REMOVE","STD REMOVE","ADVERSARIAL","ALTERATION","CHANGE CAPACITY","ADDON","OTHER","Notes","DisplaySequence"
+"ACCESS_ADDITIONAL","Site Detail.Access Instructions","O","O","O","O","O","O","O","O","O","O","O","O",,61
+"ACCESS_PASSWORD","Site Detail.Access Password","O","O","O","O","O","O","O","O","O","O","O","O",,62
+"AGENT_COMT_CODE","Supplier Agent.Telephone1/Telephone2/Fax/Email","M","M","M","M","M","M","M","M","M","M","M","M",,68
+"AGENT_CONTACT_VALUE","Supplier Agent.Telephone1/Telephone2/Fax/Email","M","M","M","M","M","M","M","M","M","M","M","M",,69
+"ALTY_CODE","Site Detail.Asset Location Code","M","M","M","M","M","M","M","M","M","M","M","M",,64
+"AMR_REQUIRED","Job Information.Additional Services.AMR","O-M5","O-M5","H","O-M5","O-M5","H","H","H","O-M5","O-M5","O-M5","O-M5","The AMR may only be available for the Tripartite suppliers or BG, GW to confirm!",25
+"ANNUAL_QUANTITY","Job Information.Annual Quantity","O","O","O","O","O","H","H","H","O","O","O","O","if > 732 mwh go bespoke",32
+"ASSET_LOCATION_NOTES","Site Detail.Asset Location Notes","O","O","O","O","O","O","O","O","O","O","O","O",,65
+"BASE_REQUIRED","Job Information.Additional Services.Base","M","M","H","M","M","H","H","H","M","M","H","M",,26
+"BYPASS_REQUIRED","Job Information.Additional Services.By-pass","O","O","H","O","O","H","H","H","O","O","O","O","If yes, warn user if twin stream is no",27
+"CACA_CODE","Site Detail.Care Category","O","O","O","O","O","O","O","O","O","O","O","O",,66
+"CONVERTOR_REQUIRED","Job Information.Additional Services.Convertor","M","M","H","M","M","H","H","H","M","M","M","M","this can be an add-on for removals",28
+"CREATED_ON",,,,,,,,,,,,,,,
+"DOWNSTREAM_BOOSTER_OR_COMPRESS","Job Information.Booster/Compressor","M","M","M","M","M","H","H","H","M","M","M","M",,34
+"EMS_REQUIRED","Job Information.Additional Services.EMS","M","M","H","M","M","H","H","H","M","M","M","M",,29
+"ENTY_CODE","Job Information.Job Type","M","M","M","M","M","M","M","M","M","M","M","M",,43
+"EXISTING_CONVERTOR","Job Information.Existing Convertor","H","H","O","M","M","M","M","M","O","O","O","O",,72
+"EXISTING_LOGGER","Job Information.Logger","H","H","H","O","O","O","O","O","O","O","O","O",,71
+"EXISTING_PRTY_ID","Job Information.Existing Manufacturer","H","H","M","M","M","M","M","M","O","O","O","O",,
+"EXISTING_MESC_CODE","Job Information.Existing Meter Size","H","H","M","M","M","M","M","M","M","M","O","O",,36
+"EXISTING_METER_ASSET_PROVIDER","Job Information.Supplier / Job Information.Consumer(Meter Asset Manager)","O","O","O","O","O","O","O","O","O","O","O","O",,54
+"EXISTING_METR_CODE","Job Information.Model Code","H","H","M","M","M","M","M","M","O","O","O","O",,49
+"EXISTING_METER_OWNER","Job Information.Gas Act Owner","O","O","M","M","M","M","M","M","M","M","M","O",,38
+"EXISTING_METER_SERIAL_NO","Job Information.Existing Asset Serial Number","H","H","M","M","M","M","M","M","M","M","M","O",,35
+"EXISTING_METY_CODE","Job Information.Meter Type Existing ","H","H","M","M","M","M","M","M","M","M","O","O",,37
+"FIRST_ALT_BUILDING","Contact Address.Building","O","O","O","O","O","O","O","O","O","O","O","O",,7
+"FIRST_ALT_CITY","Contact Address.City","O","O","O","O","O","O","O","O","O","O","O","O",,8
+"FIRST_ALT_POSTCODE","Contact Address.Post Code","O","O","O","O","O","O","O","O","O","O","O","O",,13
+"FIRST_ALT_STREET","Contact Address.Street","O","O","O","O","O","O","O","O","O","O","O","O",,19
+"FIRST_ALT_SUB_BUILDING","Contact Address.Sub Building","O","O","O","O","O","O","O","O","O","O","O","O",,20
+"FIRST_CONTACT_EMAIL","Contact Address.Email","O","O","O","O","O","O","O","O","O","O","O","O",,9
+"FIRST_CONTACT_FAX","Contact Address.Fax","O","O","O","O","O","O","O","O","O","O","O","O",,11
+"FIRST_CONTACT_INITIALS","Contact Address.Contact Initials","O","O","O","O","O","O","O","O","O","O","O","O",,18
+"FIRST_CONTACT_NAME","Address.Contact Name","M","M","M","M","M","M","M","M","M","M","M","M",,3
+"FIRST_CONTACT_TELEPHONE_1","Contact Address.Telephone1","M","M","M","M","M","M","M","M","M","M","M","M",,21
+"FIRST_CONTACT_TELEPHONE_2","Contact Address.Telephone2","O","O","O","O","O","O","O","O","O","O","O","O",,23
+"FIRST_CONTACT_TITLE","Contact Address.Contact Title","O","O","O","O","O","O","O","O","O","O","O","O",,17
+"HOUSING_REQUIRED","Job Information.Additional Services.Housing","M","M","H","M","M","H","H","H","M","M","H","M",,30
+"ID","Enquiry Reference (not in spec appendix)","M","M","M","M","M","M","M","M","M","M","M","M",,70
+"INDICATIVE_DATE","Job Information.Indicative Substantial Completion Date","O","O","O","O","O","O","O","O","O","O","O","O",,39
+"INDICATIVE_TIME","Job Information.Appointment Preference","O","O","O","O","O","O","O","O","O","O","O","O",,33
+"INSTALL_BUILDING","Address.Building","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1",,1
+"INSTALL_CITY","Address.City","M","M","M","M","M","M","M","M","M","M","M","M",,2
+"INSTALL_POSTCODE","Address.Post Code","M","M","M","M","M","M","M","M","M","M","M","M",,4
+"INSTALL_STREET","Address.Street","M","M","M","M","M","M","M","M","M","M","M","M",,5
+"INSTALL_SUB_BUILDING","Address.Sub Building","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1","O-M1",,6
+"JOB_DESCRIPTION","Job Information.Job Description","O","O","O","O","O","O","O","O","O","O","O","O",,42
+"LOAD_CONTROL_TYPE","Job Information.Load Control Type","M","M","H","M","M","H","H","H","O","M","O","O",,44
+"MARKET_SECTOR_CODE","Job Information.Market Sector Code","O","O","O","O","O","O","O","O","O","O","O","O",,45
+"MPRN","Site Detail.MPRN","O-M4","O-M4","M","M","M","M","M","M","M","M","M","O",,67
+"MPRN_ALT","Site Detail.Additional Information","O-M4","O-M4","O","O","O","O","O","O","O","O","O","O",,63
+"OTHER_INFORMATION","Job Information.Other Information","O","O","O","O","O","O","O","O","O","O","O","O",,50
+"OTHER_PROJECT_REFERENCE","Job Information.Other Related Projects","O","O","O","O","O","O","O","O","O","O","O","O",,51
+"QMAX","Job Information.Measuring Capacity Qmax","M","O-M2","O","M","O-M2","O","O","O","O","M","O","O",,46
+"QMIN","Job Information.Measuring Capacity Qmin","O","O","O","O","O","O","O","O","O","O","O","O",,47
+"REQUIRED_IP_DETAILS","Job Information.IP Details","O-M3","H","O-M3","O-M3","H","O-M3","H","O-M3","O-M3","O-M3","O-M3","O-M3","if service pressure is IP",40
+"REQUIRED_IP_MBAR","Job Information.IP Mbar","O-M3","H","O-M3","O-M3","H","O-M3","H","O-M3","O-M3","O-M3","O-M3","O-M3","if service pressure is IP",41
+"REQUIRED_MESC_CODE","Job Information.Meter Size","H","O-M2","H","H","O-M2","H","H","H","H","O","H","O",,48
+"REQUIRED_METERING_PRESSURE","Job Information.Required Meter Pressure","M","M","M","M","M","M","M","M","M","M","O","O",,52
+"REQUIRED_SVCP_CODE","Job Information.Service Pressure","O-M3","M","O-M3","O-M3","M","O-M3","M","O-M3","O-M3","O-M3","O-M3","O-M3",,53
+"SECOND_ALT_BUILDING","Second Contact Address.Building","O","O","O","O","O","O","O","O","O","O","O","O",,56
+"SECOND_ALT_CITY","Second Contact Address.City","O","O","O","O","O","O","O","O","O","O","O","O",,57
+"SECOND_ALT_POSTCODE","Second Contact Address.Post Code","O","O","O","O","O","O","O","O","O","O","O","O",,58
+"SECOND_ALT_STREET","Second Contact Address.Street","O","O","O","O","O","O","O","O","O","O","O","O",,59
+"SECOND_ALT_SUB_BUILDING","Second Contact Address.Sub Building","O","O","O","O","O","O","O","O","O","O","O","O",,60
+"SECOND_CONTACT_EMAIL","Second Contact Address.Email","O","O","O","O","O","O","O","O","O","O","O","O",,10
+"SECOND_CONTACT_FAX","Contact Address.Fax","O","O","O","O","O","O","O","O","O","O","O","O",,12
+"SECOND_CONTACT_INITIALS","Second Contact Address.Contact Initials","O","O","O","O","O","O","O","O","O","O","O","O",,15
+"SECOND_CONTACT_NAME","Second Contact Address.Second Contact Name","O","O","O","O","O","O","O","O","O","O","O","O",,16
+"SECOND_CONTACT_TELEPHONE_1","Contact Address.Telephone1","O","O","O","O","O","O","O","O","O","O","O","O",,22
+"SECOND_CONTACT_TELEPHONE_2","Contact Address.Telephone2","O","O","O","O","O","O","O","O","O","O","O","O",,24
+"SECOND_CONTACT_TITLE","Second Contact Address.Contact Title","O","O","O","O","O","O","O","O","O","O","O","O",,14
+"TRANSACTION_REFERENCE","Job Site Details.Transaction Reference","O","O","O","O","O","O","O","O","O","O","O","O",,55
+"TWIN_STREAM_REQUIRED","Job Information.Additional Services.Twin Stream","M","M","H","M","M","H","H","H","M","M","H","M",,31
+"UPDATED_BY",,,,,,,,,,,,,,,
+"UPDATED_ON",,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,
-,Optional-Mandatory Special Cases,,,,,,,,,,,,,,
-,O-M1: INSTALL_SUB_BUILDING AND/OR INSTALL.BUILDING MUST BE COMPLETED,,,,,,,,,,,,,,
-,O-M2: IF REQUIRED_MESC_CODE IS NOT COMPLETED THEN QMAX MUST BE COMPLETED,,,,,,,,,,,,,,
-,O-M3: IF REQUIRED_SVCP_CODE = 'IP' THEN REQUIRED_IP_DETAILS MUST BE COMPLETED,,,,,,,,,,,,,,
-,O-M4: IF MPRN IS NOT COMPLETED THEN MPRN_ALT MUST BE COMPLETED,,,,,,,,,,,,,,
-,O-M5: AMR AVAILABILITY IS DETERMINED BY TRIPARTITE AGREEMENT,,,,,,,,,,,,,,
+,"Optional-Mandatory Special Cases",,,,,,,,,,,,,,
+,"O-M1: INSTALL_SUB_BUILDING AND/OR INSTALL.BUILDING MUST BE COMPLETED",,,,,,,,,,,,,,
+,"O-M2: IF REQUIRED_MESC_CODE IS NOT COMPLETED THEN QMAX MUST BE COMPLETED",,,,,,,,,,,,,,
+,"O-M3: IF REQUIRED_SVCP_CODE = 'IP' THEN REQUIRED_IP_DETAILS MUST BE COMPLETED",,,,,,,,,,,,,,
+,"O-M4: IF MPRN IS NOT COMPLETED THEN MPRN_ALT MUST BE COMPLETED",,,,,,,,,,,,,,
+,"O-M5: AMR AVAILABILITY IS DETERMINED BY TRIPARTITE AGREEMENT",,,,,,,,,,,,,,
diff --git a/Documentation/SupportingDocumentation/WebMIP Email templates.doc b/Documentation/SupportingDocumentation/WebMIP Email templates.doc
new file mode 100644
index 0000000..af1ae73
Binary files /dev/null and b/Documentation/SupportingDocumentation/WebMIP Email templates.doc differ
diff --git a/Documentation/pldoc/frame_index.html b/Documentation/pldoc/frame_index.html
index 8f1fbb2..f23526c 100644
--- a/Documentation/pldoc/frame_index.html
+++ b/Documentation/pldoc/frame_index.html
@@ -99,6 +99,9 @@
+|
+ apex
+ |
|
gen_mandatory
|
diff --git a/Documentation/pldoc/index.html b/Documentation/pldoc/index.html
index f742feb..42e6e27 100644
--- a/Documentation/pldoc/index.html
+++ b/Documentation/pldoc/index.html
@@ -118,6 +118,9 @@
+|
+apex
+ | |
|
gen_mandatory
| |
diff --git a/Modules/Modules.sql b/Modules/Modules.sql
index fc7fd86..8011537 100644
--- a/Modules/Modules.sql
+++ b/Modules/Modules.sql
@@ -8,6 +8,8 @@ set define off
exec gen_mandatory
+@@mip_debug_constants.pks
+@@mip_debug.pck
@@mip_systemcall.pck
@@mip_files.pck
@@mip_security.pck
diff --git a/Modules/mip_bulk_load.pck b/Modules/mip_bulk_load.pck
index 113c2f0..356248c 100644
--- a/Modules/mip_bulk_load.pck
+++ b/Modules/mip_bulk_load.pck
@@ -28,11 +28,12 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
g_other_manufacturer_id parties.id%TYPE;
- PROCEDURE pl(p_in IN VARCHAR2) IS
+ PROCEDURE pl(p_in IN VARCHAR2, p_line IN NUMBER DEFAULT NULL) IS
BEGIN
- dbms_output.put_line(to_char(SYSDATE
- ,'DD-MON-YYYY HH24:MI:SS') || '-' || p_in);
- dbms_application_info.set_client_info(p_in);
+ NULL;
+ --$IF $$DEBUGGING OR mip_debug_constants.debugging OR mip_debug_constants.bulk_load $THEN
+ mip_debug.pl(p_unit => $$PLSQL_UNIT,p_line => p_line,p_in => p_in);
+ --$END
END pl;
PROCEDURE get_dir_list(p_directory IN VARCHAR2) AS
diff --git a/Modules/mip_debug.pck b/Modules/mip_debug.pck
new file mode 100644
index 0000000..ee9073f
--- /dev/null
+++ b/Modules/mip_debug.pck
@@ -0,0 +1,43 @@
+CREATE OR REPLACE PACKAGE mip_debug IS
+
+ -- Author : HARDYA
+ -- Created : 06/03/2008 09:07:01
+ -- Purpose : provide debug output functionality
+
+ PROCEDURE pl(p_unit IN VARCHAR
+ ,p_in VARCHAR2
+ ,p_line IN NUMBER DEFAULT NULL);
+END mip_debug;
+/
+CREATE OR REPLACE PACKAGE BODY mip_debug IS
+
+ PROCEDURE pl(p_unit IN VARCHAR
+ ,p_in VARCHAR2
+ ,p_line IN NUMBER DEFAULT NULL) IS
+ l_fh utl_file.file_type;
+ l_output VARCHAR2(400);
+ BEGIN
+
+ dbms_application_info.set_module(p_unit
+ ,p_line || ':' || p_in);
+ l_fh := utl_file.fopen(location => 'WEBMIP_BULK_LOAD'
+ ,filename => p_unit || replace(v('SYSTEM_ENVIRONMENT'),' ','_')||'_debug.txt'
+ ,open_mode => 'A');
+
+ l_output := to_char(SYSDATE
+ ,'DD/MM/YYYY HH24:MI:SS') || ':' ||p_unit || ':' ||
+ p_line || ':' || p_in;
+
+ utl_file.put_line(l_fh
+ ,l_output);
+ utl_file.fclose(l_fh);
+
+ dbms_output.put_line(l_output);
+
+ END pl;
+
+BEGIN
+ -- Initialization
+ NULL;
+END mip_debug;
+/
diff --git a/Modules/mip_debug_constants.pks b/Modules/mip_debug_constants.pks
new file mode 100644
index 0000000..12dcfef
--- /dev/null
+++ b/Modules/mip_debug_constants.pks
@@ -0,0 +1,14 @@
+create or replace package mip_debug_constants is
+
+ -- Author : HARDYA
+ -- Created : 06/03/2008 09:04:54
+ -- Purpose : Constants used for conditional compilation of debug functions
+
+
+ -- Public constant declarations
+ debugging CONSTANT BOOLEAN := TRUE;
+ bulk_load CONSTANT BOOLEAN := TRUE;
+ quotation CONSTANT BOOLEAN := TRUE;
+
+end mip_debug_constants;
+/
diff --git a/Modules/mip_email.pck b/Modules/mip_email.pck
index 03cc2f5..274a026 100644
--- a/Modules/mip_email.pck
+++ b/Modules/mip_email.pck
@@ -1,76 +1,90 @@
-create or replace package mip_email is
+CREATE OR REPLACE PACKAGE mip_email IS
-- Author : MULLENMD
-- Created : 02/11/2007 13:46:43
-- Purpose : Allow the system to send emails.
-
+
g_from_address CONSTANT VARCHAR2(50) := cout_system_configuration.get_configuration_item('EMAIL_FROM_ADDRESS');
- PROCEDURE send_email_plain_text(p_recipient IN VARCHAR2,
- p_from IN VARCHAR2 DEFAULT g_from_address,
- p_body IN VARCHAR2,
- p_subject IN VARCHAR2);
+ PROCEDURE send_email_plain_text(p_recipient IN VARCHAR2
+ ,p_from IN VARCHAR2 DEFAULT g_from_address
+ ,p_body IN VARCHAR2
+ ,p_subject IN VARCHAR2);
- PROCEDURE send_email_vchar(p_recipient IN VARCHAR2,
- p_from IN VARCHAR2 DEFAULT g_from_address,
- p_body IN VARCHAR2,
- p_body_html IN VARCHAR2,
- p_subject IN VARCHAR2);
-
- PROCEDURE send_email_clob(p_recipient IN VARCHAR2,
- p_from IN VARCHAR2 DEFAULT g_from_address,
- p_body IN CLOB,
- p_body_html IN CLOB,
- p_subject IN VARCHAR2);
-
-end mip_email;
+ PROCEDURE send_email_vchar(p_recipient IN VARCHAR2
+ ,p_from IN VARCHAR2 DEFAULT g_from_address
+ ,p_body IN VARCHAR2
+ ,p_body_html IN VARCHAR2
+ ,p_subject IN VARCHAR2);
+
+ PROCEDURE send_email_clob(p_recipient IN VARCHAR2
+ ,p_from IN VARCHAR2 DEFAULT g_from_address
+ ,p_body IN CLOB
+ ,p_body_html IN CLOB
+ ,p_subject IN VARCHAR2);
+
+ PROCEDURE add_attachment(p_attachment IN BLOB
+ ,p_filename IN VARCHAR2
+ ,p_mime_type IN VARCHAR2);
+END mip_email;
/
-create or replace package body mip_email is
-
+CREATE OR REPLACE PACKAGE BODY mip_email IS
+
+ g_mail_id NUMBER;
--
- PROCEDURE send_email_plain_text(p_recipient IN VARCHAR2,
- p_from IN VARCHAR2 DEFAULT g_from_address,
- p_body IN VARCHAR2,
- p_subject IN VARCHAR2) IS
+ PROCEDURE send_email_plain_text(p_recipient IN VARCHAR2
+ ,p_from IN VARCHAR2 DEFAULT g_from_address
+ ,p_body IN VARCHAR2
+ ,p_subject IN VARCHAR2) IS
BEGIN
- apex_mail.send(p_to => p_RECIPIENT,
- p_from => p_from,
- p_body => p_body,
- p_subj => p_subject);
+ g_mail_id := apex_mail.send(p_to => p_recipient
+ ,p_from => p_from
+ ,p_body => p_body
+ ,p_subj => p_subject);
END send_email_plain_text;
--
-
+
--
- PROCEDURE send_email_vchar(p_recipient IN VARCHAR2,
- p_from IN VARCHAR2 DEFAULT g_from_address,
- p_body IN VARCHAR2,
- p_body_html IN VARCHAR2,
- p_subject IN VARCHAR2) IS
+ PROCEDURE send_email_vchar(p_recipient IN VARCHAR2
+ ,p_from IN VARCHAR2 DEFAULT g_from_address
+ ,p_body IN VARCHAR2
+ ,p_body_html IN VARCHAR2
+ ,p_subject IN VARCHAR2) IS
BEGIN
- apex_mail.send(p_to => p_recipient,
- p_from => p_from,
- p_body => p_body,
- p_body_html => p_body_html,
- p_subj => p_subject);
+ g_mail_id := apex_mail.send(p_to => p_recipient
+ ,p_from => p_from
+ ,p_body => p_body
+ ,p_body_html => p_body_html
+ ,p_subj => p_subject);
END send_email_vchar;
--
-
+
--
- PROCEDURE send_email_clob(p_recipient IN VARCHAR2,
- p_from IN VARCHAR2 DEFAULT g_from_address,
- p_body IN CLOB,
- p_body_html IN CLOB,
- p_subject IN VARCHAR2) IS
+ PROCEDURE send_email_clob(p_recipient IN VARCHAR2
+ ,p_from IN VARCHAR2 DEFAULT g_from_address
+ ,p_body IN CLOB
+ ,p_body_html IN CLOB
+ ,p_subject IN VARCHAR2) IS
BEGIN
- apex_mail.send(p_to => p_recipient,
- p_from => p_from,
- p_body => p_body,
- p_body_html => p_body_html,
- p_subj => p_subject);
+ g_mail_id := apex_mail.send(p_to => p_recipient
+ ,p_from => p_from
+ ,p_body => p_body
+ ,p_body_html => p_body_html
+ ,p_subj => p_subject);
END send_email_clob;
+
+ PROCEDURE add_attachment(p_attachment IN BLOB
+ ,p_filename IN VARCHAR2
+ ,p_mime_type IN VARCHAR2) IS
+ BEGIN
+ apex_mail.add_attachment(p_mail_id => g_mail_id
+ ,p_attachment => p_attachment
+ ,p_filename => p_filename
+ ,p_mime_type => p_mime_type);
+ END add_attachment;
--
-end mip_email;
+END mip_email;
/
diff --git a/Modules/mip_quotation.pck b/Modules/mip_quotation.pck
index 4b4eac9..7ce8644 100644
--- a/Modules/mip_quotation.pck
+++ b/Modules/mip_quotation.pck
@@ -83,7 +83,7 @@ CREATE OR REPLACE PACKAGE mip_quotation IS
/** Reject all quotes associated with enquiry
%param p_enqu_id id of the enquiry for qhich all quotes are to be rejected
- %param p_prty_id id of the person rejecting the quotes
+ %param p_prty_id id of the person rejecting the quotes
%param p_owner_prty_id id of the person who owns the rejected quotes (defaults to rejector)
%param p_description optional description to be recorded with the event
%param p_event_date optional date for this event (defaults to now)
@@ -127,7 +127,7 @@ END mip_quotation;
/
CREATE OR REPLACE PACKAGE BODY mip_quotation IS
- PROCEDURE email_agent_aq_available(p_enqu_id IN enquiries.id%TYPE);
+ PROCEDURE email_agent_q_sel(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);
@@ -153,7 +153,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
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_q_sel_notification t_email_reason := 'AGENT_Q_SEL_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';
@@ -168,18 +168,21 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
SUBTYPE t_quote_row IS quotes%ROWTYPE;
- PROCEDURE pl(p_in VARCHAR2) IS
- l_fh utl_file.file_type;
+ TYPE t_rec_attachment IS RECORD(
+ content wwv_flow_files.blob_content%TYPE := empty_blob
+ ,filename wwv_flow_files.filename%TYPE
+ ,mime_type wwv_flow_files.mime_type%TYPE);
+
+ PROCEDURE pl(p_in VARCHAR2
+ ,p_line IN NUMBER DEFAULT NULL) IS
BEGIN
- dbms_application_info.set_module('MIP_QUOTATION'
- ,p_in);
- l_fh := utl_file.fopen(location => 'WEBMIP_BULK_LOAD'
- ,filename => 'MIP_QUOTATION.txt'
- ,open_mode => 'A');
- utl_file.put_line(l_fh
- ,to_char(SYSDATE
- ,'DD/MM/YYYY HH24:MI:SS') || ',' || p_in);
- utl_file.fclose(l_fh);
+ NULL;
+ /* $IF mip_debug_constants.debugging OR mip_debug_constants.quotation
+ $THEN*/
+ mip_debug.pl(p_unit => $$PLSQL_UNIT
+ ,p_line => p_line
+ ,p_in => p_in);
+ /* $END*/
END pl;
PROCEDURE add_quote_event(p_qute_id IN quotes.id%TYPE
@@ -187,6 +190,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_description quote_events.description%TYPE DEFAULT NULL
,p_event_date DATE DEFAULT SYSDATE) IS
BEGIN
+ pl('add_quote_event:entry:' || p_qute_id || ':' || p_qust_code);
INSERT INTO quote_events
(qute_id
,qust_code
@@ -333,6 +337,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_event_date IN DATE DEFAULT SYSDATE) IS
l_enqu_id enquiries.id%TYPE;
BEGIN
+ pl('select_quote:entry:' || p_qute_id
+ ,$$PLSQL_LINE);
add_quote_event(p_qute_id => p_qute_id
,p_qust_code => 'SELECTED'
,p_event_date => p_event_date
@@ -361,7 +367,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
FROM quotes
WHERE id = p_qute_id;
- email_agent_aq_available(l_enqu_id);
+ email_agent_q_sel(l_enqu_id);
END select_quote;
@@ -460,7 +466,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
l_qute_type quotes.qute_type%TYPE;
l_enqu_id enquiries.id%TYPE;
BEGIN
- pl('make_quote_available');
+ pl('make_quote_available'
+ ,$$PLSQL_LINE);
add_quote_event(p_qute_id => p_qute_id
,p_qust_code => 'AV'
@@ -481,7 +488,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
PROCEDURE mark_enquiry_submitted(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
- pl('mark_enquiry_submitted');
+ pl('mark_enquiry_submitted'
+ ,$$PLSQL_LINE);
add_enquiry_event(p_enqu_id => p_enqu_id
,p_enst_code => 'SUBMITTED'
@@ -491,7 +499,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
PROCEDURE mark_enquiry_quoted(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
- pl('mark_enquiry_quoted');
+ pl('mark_enquiry_quoted'
+ ,$$PLSQL_LINE);
add_enquiry_event(p_enqu_id => p_enqu_id
,p_enst_code => 'QUOTED'
@@ -501,7 +510,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
PROCEDURE mark_enquiry_invalid(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
- pl('mark_enquiry_invalid');
+ pl('mark_enquiry_invalid'
+ ,$$PLSQL_LINE);
add_enquiry_event(p_enqu_id => p_enqu_id
,p_enst_code => 'INVALID'
@@ -521,7 +531,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
EXCEPTION
WHEN no_data_found THEN
pl('SYSTEM_CONFIGURATION ERROR - PARAMETER ''' || p_parameter ||
- ''' NOT FOUND');
+ ''' NOT FOUND'
+ ,$$PLSQL_LINE);
RETURN 'SYSTEM_CONFIGURATION ERROR - PARAMETER ''' || p_parameter || ''' NOT FOUND';
END get_system_configuration_value;
@@ -577,6 +588,55 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
RETURN l_description;
END get_enty_description;
+ FUNCTION get_quote_document(p_enqu_id IN enquiries.id%TYPE
+ ,p_docu_id IN documents.id%TYPE DEFAULT NULL)
+ RETURN t_rec_attachment IS
+ l_docu_id documents.id%TYPE;
+ l_doc_details t_rec_attachment;
+ BEGIN
+ pl('get_quote_document:entry:p_enqu_id=' || p_enqu_id
+ ,$$PLSQL_LINE);
+
+ l_docu_id := p_docu_id;
+
+ IF l_docu_id IS NULL THEN
+ -- find the 'selected' quote document
+ SELECT doro.docu_id
+ INTO l_docu_id
+ FROM document_roles doro
+ ,quote_events quev
+ ,quotes qute
+ WHERE qute.enqu_id = p_enqu_id
+ AND quev.qute_id = qute.id
+ AND quev.qust_code = 'SELECTED'
+ AND doro.qute_id = quev.qute_id;
+ END IF;
+
+ pl('l_docu_id=' || l_docu_id
+ ,$$PLSQL_LINE);
+
+ -- get the document details and content
+ SELECT wff.filename
+ ,wff.mime_type
+ ,wff.blob_content
+ INTO l_doc_details.filename
+ ,l_doc_details.mime_type
+ ,l_doc_details.content
+ FROM documents docu
+ ,apex_application_files wff
+ WHERE docu.uri = wff.NAME
+ AND docu.id = l_docu_id;
+
+ pl('l_doc_details.content.length=' ||
+ dbms_lob.getlength(l_doc_details.content)
+ ,$$PLSQL_LINE);
+ pl('get_quote_document:exit:filename=' || l_doc_details.filename
+ ,$$PLSQL_LINE);
+
+ RETURN l_doc_details;
+
+ END get_quote_document;
+
PROCEDURE al(p_in IN VARCHAR2) IS
BEGIN
dbms_lob.writeappend(g_email_plain_body
@@ -626,7 +686,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
PROCEDURE produce_quote_summary(p_qute_id IN quotes.id%TYPE) IS
l_quote_row t_quote_row;
BEGIN
- pl('produce_quote_summary');
+ pl('produce_quote_summary'
+ ,$$PLSQL_LINE);
l_quote_row := get_quote_row(p_qute_id);
@@ -727,7 +788,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
END return_value;
BEGIN
- pl('produce_enquiry_entry_details');
+ pl('produce_enquiry_entry_details'
+ ,$$PLSQL_LINE);
al(' ');
al(' ');
al(get_system_name ||
@@ -752,7 +814,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
PROCEDURE produce_reasoning_summary(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
- pl('produce_reasoning_summary');
+ pl('produce_reasoning_summary'
+ ,$$PLSQL_LINE);
al(' ');
al(' ');
al(get_system_name ||
@@ -777,15 +840,18 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_email_recipient VARCHAR2(240);
l_agent_first_name parties.first_name%TYPE;
l_agent_last_name parties.last_name%TYPE;
+ l_attachment t_rec_attachment;
BEGIN
pl('email_to_agent:enter:p_enqu_id=' || p_enqu_id ||
- ', p_email_reason=' || p_email_reason);
+ ', p_email_reason=' || p_email_reason
+ ,$$PLSQL_LINE);
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);
+ pl('mip_enquiry.get_enquiry_role returned ' || SQLERRM
+ ,$$PLSQL_LINE);
RAISE;
END;
@@ -820,7 +886,32 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
al(' ');
END IF;
- IF p_email_reason = gc_agent_qa_notification THEN
+ IF p_email_reason = gc_agent_q_sel_notification THEN
+ --Scenario one: Automatic quote generation notification
+ l_email_subject := get_system_name || ': Automatic Quote Available';
+ l_attachment := get_quote_document(p_enqu_id => p_enqu_id);
+ 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('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');
+ l_attachment := get_quote_document(p_enqu_id => p_enqu_id);
+ ELSIF p_email_reason = gc_agent_q_sel_notification THEN
+ -- Scenario two: Quotation acceptance notification
l_email_subject := get_system_name || ': Quote Acceptance';
al('Dear Sir/Madam,');
al(' ');
@@ -844,6 +935,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
al('Fax: 02476 286 044');
al('Email: ic.nonstandard1@uk.ngrid.com');
ELSIF p_email_reason = gc_agent_rmq_notification THEN
+ -- Scenario three: Manual quote requested
l_email_subject := get_system_name || ': Request for Manual Quote';
al('Dear Sir/Madam,');
al(' ');
@@ -865,7 +957,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
al('Fax: 02476 286 044');
al('Email: ic.nonstandard1@uk.ngrid.com');
ELSIF p_email_reason = gc_agent_mqa_notification THEN
+ -- Scenario four: Manual quote produced and ready to view.
l_email_subject := get_system_name || ': Manual Quote Available';
+ l_attachment := get_quote_document(p_enqu_id => p_enqu_id);
al('Dear Sir/Madam,');
al(' ');
al('Enquiry reference number: ' || p_enqu_id);
@@ -874,44 +968,6 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
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:');
-
- FOR l_qute IN (SELECT id
- FROM quotes
- ,v_quote_details v
- ,v_current_quote_status s
- WHERE enqu_id = p_enqu_id
- AND v.quote_id = id
- AND s.qute_id = id
- AND s.qust_code = 'AV'
- ORDER BY total_cost) LOOP
-
- produce_quote_summary(l_qute.id);
-
- al(' ');
- END LOOP;
-
al('Please use the Enquiry reference number at the top of this email on any future correspondence relating to this request.');
al(' ');
al('Regards');
@@ -930,17 +986,27 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
BEGIN
pl('email_to_agent:l_email_recipient=' || l_email_recipient || ':' ||
- 'l_email_subject=' || l_email_subject);
+ 'l_email_subject=' || l_email_subject
+ ,$$PLSQL_LINE);
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);
+
+ IF dbms_lob.getlength(lob_loc => l_attachment.content) > 0 THEN
+ mip_email.add_attachment(p_attachment => l_attachment.content
+ ,p_filename => l_attachment.filename
+ ,p_mime_type => l_attachment.mime_type);
+ END IF;
+
EXCEPTION
WHEN OTHERS THEN
- pl('mip_email.send_email_clob returned ' || SQLERRM);
+ pl('mip_email.send_email_clob returned ' || SQLERRM
+ ,$$PLSQL_LINE);
END;
- pl('email_to_agent:exit');
+ pl('email_to_agent:exit'
+ ,$$PLSQL_LINE);
END email_to_agent;
PROCEDURE email_to_internal_users(p_enqu_id IN enquiries.id%TYPE
@@ -950,9 +1016,11 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_qute_id quotes.id%TYPE;
BEGIN
pl('email_internal_users:entry:p_enqu_id=' || p_enqu_id ||
- ', p_email_reason=' || p_email_reason);
+ ', p_email_reason=' || p_email_reason
+ ,$$PLSQL_LINE);
open_body;
IF p_email_reason = gc_internal_qa_notification THEN
+ -- Scenario five: Accepted quote + system data
l_email_subject := get_system_name ||
': Quote Acceptance Notification';
al('Hi team,');
@@ -978,6 +1046,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
al(' ');
al('I&C Online Quotations System');
ELSIF p_email_reason = gc_internal_rmq_notification THEN
+ -- Scenario six: Request for manual quote + system data
l_email_subject := get_system_name ||
': Request For Manual Quotation Notification';
al('Hi team,');
@@ -1006,27 +1075,32 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
close_body;
BEGIN
pl('email_to_internal_users:l_email_recipient=' || l_email_recipient || ':' ||
- 'l_email_subject=' || l_email_subject);
+ 'l_email_subject=' || l_email_subject
+ ,$$PLSQL_LINE);
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);
+ pl('mip_email.send_email_clob returned ' || SQLERRM
+ ,$$PLSQL_LINE);
END;
- pl('email_internal_users:exit');
+ pl('email_internal_users:exit'
+ ,$$PLSQL_LINE);
END email_to_internal_users;
- PROCEDURE email_agent_aq_available(p_enqu_id IN enquiries.id%TYPE) IS
+ PROCEDURE email_agent_q_sel(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
- pl('email_agent_aq_available:entry');
+ pl('email_agent_q_sel:entry'
+ ,$$PLSQL_LINE);
email_to_agent(p_enqu_id => p_enqu_id
- ,p_email_reason => gc_agent_qa_notification);
+ ,p_email_reason => gc_agent_q_sel_notification);
- pl('email_agent_aq_available:exit');
- END email_agent_aq_available;
+ pl('email_agent_q_sel:exit'
+ ,$$PLSQL_LINE);
+ END email_agent_q_sel;
PROCEDURE email_agent_mq_available(p_enqu_id enquiries.id%TYPE) IS
BEGIN
@@ -1038,7 +1112,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_system_name system_configuration.VALUE%TYPE := get_system_name;
l_quote_row quotes%ROWTYPE;
BEGIN
- pl('email_request_for_mq:enter');
+ pl('email_request_for_mq:enter'
+ ,$$PLSQL_LINE);
email_to_agent(p_enqu_id => p_enqu_id
,p_email_reason => gc_agent_rmq_notification);
@@ -1046,13 +1121,14 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
email_to_internal_users(p_enqu_id => p_enqu_id
,p_email_reason => gc_internal_rmq_notification);
- pl('email_request_for_mq:exit');
+ pl('email_request_for_mq:exit'
+ ,$$PLSQL_LINE);
END email_agent_request_for_mq;
PROCEDURE email_agent_quote_acceptance(p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
email_to_agent(p_enqu_id => p_enqu_id
- ,p_email_reason => gc_agent_qa_notification);
+ ,p_email_reason => gc_agent_q_sel_notification);
END email_agent_quote_acceptance;
PROCEDURE email_iu_quote_acceptance(p_enqu_id enquiries.id%TYPE) IS
@@ -1070,7 +1146,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
PROCEDURE email_support(p_subject IN VARCHAR2
,p_enqu_id IN enquiries.id%TYPE) IS
BEGIN
- pl('email_support');
+ pl('email_support'
+ ,$$PLSQL_LINE);
open_body;
@@ -1097,7 +1174,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
p_enqu_id);
EXCEPTION
WHEN OTHERS THEN
- pl('mip_email.send_email_clob returned ' || SQLERRM);
+ pl('mip_email.send_email_clob returned ' || SQLERRM
+ ,$$PLSQL_LINE);
END;
END email_support;
@@ -1106,7 +1184,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL) IS
l_qute_id quotes.id%TYPE;
BEGIN
- pl('request_manual_quote');
+ pl('request_manual_quote'
+ ,$$PLSQL_LINE);
l_qute_id := start_quote(p_enqu_id => p_enqu_id
,p_manual_or_automatic => gc_manual_quote
@@ -1121,7 +1200,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_mandatory_checks OUT mip_mandatory.t_mandatory_checks
,p_enquiry_is_ready OUT BOOLEAN) IS
BEGIN
- pl('ready_for_quote(1) - enqu_id=' || p_enqu_id);
+ pl('ready_for_quote(1) - enqu_id=' || p_enqu_id
+ ,$$PLSQL_LINE);
p_enquiry_is_ready := mip_enquiries_helper.check_mandatory(p_id => p_enqu_id
,p_mandatory_checks => p_mandatory_checks);
@@ -1131,7 +1211,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_mandatory_checks mip_mandatory.t_mandatory_checks;
l_enquiry_is_ready BOOLEAN;
BEGIN
- pl('ready_for_quote(2) - enqu_id=' || p_enqu_id);
+ pl('ready_for_quote(2) - enqu_id=' || p_enqu_id
+ ,$$PLSQL_LINE);
ready_for_quote(p_enqu_id => p_enqu_id
,p_mandatory_checks => l_mandatory_checks
@@ -1167,7 +1248,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
EXCEPTION
WHEN OTHERS THEN
- pl('validate:' || SQLERRM);
+ pl('validate:' || SQLERRM
+ ,$$PLSQL_LINE);
RAISE;
END validate;
@@ -1190,7 +1272,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
/* pl('Nothing found');*/
RETURN NULL;
WHEN OTHERS THEN
- pl('validation_result:' || SQLERRM);
+ pl('validation_result:' || SQLERRM
+ ,$$PLSQL_LINE);
RAISE;
END validation_result;
@@ -1201,7 +1284,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_enquiry_is_ready BOOLEAN;
l_idx INTEGER;
BEGIN
- pl('return_mandatory_messages');
+ pl('return_mandatory_messages'
+ ,$$PLSQL_LINE);
ready_for_quote(p_enqu_id => p_enqu_id
,p_mandatory_checks => l_mandatory_checks
@@ -1224,7 +1308,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_reason IN quote_reasoning.reason%TYPE
,p_internal_or_external IN quote_reasoning.internal_or_external%TYPE DEFAULT gc_external_reason) IS
BEGIN
- pl('add_quote_reason:' || p_enqu_id || ':' || p_reason);
+ pl('add_quote_reason:' || p_enqu_id || ':' || p_reason
+ ,$$PLSQL_LINE);
INSERT INTO quote_reasoning
(enqu_id
,reason
@@ -1242,7 +1327,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RETURN meter_size_codes.code%TYPE IS
l_meter_size_code meter_size_codes.code%TYPE;
BEGIN
- pl('get_u_meter_size');
+ pl('get_u_meter_size'
+ ,$$PLSQL_LINE);
-- get the smallest meter code that will support the given Qmax
SELECT code
@@ -1302,7 +1388,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RETURN BOOLEAN IS
l_dummy NUMBER;
BEGIN
- pl('valid_meter_size_upgrade');
+ pl('valid_meter_size_upgrade'
+ ,$$PLSQL_LINE);
IF p_existing_meter_size_code = p_required_meter_size_code THEN
RETURN TRUE;
@@ -1328,7 +1415,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_existing_meter_size_code meter_size_codes.code%TYPE;
l_required_meter_size_code meter_size_codes.code%TYPE;
BEGIN
- pl('survey_required');
+ pl('survey_required'
+ ,$$PLSQL_LINE);
-- Low Pressure Rules
-- Site survey required for:
@@ -1395,7 +1483,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_idx INTEGER;
BEGIN
- pl('tripartite_agreement_message');
+ pl('tripartite_agreement_message'
+ ,$$PLSQL_LINE);
l_valid := mip_tripartite.valid_enquiry(p_rec => p_rec
,p_tab_messages => l_tab_messages);
@@ -1422,7 +1511,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_idx INTEGER;
BEGIN
- pl('tripartite_agreement_satisfied');
+ pl('tripartite_agreement_satisfied'
+ ,$$PLSQL_LINE);
l_valid := mip_tripartite.valid_enquiry(p_enqu_id => p_enqu_id
,p_tab_messages => l_tab_messages);
@@ -1451,7 +1541,8 @@ 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
BEGIN
- pl('manual_or_automatic_quote');
+ pl('manual_or_automatic_quote'
+ ,$$PLSQL_LINE);
p_manual_or_automatic_quote := gc_automatic_quote;
IF p_enqu.enty_code IN ('OTHER', 'CHANGE CAPACITY') THEN
@@ -1555,7 +1646,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RETURN t_rec_additional_costs IS
l_rec_costs t_rec_additional_costs;
BEGIN
- pl('get_housing');
+ pl('get_housing'
+ ,$$PLSQL_LINE);
SELECT selling_price
,cost_price
,delivery_cost
@@ -1593,7 +1685,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RETURN t_rec_additional_costs IS
l_rec_costs t_rec_additional_costs;
BEGIN
- pl('get_base');
+ pl('get_base'
+ ,$$PLSQL_LINE);
SELECT selling_price
,cost_price
,delivery_cost
@@ -1632,7 +1725,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RETURN t_rec_additional_costs IS
l_rec_costs t_rec_additional_costs;
BEGIN
- pl('get_aico:' || p_adit_code || ':' || p_regi_code);
+ pl('get_aico:' || p_adit_code || ':' || p_regi_code
+ ,$$PLSQL_LINE);
SELECT lead_time
,selling_price
,cost_price
@@ -1667,15 +1761,18 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
WHERE adit.code = cost.adit_code
AND adit.code = p_adit_code;
- pl('get_aico:exit');
+ pl('get_aico:exit'
+ ,$$PLSQL_LINE);
RETURN l_rec_costs;
EXCEPTION
WHEN no_data_found THEN
- pl('get_aico:exit:NDF');
+ pl('get_aico:exit:NDF'
+ ,$$PLSQL_LINE);
RETURN l_rec_costs;
WHEN OTHERS THEN
- pl('get_aico:exit:' || SQLERRM);
+ pl('get_aico:exit:' || SQLERRM
+ ,$$PLSQL_LINE);
RAISE;
END get_aico;
@@ -1687,7 +1784,8 @@ 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'
+ ,$$PLSQL_LINE);
SELECT selling_price
,cost_price
,delivery_cost
@@ -1743,7 +1841,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
BEGIN
pl('get_lead_time:' || p_enty_code || ':' || p_mety_code || ':' ||
- p_svcp_code || ':' || p_qmax);
+ p_svcp_code || ':' || p_qmax
+ ,$$PLSQL_LINE);
SELECT days
INTO l_days
FROM (SELECT enty_code
@@ -1764,15 +1863,18 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
AND ((v.svcp_code = p_svcp_code) OR
(v.svcp_code IS NULL AND p_svcp_code IS NULL));
- pl('get_lead_time:exit:' || l_days);
+ pl('get_lead_time:exit:' || l_days
+ ,$$PLSQL_LINE);
RETURN l_days;
EXCEPTION
WHEN no_data_found THEN
- pl('get_lead_time:exit:NDF');
+ pl('get_lead_time:exit:NDF'
+ ,$$PLSQL_LINE);
RETURN NULL;
WHEN OTHERS THEN
- pl('get_lead_time:exit:' || SQLERRM);
+ pl('get_lead_time:exit:' || SQLERRM
+ ,$$PLSQL_LINE);
RAISE;
END get_lead_time;
@@ -1829,7 +1931,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_required_mesc_code meter_size_codes.code%TYPE;
l_required_qmax meter_size_codes.qmax%TYPE;
BEGIN
- pl('produce_module_quotes');
+ pl('produce_module_quotes'
+ ,$$PLSQL_LINE);
cout_assert.istrue(p_enqu.enty_code IN ('INSTALL', 'STD INSTALL',
'EXCHANGE', 'CAPACITY CHANGE')
,'Attempted to produce an install or exchange quote for enquiry of type ' ||
@@ -1883,6 +1986,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_required_qmax := p_enqu.qmax;
END IF;
+ pl('Required Qmax=' || l_required_qmax
+ ,$$PLSQL_LINE);
+
IF p_enqu.enty_code = 'EXCHANGE' THEN
IF p_enqu.existing_mesc_code IS NULL THEN
l_required_mesc_code := get_next_u_meter_size(get_u_meter_size(l_required_qmax));
@@ -2392,7 +2498,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
END IF;
- pl('produce_module_quotes:exit');
+ pl('produce_module_quotes:exit'
+ ,$$PLSQL_LINE);
END produce_module_quotes;
PROCEDURE produce_install_quotes(p_enqu IN t_enqu
@@ -2401,7 +2508,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
l_regi_code regions.code%TYPE := mip_regions.get_region_for_postcode(p_enqu.install_postcode);
BEGIN
- pl('produce_install_quotes');
+ pl('produce_install_quotes'
+ ,$$PLSQL_LINE);
cout_assert.istrue(p_enqu.enty_code IN ('STD INSTALL', 'INSTALL')
,'Attempted to produce an installation quote for enquiry of type ' ||
p_enqu.enty_code);
@@ -2415,7 +2523,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_owner_prty_id => p_owner_prty_id
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
- pl('produce_install_quotes:exit');
+ pl('produce_install_quotes:exit'
+ ,$$PLSQL_LINE);
END produce_install_quotes;
PROCEDURE produce_exchange_quotes(p_enqu IN t_enqu
@@ -2424,7 +2533,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
l_regi_code regions.code%TYPE := mip_regions.get_region_for_postcode(p_enqu.install_postcode);
BEGIN
- pl('produce_exchange_quotes');
+ pl('produce_exchange_quotes'
+ ,$$PLSQL_LINE);
cout_assert.istrue(p_enqu.enty_code IN ('EXCHANGE')
,'Attempted to produce an exchange quote for enquiry of type ' ||
p_enqu.enty_code);
@@ -2446,7 +2556,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
l_regi_code regions.code%TYPE := mip_regions.get_region_for_postcode(p_enqu.install_postcode);
BEGIN
- pl('produce_change_capacity_quotes');
+ pl('produce_change_capacity_quotes'
+ ,$$PLSQL_LINE);
cout_assert.istrue(p_enqu.enty_code IN ('CHANGE CAPACITY')
,'Attempted to produce a change capacity quote for enquiry of type ' ||
p_enqu.enty_code);
@@ -2474,8 +2585,10 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
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;
BEGIN
- pl('produce_labour_only_quotes');
+ pl('produce_labour_only_quotes'
+ ,$$PLSQL_LINE);
cout_assert.istrue(p_enqu.enty_code IN
('REMOVE', 'STD REMOVE', 'ADVERSARIAL', 'OFMAT',
'ALTERATION')
@@ -2538,12 +2651,28 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_internal_or_external => gc_internal_reason);
END IF;
+ /* Always get costs for LIFTING GEAR */
+
+ l_additional_costs := get_aico(p_adit_code => 'LIFTING GEAR'
+ ,p_regi_code => l_regi_code);
+ IF l_additional_costs.selling_price IS NULL THEN
+ l_this_is_automatic_quote := FALSE;
+ add_quote_reason(p_enqu.id
+ ,p_reason => 'Unable to find selling price for LIFTING GEAR.'
+ ,p_internal_or_external => gc_internal_reason);
+ END IF;
+ IF l_additional_costs.lead_time IS NULL THEN
+ l_this_is_automatic_quote := FALSE;
+ add_quote_reason(p_enqu.id
+ ,p_reason => 'Unable to find lead time for LIFTING GEAR.'
+ ,p_internal_or_external => gc_internal_reason);
+ END IF;
+
IF l_this_is_automatic_quote THEN
l_produced_automatic_quote := TRUE;
add_quote_reason(p_enqu_id => p_enqu.id
- ,p_reason => '
- producing an automatic quote. '
+ ,p_reason => 'producing an automatic quote. '
,p_internal_or_external => gc_internal_reason);
l_qute_id := start_quote(p_enqu_id => p_enqu.id
@@ -2576,11 +2705,31 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,l_lead_time
,'LQI');
+ /* Always include LIFTING GEAR */
+
+ INSERT INTO quote_items
+ (id
+ ,qute_id
+ ,adit_code
+ ,cost_price
+ ,selling_price
+ ,delivery_price
+ ,lead_time
+ ,quit_type)
+ VALUES
+ (quit_seq.NEXTVAL
+ ,l_qute_id
+ ,'LIFTING GEAR'
+ ,l_additional_costs.cost_price
+ ,l_additional_costs.selling_price
+ ,l_additional_costs.delivery_cost
+ ,l_additional_costs.lead_time
+ ,'AQI');
+
-- Generate the quote PDF
l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id);
add_quote_reason(p_enqu_id => p_enqu.id
- ,p_reason => '
- produced quote document ' ||
+ ,p_reason => 'produced quote document ' ||
l_quote_document || ' . '
,p_internal_or_external => gc_internal_reason);
@@ -2664,7 +2813,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_bypass_costs t_rec_additional_costs;
l_quote_document VARCHAR2(240);
BEGIN
- pl('produce_addon_quotes');
+ pl('produce_addon_quotes'
+ ,$$PLSQL_LINE);
cout_assert.istrue(p_enqu.enty_code IN ('ADDON')
,'Attempted to produce an ADDON quote for enquiry of type ' ||
@@ -2882,7 +3032,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
BEGIN
- pl('produce_automatic_quotes');
+ pl('produce_automatic_quotes'
+ ,$$PLSQL_LINE);
cout_assert.istrue(p_manual_or_automatic_quote = gc_automatic_quote
,p_message => 'Attempted to produce automatic quote for enquiry marked as manual only');
@@ -2916,7 +3067,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
cout_err.report_and_stop(p_exception_message => 'Attempted to produce automatic quote for unexpected enquiry type of ' ||
p_enqu.enty_code);
END IF;
- pl('produce_automatic_quotes:exit');
+ pl('produce_automatic_quotes:exit'
+ ,$$PLSQL_LINE);
END produce_automatic_quotes;
PROCEDURE produce_quotes(p_enqu_id IN enquiries.id%TYPE
@@ -2925,10 +3077,12 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_manual_or_automatic_quote t_manual_or_automatic_quote;
l_enqu t_enqu;
BEGIN
- pl('produce_quotes');
+ pl('produce_quotes'
+ ,$$PLSQL_LINE);
IF NOT ready_for_quote(p_enqu_id) THEN
pl('Not all mandatory fields for Enquiry ID=' || p_enqu_id ||
- ' have been completed');
+ ' have been completed'
+ ,$$PLSQL_LINE);
END IF;
cout_assert.istrue(ready_for_quote(p_enqu_id)
,'Not all mandatory fields for Enquiry ID=' ||
@@ -2960,7 +3114,6 @@ 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_agent_aq_available(p_enqu_id);
ELSE
request_manual_quote(p_enqu_id => l_enqu.id
,p_rfq_prty_id => p_rfq_prty_id
@@ -2971,15 +3124,18 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
END IF; -- tripartite agreement
- pl('exit without error');
+ pl('exit without error'
+ ,$$PLSQL_LINE);
EXCEPTION
WHEN OTHERS THEN
- pl(SQLERRM);
+ pl(SQLERRM
+ ,$$PLSQL_LINE);
RAISE;
END produce_quotes;
BEGIN
-- Initialization
- pl('mip_quotation');
+ pl('mip_quotation'
+ ,$$PLSQL_LINE);
END mip_quotation;
/
diff --git a/Schema/InstallMIP.sql b/Schema/InstallMIP.sql
index 3998745..fb64137 100644
--- a/Schema/InstallMIP.sql
+++ b/Schema/InstallMIP.sql
@@ -7,7 +7,7 @@ grant create any view, create any directory to &3;
grant create library to &3;
grant debug connect session, javauserpriv to &3;
grant execute on dbms_sql to &3;
-grant create any procedure to &3;
+grant create procedure to &3;
grant execute on plpdf.plpdf to &3;
grant execute on plpdf.plpdf_img to &3;