Modify mip_quotation_document and f155.sql to use new signature on
documents. git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@25576 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -239,10 +239,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
,p_line IN NUMBER DEFAULT NULL) IS
|
||||
BEGIN
|
||||
|
||||
$IF mip_debug_constants.debugging $THEN mip_debug.pl(p_unit => $$PLSQL_UNIT
|
||||
,p_line => p_line
|
||||
,p_in => p_in);
|
||||
$END NULL;
|
||||
$IF mip_debug_constants.debugging $THEN
|
||||
mip_debug.pl(p_unit => $$PLSQL_UNIT
|
||||
,p_line => p_line
|
||||
,p_in => p_in);
|
||||
$END
|
||||
NULL;
|
||||
END pl;
|
||||
|
||||
FUNCTION get_current_font_details RETURN t_rec_font_details IS
|
||||
@@ -268,7 +270,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
l_row_data(1) := p_description;
|
||||
IF p_cost IS NOT NULL THEN
|
||||
l_row_data(2) := TO_CHAR(p_cost
|
||||
,'FML999G990D00');else
|
||||
,'FML999G990D00');
|
||||
ELSE
|
||||
l_row_data(2) := NULL;
|
||||
END IF;
|
||||
l_row_data(3) := p_suffix;
|
||||
@@ -1041,7 +1044,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
--if it's not an install or exchange get the existing meter type (will overwrite
|
||||
--current value if already set in the code above)
|
||||
IF quote_item_rec.enty_code NOT IN
|
||||
('STD EXCHANGE', 'EXCHANGE', 'INSTALL', 'STD INSTALL') THEN
|
||||
('STD EXCHANGE'
|
||||
,'EXCHANGE'
|
||||
,'INSTALL'
|
||||
,'STD INSTALL') THEN
|
||||
p_quote_data.mety_code := p_enqu_row.existing_mety_code;
|
||||
END IF;
|
||||
IF quote_item_rec.enty_code <> 'OFMAT'
|
||||
@@ -1079,7 +1085,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
--tidy up l_works so there are no blank entries
|
||||
--create an l_works_tidy variable and copy all
|
||||
--non null array entries into it
|
||||
l_works_counter := l_works.FIRST;
|
||||
l_works_counter := l_works.first;
|
||||
l_works_tidy_counter := 1;
|
||||
LOOP
|
||||
EXIT WHEN l_works_counter IS NULL;
|
||||
@@ -1087,22 +1093,22 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
l_works_tidy(l_works_tidy_counter) := l_works(l_works_counter);
|
||||
l_works_tidy_counter := l_works_tidy_counter + 1;
|
||||
END IF;
|
||||
l_works_counter := l_works.NEXT(l_works_counter);
|
||||
l_works_counter := l_works.next(l_works_counter);
|
||||
END LOOP;
|
||||
p_quote_data.quote_works := l_works_tidy;
|
||||
--tidy up quote costs
|
||||
--
|
||||
--
|
||||
l_costs_counter := p_quote_data.quote_costs.FIRST;
|
||||
l_costs_counter := p_quote_data.quote_costs.first;
|
||||
l_quote_cost_tidy_counter := 1;
|
||||
LOOP
|
||||
EXIT WHEN l_costs_counter IS NULL;
|
||||
IF NOT p_quote_data.quote_costs(l_costs_counter)
|
||||
.cost_description IS NULL THEN
|
||||
.cost_description IS NULL THEN
|
||||
l_costs_tidy(l_quote_cost_tidy_counter) := p_quote_data.quote_costs(l_costs_counter);
|
||||
l_quote_cost_tidy_counter := l_quote_cost_tidy_counter + 1;
|
||||
END IF;
|
||||
l_costs_counter := p_quote_data.quote_costs.NEXT(l_costs_counter);
|
||||
l_costs_counter := p_quote_data.quote_costs.next(l_costs_counter);
|
||||
END LOOP;
|
||||
p_quote_data.quote_costs := l_costs_tidy;
|
||||
|
||||
@@ -1124,57 +1130,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
l_enquiry_id NUMBER;
|
||||
l_enqu_row enquiries%ROWTYPE;
|
||||
--Address data
|
||||
l_addr_row v_current_party_addresses%ROWTYPE;
|
||||
CURSOR c_get_address(cp_party_id NUMBER, cp_rt_type VARCHAR2) IS
|
||||
SELECT *
|
||||
FROM v_current_party_addresses
|
||||
WHERE id = cp_party_id
|
||||
AND rt_code = cp_rt_type;
|
||||
l_addr_row v_current_party_addresses%ROWTYPE;
|
||||
l_supplier_id NUMBER;
|
||||
l_agent_id NUMBER;
|
||||
--Party name
|
||||
l_party_row parties%ROWTYPE;
|
||||
CURSOR c_get_party(cp_party_id NUMBER) IS
|
||||
SELECT *
|
||||
FROM parties
|
||||
WHERE id = cp_party_id;
|
||||
--The caveats
|
||||
CURSOR c_get_caveats(cp_enty_code VARCHAR2, cp_mety_code VARCHAR2, cp_svcpt_code VARCHAR2, cp_quoteid NUMBER) IS
|
||||
SELECT t.*
|
||||
FROM caveat_texts t
|
||||
,quote_items qi
|
||||
WHERE t.enty_code = cp_enty_code
|
||||
AND t.mety_code = cp_mety_code
|
||||
AND t.svcpt_code = cp_svcpt_code
|
||||
AND qi.qute_id = cp_quoteid
|
||||
AND qi.adit_code IS NULL
|
||||
AND t.adit_code IS NULL
|
||||
UNION
|
||||
SELECT t.*
|
||||
FROM caveat_texts t
|
||||
,quote_items qi
|
||||
WHERE t.enty_code = cp_enty_code
|
||||
AND t.mety_code = cp_mety_code
|
||||
AND t.svcpt_code = cp_svcpt_code
|
||||
AND qi.qute_id = cp_quoteid
|
||||
AND qi.adit_code IS NOT NULL
|
||||
AND t.adit_code IS NOT NULL
|
||||
AND t.adit_code = qi.adit_code
|
||||
AND regexp_like(decode(qi.selling_price
|
||||
,NULL
|
||||
,'NULL'
|
||||
,qi.selling_price)
|
||||
,t.condition)--consider the condition for this caveat (allows user to input regular expression against the cost)
|
||||
ORDER BY 1
|
||||
,2
|
||||
,3
|
||||
,4
|
||||
,5;
|
||||
--Agent Name
|
||||
l_agent_first_name VARCHAR2(80);
|
||||
l_agent_last_name VARCHAR2(80);
|
||||
l_agent_first_name parties.first_name%TYPE;
|
||||
l_agent_last_name parties.last_name%TYPE;
|
||||
--suppler name
|
||||
l_supplier_name VARCHAR2(80);
|
||||
l_supplier_name parties.name%TYPE;
|
||||
--caveat counters
|
||||
l_dw_counter NUMBER;
|
||||
l_tc_counter NUMBER;
|
||||
@@ -1196,35 +1160,39 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
,'ENQ OWN');
|
||||
|
||||
--get the latest agent address
|
||||
IF NOT c_get_address%ISOPEN THEN
|
||||
OPEN c_get_address(l_agent_id
|
||||
,'OFFICE');
|
||||
END IF;
|
||||
|
||||
FETCH c_get_address
|
||||
INTO l_addr_row;
|
||||
CLOSE c_get_address;
|
||||
BEGIN
|
||||
SELECT *
|
||||
INTO l_addr_row
|
||||
FROM v_current_party_addresses
|
||||
WHERE id = l_agent_id
|
||||
AND rt_code = 'OFFICE';
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
NULL;
|
||||
END;
|
||||
|
||||
--supplier
|
||||
IF NOT c_get_party%ISOPEN THEN
|
||||
OPEN c_get_party(l_supplier_id);
|
||||
END IF;
|
||||
|
||||
FETCH c_get_party
|
||||
INTO l_party_row;
|
||||
CLOSE c_get_party;
|
||||
l_supplier_name := l_party_row.NAME;
|
||||
BEGIN
|
||||
SELECT NAME
|
||||
INTO l_supplier_name
|
||||
FROM parties
|
||||
WHERE id = l_supplier_id;
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
NULL;
|
||||
END;
|
||||
--agent
|
||||
IF NOT c_get_party%ISOPEN THEN
|
||||
OPEN c_get_party(l_agent_id);
|
||||
END IF;
|
||||
|
||||
FETCH c_get_party
|
||||
INTO l_party_row;
|
||||
CLOSE c_get_party;
|
||||
|
||||
l_agent_first_name := l_party_row.first_name;
|
||||
l_agent_last_name := l_party_row.last_name;
|
||||
BEGIN
|
||||
SELECT first_name
|
||||
,last_name
|
||||
INTO l_agent_first_name
|
||||
,l_agent_last_name
|
||||
FROM parties
|
||||
WHERE id = l_agent_id;
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
NULL;
|
||||
END;
|
||||
|
||||
l_quote_data.enquiry_ref := l_enquiry_id;
|
||||
l_quote_data.quote_ref := l_quote_row.id;
|
||||
@@ -1264,10 +1232,40 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
l_tc_counter := 1;
|
||||
l_cs_counter := 1;
|
||||
l_csqa_counter := 1;
|
||||
FOR rec IN c_get_caveats(l_enqu_row.enty_code
|
||||
,l_quote_data.mety_code
|
||||
,l_quote_data.svcpt_code
|
||||
,p_quoteid) LOOP
|
||||
|
||||
FOR rec IN (SELECT t.document_position
|
||||
,t.text
|
||||
,t.sort_order
|
||||
FROM caveat_texts t
|
||||
,quote_items qi
|
||||
WHERE t.enty_code = l_enqu_row.enty_code
|
||||
AND t.mety_code = l_quote_data.mety_code
|
||||
AND t.svcpt_code = l_quote_data.svcpt_code
|
||||
AND qi.qute_id = p_quoteid
|
||||
AND qi.adit_code IS NULL
|
||||
AND t.adit_code IS NULL
|
||||
UNION
|
||||
SELECT t.document_position
|
||||
,t.text
|
||||
,t.sort_order
|
||||
FROM caveat_texts t
|
||||
,quote_items qi
|
||||
WHERE t.enty_code = l_enqu_row.enty_code
|
||||
AND t.mety_code = l_quote_data.mety_code
|
||||
AND t.svcpt_code = l_quote_data.svcpt_code
|
||||
AND qi.qute_id = p_quoteid
|
||||
AND qi.adit_code IS NOT NULL
|
||||
AND t.adit_code IS NOT NULL
|
||||
AND t.adit_code = qi.adit_code
|
||||
AND regexp_like(decode(qi.selling_price
|
||||
,NULL
|
||||
,'NULL'
|
||||
,qi.selling_price)
|
||||
,t.condition) --consider the condition for this caveat (allows user to input regular expression against the cost)
|
||||
ORDER BY document_position
|
||||
,sort_order
|
||||
|
||||
) LOOP
|
||||
CASE rec.document_position
|
||||
WHEN 'TERM_COND' THEN
|
||||
--terms and conditions/specialfeatures caveat point
|
||||
@@ -1286,7 +1284,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
l_quote_data.caveat_cont_sum_qa(l_csqa_counter) := rec.text;
|
||||
l_csqa_counter := l_csqa_counter + 1;
|
||||
END CASE;
|
||||
--need to add in the condition to determine if the additional item should be
|
||||
--need to add in the condition to determine if the additional item should be
|
||||
--displayed or not here(ish)
|
||||
|
||||
END LOOP;
|
||||
@@ -1506,8 +1504,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
plpdf.printtext(p_indent
|
||||
,p_vertical_offset + 216
|
||||
,'Yours sincerely');
|
||||
--put on daves signature
|
||||
plpdf.putimage('dhsignature'
|
||||
--put on signature
|
||||
plpdf.putimage('signature'
|
||||
,p_signature_blob
|
||||
,p_indent
|
||||
,248
|
||||
@@ -1515,7 +1513,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
,11);
|
||||
plpdf.printtext(p_indent
|
||||
,p_vertical_offset + 234
|
||||
,'David Harper');
|
||||
,'Hilary Parry');
|
||||
plpdf.printtext(p_indent
|
||||
,p_vertical_offset + 238
|
||||
,'I&C Technical Manager');
|
||||
@@ -1607,7 +1605,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
plpdf.setprintfont(p_font
|
||||
,'B'
|
||||
,10); --set bold
|
||||
l_works_counter := p_quote_data.quote_works.FIRST;
|
||||
l_works_counter := p_quote_data.quote_works.first;
|
||||
LOOP
|
||||
EXIT WHEN l_works_counter IS NULL;
|
||||
IF NOT p_quote_data.quote_works(l_works_counter) IS NULL THEN
|
||||
@@ -1618,7 +1616,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
l_caveat_desc_works_offset := l_vertical_offset_for_works +
|
||||
(l_works_counter * 4);
|
||||
END IF;
|
||||
l_works_counter := p_quote_data.quote_works.NEXT(l_works_counter);
|
||||
l_works_counter := p_quote_data.quote_works.next(l_works_counter);
|
||||
END LOOP;
|
||||
|
||||
-- DESC_WORK caveat here
|
||||
@@ -1641,7 +1639,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
plpdf.setprintfont(p_font
|
||||
,NULL
|
||||
,10); --unset bold
|
||||
l_ybefore := plpdf.getcurrenty;
|
||||
l_ybefore := plpdf.getcurrenty;
|
||||
l_vertical_offset_for_costs := l_vertical_offset_for_costs +
|
||||
(plpdf.getcurrenty - l_ybefore);
|
||||
plpdf.setprintfont(p_font
|
||||
@@ -1650,7 +1648,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
plpdf.setcurrenty(p_vertical_offset + 114);
|
||||
print_costs(p_description => 'Contract sum (excluding V.A.T):'
|
||||
,p_cost => p_quote_data.total_cost
|
||||
,p_suffix => glue_one_line_caveat(p_quote_data.caveat_cont_sum));-- CONT_SUM caveat here
|
||||
,p_suffix => glue_one_line_caveat(p_quote_data.caveat_cont_sum)); -- CONT_SUM caveat here
|
||||
plpdf.linebreak(20); -- line break, height is 20
|
||||
print_costs(p_description => 'Analysis of Costs (all costs exclude V.A.T)');
|
||||
plpdf.setprintfont(p_font
|
||||
@@ -1661,11 +1659,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
--
|
||||
l_cost_line_counter := 1;
|
||||
WHILE p_quote_data.quote_costs(l_cost_line_counter)
|
||||
.cost_description IS NOT NULL LOOP
|
||||
.cost_description IS NOT NULL LOOP
|
||||
print_costs(p_description => p_quote_data.quote_costs(l_cost_line_counter)
|
||||
.cost_description
|
||||
.cost_description
|
||||
,p_cost => p_quote_data.quote_costs(l_cost_line_counter)
|
||||
.cost_price);
|
||||
.cost_price);
|
||||
|
||||
l_cost_line_counter := l_cost_line_counter + 1;
|
||||
END LOOP;
|
||||
@@ -1676,7 +1674,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
,p_cost => p_quote_data.total_cost
|
||||
,p_border => 'T'
|
||||
,p_suffix => glue_one_line_caveat(p_quote_data.caveat_cont_sum)); -- CONT_SUM caveat here
|
||||
|
||||
|
||||
END build_costs_page;
|
||||
/*
|
||||
PROCEDURE build_caveats_page
|
||||
@@ -2861,7 +2859,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
plpdf.printtext(85
|
||||
,p_vertical_offset + 62
|
||||
,TO_CHAR(p_quote_data.total_cost
|
||||
,'FML999999D90'));
|
||||
,'FML999999D90'));
|
||||
plpdf.setcurrenty(66);
|
||||
l_ybefore := plpdf.getcurrenty;
|
||||
-- CONT_SUM_QA caveat here
|
||||
|
||||
Reference in New Issue
Block a user