Record 'reasoning' process in the quote_reasoning table!

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3053 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
hardya
2007-12-20 17:29:10 +00:00
parent e3f9c1e5ff
commit 7926c9cbd7

View File

@@ -6,6 +6,10 @@ CREATE OR REPLACE PACKAGE mip_quotation IS
FUNCTION ready_for_quote(p_id IN enquiries.id%TYPE) RETURN BOOLEAN;
PROCEDURE ready_for_quote(p_id IN enquiries.id%TYPE
,p_mandatory_checks OUT mip_mandatory.t_mandatory_checks
,p_quote_is_ready OUT BOOLEAN);
PROCEDURE produce_quotes(p_id IN enquiries.id%TYPE);
END mip_quotation;
/
@@ -14,14 +18,9 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
SUBTYPE t_reason IS VARCHAR2(240);
SUBTYPE t_internal_or_external IS VARCHAR2(8);
TYPE t_manual_quote_reason IS RECORD(
reason t_reason
,internal_or_external t_internal_or_external);
g_internal_reason CONSTANT t_internal_or_external := 'INTERNAL';
g_external_reason CONSTANT t_internal_or_external := 'EXTERNAL';
TYPE t_tab_manual_quote_reasons IS TABLE OF t_manual_quote_reason INDEX BY BINARY_INTEGER;
SUBTYPE t_manual_or_automatic_quote IS VARCHAR2(9);
SUBTYPE t_enqu IS enquiries%ROWTYPE;
@@ -29,13 +28,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
g_manual_quote CONSTANT t_manual_or_automatic_quote := 'MANUAL';
g_automatic_quote CONSTANT t_manual_or_automatic_quote := 'AUTOMATIC';
TYPE t_rec_costs IS RECORD(
selling_price costs.selling_price%TYPE
TYPE t_rec_additional_item_costs IS RECORD(
adit_code additional_items.code%TYPE
,lead_time additional_items.lead_time%TYPE
,selling_price costs.selling_price%TYPE
,cost_price costs.cost_price%TYPE
,delivery_cost costs.delivery_cost%TYPE);
PROCEDURE request_manual_quote(p_id IN enquiries.id%TYPE
,p_tab_manual_quote_reasons IN t_tab_manual_quote_reasons) IS
PROCEDURE request_manual_quote(p_id IN enquiries.id%TYPE) IS
BEGIN
NULL;
END request_manual_quote;
@@ -59,16 +59,23 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
RETURN l_quote_is_ready;
END ready_for_quote;
PROCEDURE add_manual_quote_reason(p_tab_manual_quote_reasons IN OUT t_tab_manual_quote_reasons
,p_reason IN VARCHAR2
,p_internal_or_external IN VARCHAR2 DEFAULT g_external_reason) IS
l_idx BINARY_INTEGER;
PROCEDURE add_quote_reason(p_enqu_id IN enquiries.id%TYPE
,p_reason IN quote_reasoning.reason%TYPE
,p_internal_or_external IN quote_reasoning.internal_or_external%TYPE DEFAULT g_external_reason) IS
BEGIN
l_idx := nvl(p_tab_manual_quote_reasons.LAST
,0) + 1;
p_tab_manual_quote_reasons(l_idx).reason := p_reason;
p_tab_manual_quote_reasons(l_idx).internal_or_external := p_internal_or_external;
END add_manual_quote_reason;
INSERT INTO quote_reasoning
(enqu_id
,reason
,internal_or_external
,id)
VALUES
(p_enqu_id
,p_reason
,p_internal_or_external
,qure_seq.NEXTVAL);
END add_quote_reason;
FUNCTION get_u_meter_size(p_qmax IN NUMBER)
RETURN meter_size_codes.code%TYPE IS
@@ -112,7 +119,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
END valid_meter_size_upgrade;
PROCEDURE survey_required(p_enqu IN t_enqu
,p_tab_manual_quote_reasons IN OUT t_tab_manual_quote_reasons
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
l_svcpt_code service_pressure_types.code%TYPE;
l_existing_meter_size_code meter_size_codes.code%TYPE;
@@ -130,8 +136,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
IF l_svcpt_code = 'LP' THEN
IF p_enqu.enty_code = 'RELOCATE' THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Site Survey is required for relocation.');
add_quote_reason(p_enqu.id
,'Site Survey is required for relocation.');
END IF; -- RELOCATE
IF p_enqu.enty_code IN ('EXCHANGE', 'STD EXCHANGE') THEN
l_existing_meter_size_code := p_enqu.existing_mesc_code;
@@ -143,82 +149,85 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
valid_meter_size_upgrade(p_existing_meter_size_code => l_existing_meter_size_code
,p_required_meter_size_code => l_required_meter_size_code) THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Site Survey is required for exchange of meter from size ' ||
l_existing_meter_size_code || ' to ' ||
l_required_meter_size_code || '.');
add_quote_reason(p_enqu.id
,'Site Survey is required for exchange of meter from size ' ||
l_existing_meter_size_code || ' to ' ||
l_required_meter_size_code || '.');
END IF;
END IF; -- EXCHANGE
END IF; -- svcpt_code = 'LP'
END survey_required;
PROCEDURE manual_or_automatic_quote(p_enqu IN t_enqu
,p_manual_or_automatic_quote OUT t_manual_or_automatic_quote
,p_tab_manual_quote_reasons OUT t_tab_manual_quote_reasons) IS
,p_manual_or_automatic_quote OUT t_manual_or_automatic_quote) IS
BEGIN
p_manual_or_automatic_quote := g_automatic_quote;
survey_required(p_enqu => p_enqu
,p_tab_manual_quote_reasons => p_tab_manual_quote_reasons
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
IF p_enqu.twin_stream_required = 'YES' THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Twin stream required.');
add_quote_reason(p_enqu.id
,'Twin stream required.');
END IF;
IF p_enqu.bypass_required = 'YES' THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Bypass required.');
add_quote_reason(p_enqu.id
,'Bypass required.');
END IF;
IF p_enqu.required_metering_pressure > 21 THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Required metering pressure is greater than 21mbar.');
add_quote_reason(p_enqu.id
,'Required metering pressure is greater than 21mbar.');
END IF;
IF p_enqu.job_description IS NOT NULL THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Job Description field was entered.');
add_quote_reason(p_enqu.id
,'Job Description field was entered.');
END IF;
IF p_enqu.downstream_booster_or_compress = 'YES' THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Booster or compressor is present downstream of the meter module.');
add_quote_reason(p_enqu.id
,'Booster or compressor is present downstream of the meter module.');
END IF;
IF p_enqu.annual_quantity > 732 THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Required Annual Quantity is in excess of 732MWh.');
add_quote_reason(p_enqu.id
,'Required Annual Quantity is in excess of 732MWh.');
END IF;
-- check postcode
IF NOT mip_regions.valid_postcode_format(p_enqu.install_postcode) THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Installation postcode is of an unrecognized format.');
add_quote_reason(p_enqu.id
,'Installation postcode is of an unrecognized format.');
ELSIF mip_regions.get_region_for_postcode(p_enqu.install_postcode) IS NULL THEN
p_manual_or_automatic_quote := g_manual_quote;
add_manual_quote_reason(p_tab_manual_quote_reasons
,'Unable to determine pricing region for given installation postcode.');
add_quote_reason(p_enqu.id
,'Unable to determine pricing region for given installation postcode.');
END IF;
END manual_or_automatic_quote;
FUNCTION get_aico(p_aico_code IN costs.aico_code%TYPE
,p_regi_code IN regions.code%TYPE) RETURN t_rec_costs IS
l_rec_costs t_rec_costs;
FUNCTION get_aico(p_adit_code IN costs.adit_code%TYPE
,p_regi_code IN regions.code%TYPE)
RETURN t_rec_additional_item_costs IS
l_rec_costs t_rec_additional_item_costs;
BEGIN
SELECT selling_price
SELECT lead_time
,selling_price
,cost_price
,delivery_cost
INTO l_rec_costs.selling_price
,adit_code
INTO l_rec_costs.lead_time
,l_rec_costs.selling_price
,l_rec_costs.cost_price
,l_rec_costs.delivery_cost
,l_rec_costs.adit_code
FROM (SELECT decode(regi_code
,p_regi_code
,1
@@ -226,13 +235,16 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,selling_price
,cost_price
,delivery_cost
,adit_code
FROM v_aico cost
WHERE aico_code = p_aico_code
WHERE adit_code = p_adit_code
AND SYSDATE BETWEEN cost.effective_from AND cost.effective_to
AND regi_code = p_regi_code
OR regi_code IS NULL
ORDER BY 1)
WHERE rownum < 2;
ORDER BY 1) cost
,additional_items adit
WHERE adit.code = cost.adit_code
AND rownum < 2;
RETURN l_rec_costs;
@@ -242,14 +254,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
END get_aico;
PROCEDURE produce_install_quotes(p_enqu IN t_enqu
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote
,p_tab_manual_quote_reasons IN OUT t_tab_manual_quote_reasons) IS
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
l_produced_automatic_quote BOOLEAN;
l_this_is_automatic_quote BOOLEAN;
l_regi_code regions.code%TYPE := mip_regions.get_region_for_postcode(p_enqu.install_postcode);
l_qute_id quotes.id%TYPE;
l_item_sequence NUMBER;
l_aico_costs t_rec_costs;
l_aico_costs t_rec_additional_item_costs;
BEGIN
cout_assert.istrue(p_enqu.enty_code IN ('INSTALL', 'STD INSTALL')
,'Attempted to produce an install quote for enquiry of type ' ||
@@ -263,6 +274,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,modu.selling_price AS modu_selling_price
,modu.cost_price AS modu_cost_price
,modu.delivery_cost AS modu_delivery_cost
,modu.lead_time AS modu_lead_time
,hou.code AS hou_code
,hou.selling_price AS hou_selling_price
,hou.cost_price AS hou_cost_price
@@ -278,18 +290,26 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,metr.selling_price AS metr_selling_price
,metr.cost_price AS metr_cost_price
,metr.delivery_cost AS metr_delivery_cost
,NULL AS amr_cost_id
,NULL AS amr_selling_price
,NULL AS amr_cost_price
,NULL AS amr_delivery_cost
,NULL AS amr_lead_time
,NULL AS ems_cost_id
,NULL AS ems_selling_price
,NULL AS ems_cost_price
,NULL AS ems_delivery_cost
,NULL AS ems_lead_time
,NULL AS bypass_cost_id
,NULL AS bypass_selling_price
,NULL AS bypass_cost_price
,NULL AS bypass_delivery_cost
,NULL AS bypass_lead_time
,NULL AS logger_cost_id
,NULL AS logger_selling_price
,NULL AS logger_cost_price
,NULL AS logger_delivery_cost
,NULL AS logger_lead_time
FROM (SELECT modu.code
,modu.metr_code
,modu.hou_code
@@ -299,6 +319,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
,selling_price
,cost_price
,delivery_cost
,lead_time
FROM modules modu
,(SELECT modu_code
,selling_price
@@ -422,91 +443,131 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
p_enqu.housing_required <> 'YES'))
AND modu.hou_code = hou.code(+)) LOOP
l_this_is_automatic_quote := TRUE;
add_quote_reason(p_enqu.id
,p_reason => 'Considering module : ' ||
l_rec_module.modu_code
,p_internal_or_external => g_external_reason);
--
-- check whether we have the required prices
-- if we do not, then we may need to produce a manual quote
--
IF l_rec_module.modu_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for module ' ||
l_rec_module.modu_code
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for module ' ||
l_rec_module.modu_code || '.'
,p_internal_or_external => g_external_reason);
END IF;
IF l_rec_module.modu_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 module ' ||
l_rec_module.modu_code || '.'
,p_internal_or_external => g_external_reason);
END IF;
IF l_rec_module.metr_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for meter ' ||
l_rec_module.metr_code
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for meter ' ||
l_rec_module.metr_code || '.'
,p_internal_or_external => g_external_reason);
END IF;
IF p_enqu.base_required = 'YES'
AND l_rec_module.bas_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for base ' ||
l_rec_module.bas_code
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for base ' ||
l_rec_module.bas_code || '.'
,p_internal_or_external => g_external_reason);
END IF;
IF p_enqu.housing_required = 'YES'
AND l_rec_module.hou_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for housing ' ||
l_rec_module.hou_code
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for housing ' ||
l_rec_module.hou_code || '.'
,p_internal_or_external => g_external_reason);
END IF;
IF p_enqu.amr_required = 'YES' THEN
l_aico_costs := get_aico(p_aico_code => 'AMR'
l_aico_costs := get_aico(p_adit_code => 'AMR'
,p_regi_code => l_regi_code);
l_rec_module.amr_selling_price := l_aico_costs.selling_price;
l_rec_module.amr_cost_price := l_aico_costs.cost_price;
l_rec_module.amr_delivery_cost := l_aico_costs.delivery_cost;
l_rec_module.amr_lead_time := l_aico_costs.lead_time;
IF l_rec_module.amr_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for AMR'
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for AMR.'
,p_internal_or_external => g_external_reason);
END IF;
IF l_rec_module.amr_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 AMR.'
,p_internal_or_external => g_external_reason);
END IF;
END IF;
IF p_enqu.ems_required = 'YES' THEN
l_aico_costs := get_aico(p_aico_code => 'EMS'
l_aico_costs := get_aico(p_adit_code => 'EMS'
,p_regi_code => l_regi_code);
l_rec_module.ems_selling_price := l_aico_costs.selling_price;
l_rec_module.ems_cost_price := l_aico_costs.cost_price;
l_rec_module.ems_delivery_cost := l_aico_costs.delivery_cost;
l_rec_module.ems_lead_time := l_aico_costs.lead_time;
IF l_rec_module.ems_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for EMS'
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for EMS.'
,p_internal_or_external => g_external_reason);
END IF;
IF l_rec_module.amr_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 AMR.'
,p_internal_or_external => g_external_reason);
END IF;
END IF;
IF p_enqu.bypass_required = 'YES' THEN
l_aico_costs := get_aico(p_aico_code => 'BYPASS'
l_aico_costs := get_aico(p_adit_code => 'BYPASS'
,p_regi_code => l_regi_code);
l_rec_module.bypass_selling_price := l_aico_costs.selling_price;
l_rec_module.bypass_cost_price := l_aico_costs.cost_price;
l_rec_module.bypass_delivery_cost := l_aico_costs.delivery_cost;
l_rec_module.bypass_lead_time := l_aico_costs.lead_time;
IF l_rec_module.bypass_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for BYPASS'
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for BYPASS.'
,p_internal_or_external => g_external_reason);
END IF;
IF l_rec_module.bypass_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 BYPASS.'
,p_internal_or_external => g_external_reason);
END IF;
END IF;
IF p_enqu.logger_required = 'YES' THEN
l_aico_costs := get_aico(p_aico_code => 'LOGGER'
l_aico_costs := get_aico(p_adit_code => 'LOGGER'
,p_regi_code => l_regi_code);
l_rec_module.logger_selling_price := l_aico_costs.selling_price;
l_rec_module.logger_cost_price := l_aico_costs.cost_price;
l_rec_module.logger_delivery_cost := l_aico_costs.delivery_cost;
IF l_rec_module.logger_selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_manual_quote_reason(p_tab_manual_quote_reasons
,p_reason => 'Unable to find selling price for LOGGER'
,p_internal_or_external => g_external_reason);
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find selling price for LOGGER.'
,p_internal_or_external => g_external_reason);
END IF;
IF l_rec_module.logger_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 LOGGER.'
,p_internal_or_external => g_external_reason);
END IF;
END IF;
IF l_this_is_automatic_quote THEN
@@ -515,11 +576,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
INSERT INTO quotes
(id
,qute_type
,enqu_id)
,enqu_id
,valid_from
,valid_until)
VALUES
(qute_seq.NEXTVAL
,'AQ' -- automatic quote
,p_enqu.id)
,p_enqu.id
,trunc(SYSDATE)
,trunc(SYSDATE + 90))
RETURNING id INTO l_qute_id;
INSERT INTO quote_events
@@ -584,26 +649,99 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
END IF;
IF p_enqu.amr_required = 'YES' THEN
NULL;
l_item_sequence := l_item_sequence + 1;
INSERT INTO quote_items
(item_sequence
,qute_id
,adit_code
,cost_price
,selling_price
,delivery_price
,lead_time)
VALUES
(l_item_sequence
,l_qute_id
,'AMR'
,l_rec_module.amr_cost_price
,l_rec_module.amr_selling_price
,l_rec_module.amr_delivery_cost
,l_rec_module.amr_lead_time);
END IF;
END IF;
IF p_enqu.ems_required = 'YES' THEN
l_item_sequence := l_item_sequence + 1;
INSERT INTO quote_items
(item_sequence
,qute_id
,adit_code
,cost_price
,selling_price
,delivery_price
,lead_time)
VALUES
(l_item_sequence
,l_qute_id
,'EMS'
,l_rec_module.ems_cost_price
,l_rec_module.ems_selling_price
,l_rec_module.ems_delivery_cost
,l_rec_module.ems_lead_time);
END IF;
IF p_enqu.bypass_required = 'YES' THEN
l_item_sequence := l_item_sequence + 1;
INSERT INTO quote_items
(item_sequence
,qute_id
,adit_code
,cost_price
,selling_price
,delivery_price
,lead_time)
VALUES
(l_item_sequence
,l_qute_id
,'BYPASS'
,l_rec_module.bypass_cost_price
,l_rec_module.bypass_selling_price
,l_rec_module.bypass_delivery_cost
,l_rec_module.bypass_lead_time);
END IF;
IF p_enqu.logger_required = 'YES' THEN
l_item_sequence := l_item_sequence + 1;
INSERT INTO quote_items
(item_sequence
,qute_id
,adit_code
,cost_price
,selling_price
,delivery_price
,lead_time)
VALUES
(l_item_sequence
,l_qute_id
,'LOGGER'
,l_rec_module.logger_cost_price
,l_rec_module.logger_selling_price
,l_rec_module.logger_delivery_cost
,l_rec_module.logger_lead_time);
END IF;
END IF; -- automatic quote
END LOOP;
END produce_install_quotes;
PROCEDURE produce_automatic_quotes(p_enqu IN t_enqu
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote
,p_tab_manual_quote_reasons IN OUT t_tab_manual_quote_reasons) IS
,p_manual_or_automatic_quote IN OUT t_manual_or_automatic_quote) IS
BEGIN
cout_assert.istrue(p_manual_or_automatic_quote = g_automatic_quote
,p_message => 'Attempted to produce automatic quote for enquiry marked as manual only');
IF p_enqu.enty_code IN ('INSTALL', 'STD INSTALL') THEN
produce_install_quotes(p_enqu => p_enqu
,p_manual_or_automatic_quote => p_manual_or_automatic_quote
,p_tab_manual_quote_reasons => p_tab_manual_quote_reasons);
,p_manual_or_automatic_quote => p_manual_or_automatic_quote);
ELSE
cout_err.report_and_stop(p_exception_message => 'Attempted to produce automatic quote for unexpected enquiry type of ' ||
p_enqu.enty_code);
@@ -612,7 +750,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
PROCEDURE produce_quotes(p_id IN enquiries.id%TYPE) IS
l_manual_or_automatic_quote t_manual_or_automatic_quote;
l_tab_manual_quote_reasons t_tab_manual_quote_reasons;
l_enqu t_enqu;
BEGIN
@@ -626,19 +763,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation IS
WHERE id = p_id;
manual_or_automatic_quote(p_enqu => l_enqu
,p_manual_or_automatic_quote => l_manual_or_automatic_quote
,p_tab_manual_quote_reasons => l_tab_manual_quote_reasons);
,p_manual_or_automatic_quote => l_manual_or_automatic_quote);
IF l_manual_or_automatic_quote = g_manual_quote THEN
request_manual_quote(p_id => l_enqu.id
,p_tab_manual_quote_reasons => l_tab_manual_quote_reasons);
request_manual_quote(p_id => l_enqu.id);
ELSE
produce_automatic_quotes(p_enqu => l_enqu
,p_manual_or_automatic_quote => l_manual_or_automatic_quote
,p_tab_manual_quote_reasons => l_tab_manual_quote_reasons);
,p_manual_or_automatic_quote => l_manual_or_automatic_quote);
IF l_manual_or_automatic_quote = g_manual_quote THEN
request_manual_quote(p_id => l_enqu.id
,p_tab_manual_quote_reasons => l_tab_manual_quote_reasons);
request_manual_quote(p_id => l_enqu.id);
END IF;
--