Updated LeadTimes.csv and modules in line with Gareths email of 20/2/2008

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3648 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
hardya
2008-02-20 18:24:35 +00:00
parent 04581befd1
commit cc3f165ee5
15 changed files with 288 additions and 163 deletions

View File

@@ -758,7 +758,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_agent_comt_code enquiries.agent_comt_code%TYPE;
l_agent_contact_value enquiries.agent_contact_value%TYPE;
l_email_recipient system_configuration.VALUE%TYPE;
l_email_subject VARCHAR2(80);
l_email_subject VARCHAR2(240);
l_agent_first_name parties.first_name%TYPE;
l_agent_last_name parties.last_name%TYPE;
l_agent_prty_id parties.id%TYPE;
@@ -849,6 +849,8 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
pl('mip_email.send_email_clob returned ' || SQLERRM);
END;
pl('email_quotes_available:exit');
END email_quotes_available;
PROCEDURE email_rfq_submitted(p_enqu_id IN enquiries.id%TYPE) IS
@@ -1649,6 +1651,46 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
RAISE;
END get_lead_time;
FUNCTION get_lead_time_desc(p_enty_code enquiry_types.code%TYPE
,p_mety_code meter_types.code%TYPE
,p_svcp_code service_pressures.code%TYPE
,p_qmax NUMBER) RETURN VARCHAR2 IS
l_desc VARCHAR2(400);
BEGIN
FOR l_rec IN (SELECT description
FROM (SELECT 1
,'Enquiry Type is ' || description AS description
FROM enquiry_types
WHERE code = p_enty_code
UNION
SELECT 2
,'Meter Type is ' || description
FROM meter_types
WHERE code = p_mety_code
UNION
SELECT 3
,'Service Pressure is ' || svcpt.description
FROM service_pressure_types svcpt
,service_pressures svcp
WHERE svcp.svcpt_code = svcpt.code
AND svcp.code = p_svcp_code
UNION
SELECT 4
,'Qmax is ' || p_qmax
FROM dual
WHERE p_qmax IS NOT NULL)
ORDER BY 1) LOOP
l_desc := l_desc || l_rec.description || ', ';
END LOOP;
l_desc := substr(l_desc
,1
,length(l_desc) - 2) || '.';
RETURN l_desc;
END get_lead_time_desc;
PROCEDURE produce_module_quotes(p_enqu IN t_enqu
,p_rfq_prty_id IN parties.id%TYPE
,p_owner_prty_id IN parties.id%TYPE DEFAULT NULL
@@ -1822,7 +1864,11 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
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 || '.'
l_rec_module.modu_code || '. (' ||
get_lead_time_desc(p_enty_code => p_enqu.enty_code
,p_mety_code => p_enqu.existing_mety_code
,p_svcp_code => p_enqu.required_svcp_code
,p_qmax => p_enqu.qmax) || ')'
,p_internal_or_external => gc_internal_reason);
END IF;
@@ -1999,6 +2045,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,cost_price
,selling_price
,delivery_price
,lead_time
,quit_type)
VALUES
(quit_seq.NEXTVAL
@@ -2010,6 +2057,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,l_rec_module.laco_cost_price
,l_rec_module.laco_selling_price
,l_rec_module.laco_delivery_cost
,l_rec_module.modu_lead_time
,'LQI');
INSERT INTO quote_items
@@ -2269,8 +2317,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
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_lead_time NUMBER;
l_qute_id quotes.id%TYPE;
l_additional_costs t_rec_additional_costs;
l_labour_costs t_rec_additional_costs;
l_quote_document VARCHAR2(240);
BEGIN
pl('produce_labour_only_quotes');
@@ -2296,12 +2345,12 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
l_this_is_automatic_quote := TRUE;
l_additional_costs := get_laco(p_enty_code => p_enqu.enty_code
,p_regi_code => l_regi_code
,p_mety_code => p_enqu.existing_mety_code
,p_mesc_code => p_enqu.existing_mesc_code
,p_svcp_code => p_enqu.required_svcp_code);
IF l_additional_costs.selling_price IS NULL THEN
l_labour_costs := get_laco(p_enty_code => p_enqu.enty_code
,p_regi_code => l_regi_code
,p_mety_code => p_enqu.existing_mety_code
,p_mesc_code => p_enqu.existing_mesc_code
,p_svcp_code => p_enqu.required_svcp_code);
IF l_labour_costs.selling_price IS NULL THEN
l_this_is_automatic_quote := FALSE;
add_quote_reason(p_enqu.id
,p_reason => 'Unable to find Labour Cost (selling price) for this Enquiry Type Code: ' ||
@@ -2316,11 +2365,27 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,p_internal_or_external => gc_internal_reason);
END IF;
l_lead_time := get_lead_time(p_enty_code => p_enqu.enty_code
,p_mety_code => p_enqu.existing_mety_code
,p_svcp_code => p_enqu.required_svcp_code
,p_qmax => p_enqu.qmax);
IF l_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 ' ||
get_lead_time_desc(p_enty_code => p_enqu.enty_code
,p_mety_code => p_enqu.existing_mety_code
,p_svcp_code => p_enqu.required_svcp_code
,p_qmax => p_enqu.qmax)
,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
@@ -2338,24 +2403,27 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
,cost_price
,selling_price
,delivery_price
,lead_time
,quit_type)
VALUES
(quit_seq.NEXTVAL
,l_qute_id
,p_enqu.enty_code
,l_additional_costs.svcpt_code
,l_labour_costs.svcpt_code
,p_enqu.existing_mesc_code
,p_enqu.existing_mety_code
,l_additional_costs.cost_price
,l_additional_costs.selling_price
,l_additional_costs.delivery_cost
,l_labour_costs.cost_price
,l_labour_costs.selling_price
,l_labour_costs.delivery_cost
,l_lead_time
,'LQI');
-- 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 ' ||
l_quote_document || '.'
,p_reason => '
produced quote document ' ||
l_quote_document || ' . '
,p_internal_or_external => gc_internal_reason);
make_quote_available(l_qute_id);
@@ -2365,7 +2433,7 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.');
IF l_produced_automatic_quote THEN
p_manual_or_automatic_quote := gc_automatic_quote;
add_quote_reason(p_enqu_id => p_enqu.id
,p_reason => '-- Produced an automatic quote.'
,p_reason => ' -- Produced an automatic quote.'
,p_internal_or_external => gc_internal_reason);
ELSE
p_manual_or_automatic_quote := gc_manual_quote;