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:
@@ -28,12 +28,15 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
@@ -1390,43 +1393,43 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
|
||||
-- Labour costs
|
||||
--
|
||||
FOR l_enty IN (SELECT code
|
||||
,CASE code
|
||||
/* INSTALL */
|
||||
WHEN 'INSTALL' THEN
|
||||
'INSTALL'
|
||||
WHEN 'STD INSTALL' THEN
|
||||
'INSTALL'
|
||||
/* REMOVE */
|
||||
WHEN 'ADVERSARIAL' THEN
|
||||
'REMOVE'
|
||||
WHEN 'REMOVE' THEN
|
||||
'REMOVE'
|
||||
WHEN 'STD REMOVE' THEN
|
||||
'REMOVE'
|
||||
/* CHANGE CAPACITY */
|
||||
WHEN 'CHANGE CAPACITY' THEN
|
||||
'CHANGE CAPACITY'
|
||||
/* ADDON */
|
||||
WHEN 'ADDON' THEN
|
||||
'ADDON'
|
||||
/* EXCHANGE */
|
||||
WHEN 'EXCHANGE' THEN
|
||||
'EXCHANGE'
|
||||
WHEN 'STD EXCHANGE' THEN
|
||||
'EXCHANGE'
|
||||
WHEN 'ALTERATION' THEN
|
||||
'EXCHANGE'
|
||||
/* OFMAT */
|
||||
WHEN 'OFMAT' THEN
|
||||
'OFMAT'
|
||||
/* OTHER */
|
||||
WHEN 'OTHER' THEN
|
||||
'OTHER'
|
||||
/* ERROR */
|
||||
ELSE
|
||||
'ERR:' || code
|
||||
END gen_enq_type
|
||||
FROM enquiry_types) LOOP
|
||||
,CASE code
|
||||
/* INSTALL */
|
||||
WHEN 'INSTALL' THEN
|
||||
'INSTALL'
|
||||
WHEN 'STD INSTALL' THEN
|
||||
'INSTALL'
|
||||
/* REMOVE */
|
||||
WHEN 'ADVERSARIAL' THEN
|
||||
'REMOVE'
|
||||
WHEN 'REMOVE' THEN
|
||||
'REMOVE'
|
||||
WHEN 'STD REMOVE' THEN
|
||||
'REMOVE'
|
||||
/* CHANGE CAPACITY */
|
||||
WHEN 'CHANGE CAPACITY' THEN
|
||||
'CHANGE CAPACITY'
|
||||
/* ADDON */
|
||||
WHEN 'ADDON' THEN
|
||||
'ADDON'
|
||||
/* EXCHANGE */
|
||||
WHEN 'EXCHANGE' THEN
|
||||
'EXCHANGE'
|
||||
WHEN 'STD EXCHANGE' THEN
|
||||
'EXCHANGE'
|
||||
WHEN 'ALTERATION' THEN
|
||||
'EXCHANGE'
|
||||
/* OFMAT */
|
||||
WHEN 'OFMAT' THEN
|
||||
'OFMAT'
|
||||
/* OTHER */
|
||||
WHEN 'OTHER' THEN
|
||||
'OTHER'
|
||||
/* ERROR */
|
||||
ELSE
|
||||
'ERR:' || code
|
||||
END gen_enq_type
|
||||
FROM enquiry_types) LOOP
|
||||
FOR l_network IN 1 .. 8 LOOP
|
||||
MERGE INTO costs cos
|
||||
USING (SELECT *
|
||||
@@ -1463,7 +1466,7 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
|
||||
to_date(valid_to
|
||||
,'dd/mm/yyyy')
|
||||
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)
|
||||
,'"'
|
||||
,'inch')) AS mesc_code
|
||||
@@ -1767,7 +1770,6 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
|
||||
|
||||
pl('report_err');
|
||||
|
||||
|
||||
FOR l_rec IN (SELECT *
|
||||
FROM err$_meters) LOOP
|
||||
pl('meters:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
|
||||
@@ -1810,10 +1812,10 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
|
||||
l_rec.ora_err_optyp$);
|
||||
END LOOP;
|
||||
|
||||
FOR l_rec IN (SELECT *
|
||||
FOR l_rec IN (SELECT *
|
||||
FROM err$_lead_times) LOOP
|
||||
pl('lead_times:' || l_rec.ora_err_mesg$ || ':' || l_rec.ora_err_rowid$ || ':' ||
|
||||
l_rec.ora_err_optyp$);
|
||||
pl('lead_times:' || l_rec.ora_err_mesg$ || ':' ||
|
||||
l_rec.ora_err_rowid$ || ':' || l_rec.ora_err_optyp$);
|
||||
END LOOP;
|
||||
|
||||
pl('report_err - complete');
|
||||
@@ -1822,8 +1824,6 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
|
||||
PROCEDURE load_all IS
|
||||
BEGIN
|
||||
|
||||
init;
|
||||
|
||||
load_meters;
|
||||
load_bases;
|
||||
load_housings;
|
||||
@@ -1838,5 +1838,7 @@ CREATE OR REPLACE PACKAGE BODY mip_bulk_load IS
|
||||
|
||||
END load_all;
|
||||
|
||||
BEGIN
|
||||
init;
|
||||
END mip_bulk_load;
|
||||
/
|
||||
|
||||
@@ -254,7 +254,8 @@ 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);
|
||||
pl('add_quote_event:entry:' || p_qute_id || ':' || p_qust_code
|
||||
,$$PLSQL_LINE);
|
||||
INSERT INTO quote_events
|
||||
(qute_id
|
||||
,qust_code
|
||||
@@ -267,6 +268,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
||||
,p_event_date
|
||||
,p_description
|
||||
,quev_seq.NEXTVAL);
|
||||
pl('add_quote_event:exit'
|
||||
,$$PLSQL_LINE);
|
||||
END add_quote_event;
|
||||
|
||||
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
|
||||
l_qute_id quotes.id%TYPE;
|
||||
BEGIN
|
||||
|
||||
pl('start_quote:entry'
|
||||
,$$PLSQL_LINE);
|
||||
INSERT INTO quotes
|
||||
(id
|
||||
,qute_type
|
||||
@@ -666,6 +670,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
|
||||
,'Q OWN'
|
||||
,SYSDATE);
|
||||
|
||||
pl('start_quote:exit'
|
||||
,$$PLSQL_LINE);
|
||||
RETURN l_qute_id;
|
||||
|
||||
END start_quote;
|
||||
@@ -1487,22 +1493,24 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
,p_field_name IN VARCHAR2) RETURN VARCHAR2 IS
|
||||
l_error_message validation_results.error_message%TYPE;
|
||||
BEGIN
|
||||
/* pl('validation_result enqu_id=' || p_enqu_id || ', field_name=' ||
|
||||
p_field_name);*/
|
||||
pl('validation_result:entry:' || p_enqu_id || ':' || p_field_name
|
||||
,$$PLSQL_LINE);
|
||||
|
||||
SELECT error_message
|
||||
INTO l_error_message
|
||||
FROM validation_results
|
||||
WHERE field_name = upper(p_field_name)
|
||||
AND enqu_id = p_enqu_id;
|
||||
/*pl('returning ' || l_error_message);*/
|
||||
pl('validation_result:exit:' || l_error_message
|
||||
,$$PLSQL_LINE);
|
||||
RETURN l_error_message;
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
/* pl('Nothing found');*/
|
||||
pl('validation_result:exit:NDF'
|
||||
,$$PLSQL_LINE);
|
||||
RETURN NULL;
|
||||
WHEN OTHERS THEN
|
||||
pl('validation_result:' || SQLERRM
|
||||
pl('validation_result:exit:EXCEPTION:' || SQLERRM
|
||||
,$$PLSQL_LINE);
|
||||
RAISE;
|
||||
END validation_result;
|
||||
@@ -1722,68 +1730,24 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
pl('survey_required'
|
||||
,$$PLSQL_LINE);
|
||||
|
||||
p_manual_or_automatic_quote := gc_automatic_quote;
|
||||
|
||||
-- Site survey required for:
|
||||
-- LP or MP Alteration
|
||||
-- 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'
|
||||
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;
|
||||
-- Existing meter is (rotary or turbine) AND OFMAT enquiry;
|
||||
|
||||
IF p_enqu.enty_code = 'OFMAT' THEN
|
||||
-- get existing meter details
|
||||
l_rec_metr_details := get_existing_metr_details(p_enqu);
|
||||
|
||||
IF l_svcpt_code = 'LP'
|
||||
AND l_rec_metr_details.mety_code = 'DIAPHRAGM' THEN
|
||||
p_manual_or_automatic_quote := gc_automatic_quote;
|
||||
ELSIF l_svcpt_code <> 'MP' THEN
|
||||
IF l_rec_metr_details.mety_code IN ('ROTARY', 'TURBINE') THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for exchange of an existing ' ||
|
||||
l_svcpt_code || ' ' ||
|
||||
l_rec_metr_details.mety_code || ' meter.'
|
||||
,'Site Survey is required for OFMAT of an existing ' ||
|
||||
initcap(l_rec_metr_details.mety_code) ||
|
||||
' meter.'
|
||||
,gc_external_reason);
|
||||
ELSE
|
||||
-- Exchange, MP
|
||||
IF p_enqu.existing_mety_code <> 'DIAPHRAGM' THEN
|
||||
p_manual_or_automatic_quote := gc_manual_quote;
|
||||
add_quote_reason(p_enqu.id
|
||||
,'Site Survey is required for exchange of an existing non-diaphragm meter.'
|
||||
,gc_external_reason);
|
||||
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 IF; -- ROTARY / TURBINE
|
||||
END IF; -- OFMAT
|
||||
|
||||
END survey_required;
|
||||
|
||||
@@ -2316,104 +2280,20 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
,p_internal_or_external => gc_internal_reason);
|
||||
END IF;
|
||||
|
||||
IF p_enqu.enty_code IN ('CHANGE CAPACITY', 'EXCHANGE', 'STD EXCHANGE') THEN
|
||||
-- get existing meter details
|
||||
l_existing_rec_metr_details := get_existing_metr_details(p_enqu);
|
||||
pl('existing meter:' || l_existing_rec_metr_details.code || ':' ||
|
||||
l_existing_rec_metr_details.mesc_code || ':' ||
|
||||
l_existing_rec_metr_details.mety_code || ':' ||
|
||||
l_existing_rec_metr_details.prty_id
|
||||
,$$PLSQL_LINE);
|
||||
pl('p_enqu.required_mesc_code:' || p_enqu.required_mesc_code
|
||||
,$$PLSQL_LINE);
|
||||
pl('p_enqu.qmax:' || p_enqu.qmax
|
||||
,$$PLSQL_LINE);
|
||||
|
||||
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;
|
||||
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
|
||||
pl('required_mesc_code=' || p_enqu.required_mesc_code
|
||||
,$$PLSQL_LINE);
|
||||
pl('qmax=' || p_enqu.qmax
|
||||
,$$PLSQL_LINE);
|
||||
-- the user can only request meter sizes of:
|
||||
-- 'U' meter size code, these have associated Qmax values; OR
|
||||
-- 'OTHER' - the user didn't know the meter size code!
|
||||
-- in which case use the qmax value given by the user
|
||||
l_required_qmax := p_enqu.qmax;
|
||||
END IF;
|
||||
|
||||
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
|
||||
pl('l_required_qmax:' || l_required_qmax
|
||||
,$$PLSQL_LINE);
|
||||
|
||||
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 ' ||
|
||||
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 Meter Size Code ' || l_required_mesc_code
|
||||
END || '.');
|
||||
@@ -2703,9 +2583,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
|
||||
END IF;
|
||||
|
||||
/* Lifting gear required UNLESS Install/Standard Install of an LP Diaphragm */
|
||||
IF NOT (p_enqu.enty_code IN ('INSTALL', 'STD INSTALL') AND
|
||||
l_rec_module.mety_code = 'DIAPHRAGM' AND
|
||||
/* Lifting gear required UNLESS LP Diaphragm */
|
||||
IF NOT (l_rec_module.mety_code = 'DIAPHRAGM' AND
|
||||
l_rec_module.laco_svcpt_code = 'LP') THEN
|
||||
|
||||
l_additional_costs := get_aico(p_adit_code => 'LIFTING GEAR'
|
||||
@@ -2913,6 +2792,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
,'AQI');
|
||||
END IF;
|
||||
|
||||
pl('call mip_quotation_document.generate_quote_pdf'
|
||||
,$$PLSQL_LINE);
|
||||
-- Generate the quote PDF
|
||||
/*BEGIN*/
|
||||
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;
|
||||
END;
|
||||
*/
|
||||
pl('return mip_quotation_document.generate_quote_pdf'
|
||||
,$$PLSQL_LINE);
|
||||
|
||||
add_quote_reason(p_enqu_id => p_enqu.id
|
||||
,p_reason => 'Produced Quote Document ' ||
|
||||
l_quote_document || '.'
|
||||
@@ -3099,21 +2983,25 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
|
||||
,p_internal_or_external => gc_internal_reason);
|
||||
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_labour_costs.svcpt_code = 'LP') THEN
|
||||
|
||||
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);
|
||||
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;
|
||||
END IF;
|
||||
|
||||
IF l_this_is_automatic_quote THEN
|
||||
@@ -3153,26 +3041,26 @@ 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');
|
||||
IF l_additional_costs.selling_price IS NOT NULL THEN
|
||||
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');
|
||||
END IF;
|
||||
|
||||
-- Generate the quote PDF
|
||||
l_quote_document := mip_quotation_document.generate_quote_pdf(p_quote_id => l_qute_id);
|
||||
|
||||
Reference in New Issue
Block a user