Fixed issue with 'Too few operands' where a vertical offset value of null was being passed causing the costs page not displaying. Also made some changes to tidy up the output on the costs page. Replaces missing cont_sum caveat that was missing.

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@12539 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
jamie.priest
2009-09-07 17:07:26 +00:00
parent c621cd7b24
commit 561266e548

View File

@@ -254,9 +254,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
END get_current_font_details;
PROCEDURE print_costs(p_description IN VARCHAR2
,p_description_width IN NUMBER DEFAULT 80
,p_description_width IN NUMBER DEFAULT 70
,p_cost IN NUMBER DEFAULT NULL
,p_border IN VARCHAR2 DEFAULT '0') IS
,p_border IN VARCHAR2 DEFAULT '0'
,p_suffix IN VARCHAR2 DEFAULT NULL) IS
l_row_data plpdf_type.t_row_datas;
l_row_width plpdf_type.t_row_widths;
l_row_align plpdf_type.t_row_aligns;
@@ -266,17 +267,19 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
BEGIN
l_row_data(1) := p_description;
IF p_cost IS NOT NULL THEN
l_row_data(2) := '<27>';
l_row_data(3) := TO_CHAR(p_cost
,'FM999G990D00');
l_row_data(2) := TO_CHAR(p_cost
,'FML999G990D00');else
l_row_data(2) := NULL;
END IF;
l_row_data(3) := p_suffix;
l_row_width(1) := p_description_width;
l_row_width(2) := 12;
l_row_width(3) := 30;
l_row_width(2) := 25;
l_row_width(3) := 0;
l_row_align(1) := 'L';
l_row_align(2) := 'R';
l_row_align(3) := 'R';
l_row_align(3) := 'L';
l_row_border(1) := p_border;
l_row_border(2) := p_border;
@@ -389,6 +392,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
l_caveats_counter NUMBER;
l_cell_margin NUMBER;
BEGIN
cout_assert.isnotnull(p_vertical_offset
,p_message => 'veritcal offest null!');
--set up the screen so we can have our size 4 spacing
l_cell_margin := plpdf.getcellmargin;
plpdf.setleftmargin(33.7);
@@ -409,6 +414,24 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.setcellmargin(l_cell_margin);
plpdf.setleftmargin(31.7);
END print_caveats;
/*
FUNCTION glue_one_line_caveat
--Concats the supplied caveats into one line of text
%param p_caveats - an array of caveat paragraphs to join together
*/
FUNCTION glue_one_line_caveat(p_caveats IN caveat_text) RETURN VARCHAR2 IS
l_caveats_counter NUMBER;
l_caveat_total_text VARCHAR2(5000);
BEGIN
l_caveats_counter := 1;
WHILE p_caveats(l_caveats_counter) IS NOT NULL LOOP
l_caveat_total_text := l_caveat_total_text || ' ' ||
p_caveats(l_caveats_counter);
l_caveats_counter := l_caveats_counter + 1;
END LOOP;
RETURN l_caveat_total_text;
END glue_one_line_caveat;
/*
PROCEDURE print_one_line_caveats
--Prints the supplied caveats to the current PLPDF page on one line
@@ -421,24 +444,20 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
,p_vertical_offset IN NUMBER
,p_horizontal_offset IN NUMBER
,p_line_spacing IN NUMBER := 4) IS
l_caveats_counter NUMBER;
l_cell_margin NUMBER;
l_caveat_total_text VARCHAR2(5000);
BEGIN
cout_assert.isnotnull(p_vertical_offset
,'vertical offset null!!');
cout_assert.isnotnull(p_horizontal_offset
,'horz offset null!!');
--set up the screen so we can have our size 4 spacing
l_cell_margin := plpdf.getcellmargin;
plpdf.setleftmargin(33.7);
plpdf.setcellmargin(-2);
plpdf.setcurrenty(p_vertical_offset);
plpdf.setcurrentx(p_horizontal_offset);
l_caveats_counter := 1;
l_caveat_total_text := '';
WHILE p_caveats(l_caveats_counter) IS NOT NULL LOOP
l_caveat_total_text := l_caveat_total_text || ' ' ||
p_caveats(l_caveats_counter);
l_caveats_counter := l_caveats_counter + 1;
END LOOP;
l_caveat_total_text := glue_one_line_caveat(p_caveats);
plpdf.printflowingtext(p_line_spacing
,l_caveat_total_text);
plpdf.linebreak;
@@ -1616,33 +1635,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.setprintfont(p_font
,'B'
,10); --set bold
plpdf.printtext(140
,p_vertical_offset + 106
,p_quote_data.lead_time || ' working days');
plpdf.setprintfont(p_font
,NULL
,10); --unset bold
/*
plpdf.printtext(p_indent
,p_vertical_offset + 114
,'Contract sum (excluding V.A.T): ');
plpdf.printtext(85
,p_vertical_offset + 114
,print_cost_aligned(p_quote_data.total_cost));
-- ,'<27>' || TO_CHAR(p_quote_data.total_cost
-- ,'FM999999D90'));
*/
l_ybefore := plpdf.getcurrenty;
-- CONT_SUM caveat here
IF p_quote_data.caveat_cont_sum IS NOT NULL THEN
print_one_line_caveats(p_quote_data.caveat_cont_sum
,p_vertical_offset + 111
,plpdf.getcurrenty + 8
,4);
END IF;
l_vertical_offset_for_costs := l_vertical_offset_for_costs +
(plpdf.getcurrenty - l_ybefore);
plpdf.setprintfont(p_font
@@ -1650,90 +1649,34 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
,10); --unset bold
plpdf.setcurrenty(p_vertical_offset + 114);
print_costs(p_description => 'Contract sum (excluding V.A.T):'
,p_cost => p_quote_data.total_cost);
,p_cost => p_quote_data.total_cost
,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.printtext(p_indent
,plpdf.getcurrenty + 4
,'Analysis of Costs (all costs exclude V.A.T)');
*/
plpdf.setprintfont(p_font
,'B'
,10); --set bold
plpdf.linebreak(20); -- line break, height is 20
--plpdf.setcurrenty( l_vertical_offset_for_costs + 4);
/*
--
l_cost_line_counter := 1;
WHILE p_quote_data.quote_costs(l_cost_line_counter)
.cost_description IS NOT NULL LOOP
plpdf.printtext(p_indent
,l_vertical_offset_for_costs +
l_cost_line_counter * 4
, p_quote_data.quote_costs(l_cost_line_counter)
.cost_description);
-- some items do not show a cost value
IF p_quote_data.quote_costs(l_cost_line_counter)
.cost_price IS NOT NULL THEN
plpdf.printtext(120
,l_vertical_offset_for_costs +
l_cost_line_counter * 4
,print_cost_aligned(p_quote_data.quote_costs(l_cost_line_counter)
.cost_price));
-- '<27>' || TO_CHAR(p_quote_data.quote_costs(l_cost_line_counter)
-- .cost_price
-- ,'FM999,999D90'));
plpdf.setprintfont(p_font
,'B'
,10);
END IF;
l_cost_line_counter := l_cost_line_counter + 1;
END LOOP;
*/
l_cost_line_counter := 1;
WHILE p_quote_data.quote_costs(l_cost_line_counter)
.cost_description IS NOT NULL LOOP
print_costs(p_description => p_quote_data.quote_costs(l_cost_line_counter)
.cost_description
,p_cost => p_quote_data.quote_costs(l_cost_line_counter)
.cost_price);
l_cost_line_counter := l_cost_line_counter + 1;
END LOOP;
/* l_cost_totals_offset := l_vertical_offset_for_costs +
--
l_cost_totals_offset := l_vertical_offset_for_costs +
l_cost_line_counter * 4;
plpdf.drawline(p_indent
,l_cost_totals_offset + 2
,185
,l_cost_totals_offset + 2);
*/
print_costs(p_description => 'Total costs:'
,p_cost => p_quote_data.total_cost
,p_border => 'T');
/*
plpdf.printtext(p_indent
,l_cost_totals_offset + 6
,'Total costs:');
plpdf.printtext(120
,l_cost_totals_offset + 6
,print_cost_aligned(p_quote_data.total_cost));
-- ,'<27>' || TO_CHAR(p_quote_data.total_cost
-- ,'FM999999D90'));
*/
-- CONT_SUM caveat here
IF p_quote_data.caveat_cont_sum IS NOT NULL THEN
print_one_line_caveats(p_quote_data.caveat_cont_sum
,l_cost_totals_offset + 2.8
,plpdf.getcurrenty
,4);
END IF;
,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
@@ -1839,7 +1782,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.printtext(130
,p_vertical_offset + 230
,print_cost_aligned(p_quote_data.liquid_damage_day));
-- ,'<EFBFBD>' || TO_CHAR(p_quote_data.liquid_damage_day
-- ,'#' || TO_CHAR(p_quote_data.liquid_damage_day
-- ,'FM999999D90'));
plpdf.printtext(p_indent
,p_vertical_offset + 238
@@ -1847,7 +1790,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.printtext(130
,p_vertical_offset + 238
,print_cost_aligned(p_quote_data.liquid_damage_cap));
-- ,'<EFBFBD>' || TO_CHAR(p_quote_data.liquid_damage_cap
-- ,'#' || TO_CHAR(p_quote_data.liquid_damage_cap
-- ,'FM999999D90'));
*/
END build_caveats_page;
@@ -2934,7 +2877,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
,10); --set bold
plpdf.printtext(85
,p_vertical_offset + 62
,'<EFBFBD>' || TO_CHAR(p_quote_data.total_cost
,'#' || TO_CHAR(p_quote_data.total_cost
,'FM999999D90'));
plpdf.setcurrenty(66);
l_ybefore := plpdf.getcurrenty;