mip_quotation.pck addresses #446 (Site Survey Rules) and #465 (Lifting Gear Rules)

mip_bulk_load.pck moved 'init' to package initialization to allow procedures other than load_all be run in isolation.

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@4753 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
hardya
2008-04-09 16:22:28 +00:00
parent ad7a23f54e
commit 1b445a73e1
2 changed files with 142 additions and 252 deletions

View File

@@ -28,12 +28,15 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
g_other_manufacturer_id parties.id%TYPE; g_other_manufacturer_id parties.id%TYPE;
PROCEDURE pl(p_in IN VARCHAR2, p_line IN NUMBER DEFAULT NULL) IS PROCEDURE pl(p_in IN VARCHAR2
,p_line IN NUMBER DEFAULT NULL) IS
BEGIN BEGIN
NULL; NULL;
--$IF $$DEBUGGING OR mip_debug_constants.debugging OR mip_debug_constants.bulk_load $THEN --$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); mip_debug.pl(p_unit => $$PLSQL_UNIT
--$END ,p_line => p_line
,p_in => p_in);
--$END
END pl; END pl;
PROCEDURE get_dir_list(p_directory IN VARCHAR2) AS PROCEDURE get_dir_list(p_directory IN VARCHAR2) AS
@@ -1390,43 +1393,43 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
-- Labour costs -- Labour costs
-- --
FOR l_enty IN (SELECT code FOR l_enty IN (SELECT code
,CASE code ,CASE code
/* INSTALL */ /* INSTALL */
WHEN 'INSTALL' THEN WHEN 'INSTALL' THEN
'INSTALL' 'INSTALL'
WHEN 'STD INSTALL' THEN WHEN 'STD INSTALL' THEN
'INSTALL' 'INSTALL'
/* REMOVE */ /* REMOVE */
WHEN 'ADVERSARIAL' THEN WHEN 'ADVERSARIAL' THEN
'REMOVE' 'REMOVE'
WHEN 'REMOVE' THEN WHEN 'REMOVE' THEN
'REMOVE' 'REMOVE'
WHEN 'STD REMOVE' THEN WHEN 'STD REMOVE' THEN
'REMOVE' 'REMOVE'
/* CHANGE CAPACITY */ /* CHANGE CAPACITY */
WHEN 'CHANGE CAPACITY' THEN WHEN 'CHANGE CAPACITY' THEN
'CHANGE CAPACITY' 'CHANGE CAPACITY'
/* ADDON */ /* ADDON */
WHEN 'ADDON' THEN WHEN 'ADDON' THEN
'ADDON' 'ADDON'
/* EXCHANGE */ /* EXCHANGE */
WHEN 'EXCHANGE' THEN WHEN 'EXCHANGE' THEN
'EXCHANGE' 'EXCHANGE'
WHEN 'STD EXCHANGE' THEN WHEN 'STD EXCHANGE' THEN
'EXCHANGE' 'EXCHANGE'
WHEN 'ALTERATION' THEN WHEN 'ALTERATION' THEN
'EXCHANGE' 'EXCHANGE'
/* OFMAT */ /* OFMAT */
WHEN 'OFMAT' THEN WHEN 'OFMAT' THEN
'OFMAT' 'OFMAT'
/* OTHER */ /* OTHER */
WHEN 'OTHER' THEN WHEN 'OTHER' THEN
'OTHER' 'OTHER'
/* ERROR */ /* ERROR */
ELSE ELSE
'ERR:' || code 'ERR:' || code
END gen_enq_type END gen_enq_type
FROM enquiry_types) LOOP FROM enquiry_types) LOOP
FOR l_network IN 1 .. 8 LOOP FOR l_network IN 1 .. 8 LOOP
MERGE INTO costs cos MERGE INTO costs cos
USING (SELECT * USING (SELECT *
@@ -1463,7 +1466,7 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
to_date(valid_to to_date(valid_to
,'dd/mm/yyyy') ,'dd/mm/yyyy')
END AS valid_to END AS valid_to
,l_enty.code AS enty_code /*,upper(TRIM(enty_code)) AS enty_code */ ,l_enty.code AS enty_code /*,upper(TRIM(enty_code)) AS enty_code */
,upper(REPLACE(TRIM(mesc_code) ,upper(REPLACE(TRIM(mesc_code)
,'"' ,'"'
,'inch')) AS mesc_code ,'inch')) AS mesc_code
@@ -1767,13 +1770,12 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
pl('report_err'); pl('report_err');
FOR l_rec IN (SELECT * FOR l_rec IN (SELECT *
FROM err$_meters) LOOP FROM err$_meters) LOOP
pl('meters:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' || pl('meters:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
l_rec.ora_err_optyp$); l_rec.ora_err_optyp$);
END LOOP; END LOOP;
FOR l_rec IN (SELECT * FOR l_rec IN (SELECT *
FROM err$_bases) LOOP FROM err$_bases) LOOP
pl('bases:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' || pl('bases:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
@@ -1785,19 +1787,19 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
pl('housings:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' || pl('housings:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
l_rec.ora_err_optyp$); l_rec.ora_err_optyp$);
END LOOP; END LOOP;
FOR l_rec IN (SELECT * FOR l_rec IN (SELECT *
FROM err$_modules) LOOP FROM err$_modules) LOOP
pl('modules:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' || pl('modules:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
l_rec.ora_err_optyp$); l_rec.ora_err_optyp$);
END LOOP; END LOOP;
FOR l_rec IN (SELECT * FOR l_rec IN (SELECT *
FROM err$_postcodes) LOOP FROM err$_postcodes) LOOP
pl('postcodes:' || l_rec.ora_err_mesg$ || ':' || pl('postcodes:' || l_rec.ora_err_mesg$ || ':' ||
l_rec.ora_err_rowid$ || ':' || l_rec.ora_err_optyp$); l_rec.ora_err_rowid$ || ':' || l_rec.ora_err_optyp$);
END LOOP; END LOOP;
FOR l_rec IN (SELECT * FOR l_rec IN (SELECT *
FROM err$_costs) LOOP FROM err$_costs) LOOP
pl('costs:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' || pl('costs:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
@@ -1809,21 +1811,19 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
pl('caveats:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' || pl('caveats:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
l_rec.ora_err_optyp$); l_rec.ora_err_optyp$);
END LOOP; END LOOP;
FOR l_rec IN (SELECT * FOR l_rec IN (SELECT *
FROM err$_lead_times) LOOP FROM err$_lead_times) LOOP
pl('lead_times:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' || pl('lead_times:' || l_rec.ora_err_mesg$ || ':' ||
l_rec.ora_err_optyp$); l_rec.ora_err_rowid$ || ':' || l_rec.ora_err_optyp$);
END LOOP; END LOOP;
pl('report_err - complete'); pl('report_err - complete');
END report_err; END report_err;
PROCEDURE load_all IS PROCEDURE load_all IS
BEGIN BEGIN
init;
load_meters; load_meters;
load_bases; load_bases;
load_housings; load_housings;
@@ -1838,5 +1838,7 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
END load_all; END load_all;
BEGIN
init;
END mip_bulk_load; END mip_bulk_load;
/ /

View File

@@ -254,7 +254,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_description quote_events.description%TYPE DEFAULT NULL ,p_description quote_events.description%TYPE DEFAULT NULL
,p_event_date DATE DEFAULT SYSDATE) IS ,p_event_date DATE DEFAULT SYSDATE) IS
BEGIN BEGIN
pl('add_quote_event:entry:' || p_qute_id || ':' || p_qust_code); pl('add_quote_event:entry:' || p_qute_id || ':' || p_qust_code
,$$PLSQL_LINE);
INSERT INTO quote_events INSERT INTO quote_events
(qute_id (qute_id
,qust_code ,qust_code
@@ -267,6 +268,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,p_event_date ,p_event_date
,p_description ,p_description
,quev_seq.NEXTVAL); ,quev_seq.NEXTVAL);
pl('add_quote_event:exit'
,$$PLSQL_LINE);
END add_quote_event; END add_quote_event;
PROCEDURE add_enquiry_event(p_enqu_id IN enquiries.id%TYPE PROCEDURE add_enquiry_event(p_enqu_id IN enquiries.id%TYPE
@@ -618,7 +621,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
RETURN quotes.id%TYPE IS RETURN quotes.id%TYPE IS
l_qute_id quotes.id%TYPE; l_qute_id quotes.id%TYPE;
BEGIN BEGIN
pl('start_quote:entry'
,$$PLSQL_LINE);
INSERT INTO quotes INSERT INTO quotes
(id (id
,qute_type ,qute_type
@@ -666,6 +670,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,'Q OWN' ,'Q OWN'
,SYSDATE); ,SYSDATE);
pl('start_quote:exit'
,$$PLSQL_LINE);
RETURN l_qute_id; RETURN l_qute_id;
END start_quote; END start_quote;
@@ -1487,22 +1493,24 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_field_name IN VARCHAR2) RETURN VARCHAR2 IS ,p_field_name IN VARCHAR2) RETURN VARCHAR2 IS
l_error_message validation_results.error_message%TYPE; l_error_message validation_results.error_message%TYPE;
BEGIN BEGIN
/* pl('validation_result enqu_id=' || p_enqu_id || ', field_name=' || pl('validation_result:entry:' || p_enqu_id || ':' || p_field_name
p_field_name);*/ ,$$PLSQL_LINE);
SELECT error_message SELECT error_message
INTO l_error_message INTO l_error_message
FROM validation_results FROM validation_results
WHERE field_name = upper(p_field_name) WHERE field_name = upper(p_field_name)
AND enqu_id = p_enqu_id; AND enqu_id = p_enqu_id;
/*pl('returning ' || l_error_message);*/ pl('validation_result:exit:' || l_error_message
,$$PLSQL_LINE);
RETURN l_error_message; RETURN l_error_message;
EXCEPTION EXCEPTION
WHEN no_data_found THEN WHEN no_data_found THEN
/* pl('Nothing found');*/ pl('validation_result:exit:NDF'
,$$PLSQL_LINE);
RETURN NULL; RETURN NULL;
WHEN OTHERS THEN WHEN OTHERS THEN
pl('validation_result:' || SQLERRM pl('validation_result:exit:EXCEPTION:' || SQLERRM
,$$PLSQL_LINE); ,$$PLSQL_LINE);
RAISE; RAISE;
END validation_result; END validation_result;
@@ -1722,68 +1730,24 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
pl('survey_required' pl('survey_required'
,$$PLSQL_LINE); ,$$PLSQL_LINE);
p_manual_or_automatic_quote := gc_automatic_quote;
-- Site survey required for: -- Site survey required for:
-- LP or MP Alteration -- Existing meter is (rotary or turbine) AND OFMAT enquiry;
-- Exchange (including Capacity Change); UNLESS
-- LP and existing meter is Diaphragm; OR
-- MP and upgrade is within 1 'U' size
IF p_enqu.enty_code = 'ALTERATION' IF p_enqu.enty_code = 'OFMAT' THEN
AND p_enqu.required_svcp_code IN ('LP', 'MP') THEN
p_manual_or_automatic_quote := gc_manual_quote;
add_quote_reason(p_enqu.id
,'Site Survey is required for alteration (relocation or reposition) of an existing ' ||
p_enqu.required_svcp_code || ' meter.'
,gc_external_reason);
END IF; -- ALTERATION
IF p_enqu.enty_code IN ('EXCHANGE', 'STD EXCHANGE', 'CHANGE CAPACITY') THEN
SELECT svcpt_code
INTO l_svcpt_code
FROM service_pressures
WHERE code = p_enqu.required_svcp_code;
-- get existing meter details -- get existing meter details
l_rec_metr_details := get_existing_metr_details(p_enqu); l_rec_metr_details := get_existing_metr_details(p_enqu);
IF l_svcpt_code = 'LP' IF l_rec_metr_details.mety_code IN ('ROTARY', 'TURBINE') THEN
AND l_rec_metr_details.mety_code = 'DIAPHRAGM' THEN
p_manual_or_automatic_quote := gc_automatic_quote;
ELSIF l_svcpt_code <> 'MP' THEN
p_manual_or_automatic_quote := gc_manual_quote; p_manual_or_automatic_quote := gc_manual_quote;
add_quote_reason(p_enqu.id add_quote_reason(p_enqu.id
,'Site Survey is required for exchange of an existing ' || ,'Site Survey is required for OFMAT of an existing ' ||
l_svcpt_code || ' ' || initcap(l_rec_metr_details.mety_code) ||
l_rec_metr_details.mety_code || ' meter.' ' meter.'
,gc_external_reason); ,gc_external_reason);
ELSE END IF; -- ROTARY / TURBINE
-- Exchange, MP END IF; -- OFMAT
IF p_enqu.existing_mety_code <> 'DIAPHRAGM' THEN
p_manual_or_automatic_quote := gc_manual_quote;
add_quote_reason(p_enqu.id
,'Site Survey is required for exchange of an existing non-diaphragm meter.'
,gc_external_reason);
ELSE
-- Exchange, MP, Diaphragm
l_required_mesc_code := p_enqu.required_mesc_code;
IF l_required_mesc_code IS NULL THEN
l_required_mesc_code := get_u_meter_size(p_enqu.qmax);
END IF;
IF NOT
valid_meter_size_change(p_existing_meter_size_code => l_rec_metr_details.mesc_code
,p_required_meter_size_code => l_required_mesc_code) THEN
p_manual_or_automatic_quote := gc_manual_quote;
add_quote_reason(p_enqu.id
,'Site Survey is required for exchange of diaphragm meter from size ' ||
l_rec_metr_details.mesc_code || ' to ' ||
l_required_mesc_code || '.'
,gc_external_reason);
END IF;
END IF; -- DIAPHRAGM
END IF; -- svcpt_code <> 'MP'
END IF; -- EXCHANGE
END survey_required; END survey_required;
@@ -2316,104 +2280,20 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_internal_or_external => gc_internal_reason); ,p_internal_or_external => gc_internal_reason);
END IF; END IF;
IF p_enqu.enty_code IN ('CHANGE CAPACITY', 'EXCHANGE', 'STD EXCHANGE') THEN pl('p_enqu.required_mesc_code:' || p_enqu.required_mesc_code
-- get existing meter details ,$$PLSQL_LINE);
l_existing_rec_metr_details := get_existing_metr_details(p_enqu); pl('p_enqu.qmax:' || p_enqu.qmax
pl('existing meter:' || l_existing_rec_metr_details.code || ':' || ,$$PLSQL_LINE);
l_existing_rec_metr_details.mesc_code || ':' ||
l_existing_rec_metr_details.mety_code || ':' || IF p_enqu.required_mesc_code IS NOT NULL
l_existing_rec_metr_details.prty_id AND p_enqu.required_mesc_code <> 'OTHER' THEN
,$$PLSQL_LINE); l_required_qmax := get_qmax_from_mesc(p_enqu.required_mesc_code);
add_quote_reason(p_enqu.id
,'Existing meter details. Meter model is ' ||
nvl(l_existing_rec_metr_details.code
,'UNKNOWN') || ', meter size code is ' ||
nvl(l_existing_rec_metr_details.mesc_code
,'UNKNOWN') || ', meter type is ' ||
nvl(l_existing_rec_metr_details.mety_code
,'UNKNOWN')
,gc_internal_reason);
-- Need to follow the 'site survey' rule:
-- All exchanges require a site survey UNLESS
-- the service pressure is LP and the existing meter is a Diaphragm; OR
-- the service pressure is MP and the existing meter is a Diaphragm and the
-- upgrade is within one 'U' size (up, down or same).
--
-- The enquiry should already match these rules for the requested module
--
IF p_enqu.required_svcp_code = 'LP'
AND l_existing_rec_metr_details.mety_code = 'DIAPHRAGM' THEN
-- no restrictions
pl('Existing LP Diaphragm - no restriction'
,$$PLSQL_LINE);
pl('Required Meter Size' || p_enqu.required_mesc_code
,$$PLSQL_LINE);
pl('Required Qmax' || p_enqu.qmax
,$$PLSQL_LINE);
IF p_enqu.required_mesc_code IS NOT NULL
AND p_enqu.required_mesc_code <> 'OTHER' THEN
l_required_qmax := get_qmax_from_mesc(p_enqu.required_mesc_code);
ELSE
l_required_qmax := p_enqu.qmax;
END IF;
ELSIF p_enqu.required_svcp_code = 'MP'
AND l_existing_rec_metr_details.mety_code = 'DIAPHRAGM' THEN
-- can quote for specific meter size
--
-- Need to know the 'U' size being requested
--
-- Exchange, MP, Diaphragm
l_required_mesc_code := p_enqu.required_mesc_code;
IF l_required_mesc_code IS NULL THEN
l_required_mesc_code := get_u_meter_size(p_enqu.qmax);
END IF;
-- we'll check the meter size change, but would be surprised if it gets flagged up at this point
IF NOT
valid_meter_size_change(p_existing_meter_size_code => l_existing_rec_metr_details.mesc_code
,p_required_meter_size_code => l_required_mesc_code) THEN
p_manual_or_automatic_quote := gc_manual_quote;
add_quote_reason(p_enqu.id
,'Site Survey is required for exchange of diaphragm meter from size ' ||
l_existing_rec_metr_details.mesc_code || ' to ' ||
l_required_mesc_code || '.'
,gc_external_reason);
ELSE
add_quote_reason(p_enqu.id
,'Required meter size code is ' ||
l_required_mesc_code
,gc_internal_reason);
pl('Required Meter Size Code=' || l_required_mesc_code
,$$PLSQL_LINE);
END IF;
ELSE
p_manual_or_automatic_quote := gc_manual_quote;
add_quote_reason(p_enqu.id
,'Site Survey is required for exchange of meter.'
,gc_external_reason);
END IF;
ELSE ELSE
pl('required_mesc_code=' || p_enqu.required_mesc_code l_required_qmax := p_enqu.qmax;
,$$PLSQL_LINE); END IF;
pl('qmax=' || p_enqu.qmax
,$$PLSQL_LINE); pl('l_required_qmax:' || l_required_qmax
-- the user can only request meter sizes of: ,$$PLSQL_LINE);
-- 'U' meter size code, these have associated Qmax values; OR
-- 'OTHER' - the user didn't know the meter size code!
-- in which case use the qmax value given by the user
IF p_enqu.required_mesc_code IS NOT NULL
AND p_enqu.required_mesc_code <> 'OTHER' THEN
l_required_qmax := get_qmax_from_mesc(p_enqu.required_mesc_code);
ELSE
l_required_qmax := p_enqu.qmax;
END IF;
pl('Required Qmax=' || l_required_qmax
,$$PLSQL_LINE);
END IF; -- Exchange
IF NOT p_manual_or_automatic_quote = gc_manual_quote THEN IF NOT p_manual_or_automatic_quote = gc_manual_quote THEN
@@ -2425,7 +2305,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
pl('Looking for modules to match the following: Service Pressure ' || pl('Looking for modules to match the following: Service Pressure ' ||
p_enqu.required_svcp_code || ', Outlet Pressure ' || p_enqu.required_svcp_code || ', Outlet Pressure ' ||
p_enqu.required_metering_pressure || CASE l_required_mesc_code WHEN NULL THEN p_enqu.required_metering_pressure || CASE l_required_mesc_code IS NULL WHEN TRUE THEN
'and required Qmax ' || l_required_qmax ELSE 'and required Qmax ' || l_required_qmax ELSE
'and required Meter Size Code ' || l_required_mesc_code 'and required Meter Size Code ' || l_required_mesc_code
END || '.'); END || '.');
@@ -2703,9 +2583,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
END IF; END IF;
/* Lifting gear required UNLESS Install/Standard Install of an LP Diaphragm */ /* Lifting gear required UNLESS LP Diaphragm */
IF NOT (p_enqu.enty_code IN ('INSTALL', 'STD INSTALL') AND IF NOT (l_rec_module.mety_code = 'DIAPHRAGM' AND
l_rec_module.mety_code = 'DIAPHRAGM' AND
l_rec_module.laco_svcpt_code = 'LP') THEN l_rec_module.laco_svcpt_code = 'LP') THEN
l_additional_costs := get_aico(p_adit_code => 'LIFTING GEAR' l_additional_costs := get_aico(p_adit_code => 'LIFTING GEAR'
@@ -2913,6 +2792,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,'AQI'); ,'AQI');
END IF; END IF;
pl('call mip_quotation_document.generate_quote_pdf'
,$$PLSQL_LINE);
-- Generate the quote PDF -- Generate the quote PDF
/*BEGIN*/ /*BEGIN*/
l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id); l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id);
@@ -2921,6 +2802,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
cout_err.report_and_stop; cout_err.report_and_stop;
END; END;
*/ */
pl('return mip_quotation_document.generate_quote_pdf'
,$$PLSQL_LINE);
add_quote_reason(p_enqu_id => p_enqu.id add_quote_reason(p_enqu_id => p_enqu.id
,p_reason => 'Produced Quote Document ' || ,p_reason => 'Produced Quote Document ' ||
l_quote_document || '.' l_quote_document || '.'
@@ -3099,21 +2983,25 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_internal_or_external => gc_internal_reason); ,p_internal_or_external => gc_internal_reason);
END IF; END IF;
/* Always get costs for LIFTING GEAR */ /* Lifting gear required UNLESS LP Diaphragm */
IF NOT (l_existing_rec_metr_details.mety_code = 'DIAPHRAGM' AND
l_additional_costs := get_aico(p_adit_code => 'LIFTING GEAR' l_labour_costs.svcpt_code = 'LP') THEN
,p_regi_code => l_regi_code);
IF l_additional_costs.selling_price IS NULL THEN l_additional_costs := get_aico(p_adit_code => 'LIFTING GEAR'
l_this_is_automatic_quote := FALSE; ,p_regi_code => l_regi_code);
add_quote_reason(p_enqu.id IF l_additional_costs.selling_price IS NULL THEN
,p_reason => 'Unable to find selling price for LIFTING GEAR.' l_this_is_automatic_quote := FALSE;
,p_internal_or_external => gc_internal_reason); add_quote_reason(p_enqu.id
END IF; ,p_reason => 'Unable to find selling price for LIFTING GEAR.'
IF l_additional_costs.lead_time IS NULL THEN ,p_internal_or_external => gc_internal_reason);
l_this_is_automatic_quote := FALSE; END IF;
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find lead time for LIFTING GEAR.' IF l_additional_costs.lead_time IS NULL THEN
,p_internal_or_external => gc_internal_reason); 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;
END IF; END IF;
IF l_this_is_automatic_quote THEN IF l_this_is_automatic_quote THEN
@@ -3153,26 +3041,26 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,l_lead_time ,l_lead_time
,'LQI'); ,'LQI');
/* Always include LIFTING GEAR */ IF l_additional_costs.selling_price IS NOT NULL THEN
INSERT INTO quote_items
INSERT INTO quote_items (id
(id ,qute_id
,qute_id ,adit_code
,adit_code ,cost_price
,cost_price ,selling_price
,selling_price ,delivery_price
,delivery_price ,lead_time
,lead_time ,quit_type)
,quit_type) VALUES
VALUES (quit_seq.NEXTVAL
(quit_seq.NEXTVAL ,l_qute_id
,l_qute_id ,'LIFTING GEAR'
,'LIFTING GEAR' ,l_additional_costs.cost_price
,l_additional_costs.cost_price ,l_additional_costs.selling_price
,l_additional_costs.selling_price ,l_additional_costs.delivery_cost
,l_additional_costs.delivery_cost ,l_additional_costs.lead_time
,l_additional_costs.lead_time ,'AQI');
,'AQI'); END IF;
-- Generate the quote PDF -- Generate the quote PDF
l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id); l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id);