diff --git a/Modules/mip_quotation_document.pck b/Modules/mip_quotation_document.pck index 2b1349c..66cf7b3 100644 --- a/Modules/mip_quotation_document.pck +++ b/Modules/mip_quotation_document.pck @@ -132,6 +132,42 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetCellMargin(l_cell_margin); plpdf.SetLeftMargin(31.7); end print_caveats; +/* + PROCEDURE print_one_line_caveats + --Prints the supplied caveats to the current PLPDF page on one line + %param p_caveats - an array of caveat paragraphs to print + %param p_vertical_offset - how far down the page we start printing + %param p_horizontal_offset - how far across the page we start printing + %param p_line_spacing - the line spacing to use, defaults to 4 + */ + procedure print_one_line_caveats(p_caveats in caveat_text, + 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 + --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; + plpdf.PrintFlowingText(p_line_spacing, l_caveat_total_text); + plpdf.LineBreak; + --revert back to the original screen settings + plpdf.SetCellMargin(l_cell_margin); + plpdf.SetLeftMargin(31.7); + end print_one_line_caveats; /* FUNCTION scale_image_dimensions --The scale_image_dimensions provides the width and height of an image to @@ -447,6 +483,9 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --Additional Items l_add_item_row additional_items%ROWTYPE; l_works works := works(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); --list of works for the quote + l_works_counter number; + l_works_tidy works := works(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); --list of works for the quote + l_works_tidy_counter number; l_addons varchar(300); --list of addons for the quote l_housing_row housings%ROWTYPE; l_base_row bases%ROWTYPE; @@ -524,11 +563,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --Added code to check if lifing gear appears then set a flag to indicate --that the lifing gear caveats should be displayed or not. if quote_item_rec.adit_code = 'LIFTING GEAR' then - p_quote_data.show_lifting_gear := true; - p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; + p_quote_data.show_lifting_gear := true; + p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; else - p_quote_data.show_lifting_gear := false; + p_quote_data.show_lifting_gear := false; p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description||' Materials cost'; p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; end if; @@ -537,8 +576,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description||' Delivery cost'; p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; end if; - --set the list of add-ons for this quote, but don't add lifting gear - if quote_item_rec.adit_code <> 'LIFTING GEAR' then + --set the list of add-ons for this quote, but don't add lifting gear or purging + if quote_item_rec.adit_code <> 'LIFTING GEAR' and not quote_item_rec.adit_code is null then l_addons := l_addons || ', '||l_add_item_row.description; end if; when 'MQI' then --module item @@ -643,12 +682,23 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS -- --add up all the addons and format the string if l_addons is not null then - l_works(4) := 'Add-Ons: '|| ltrim(l_addons, ','); + l_works(4) := 'Add-Ons: '|| ltrim(l_addons, ','); end if; - p_quote_data.quote_works := l_works; - - --get caveats - + --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_tidy_counter := 1; + loop + exit when l_works_counter is null; + if not l_works(l_works_counter) is null then + 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); + end loop; + p_quote_data.quote_works := l_works_tidy; + end set_quote_items_data; /* @@ -939,7 +989,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_works_counter := p_quote_data.quote_works.first; loop exit when l_works_counter is null; - if p_quote_data.quote_works(l_works_counter) is not null then + if not p_quote_data.quote_works(l_works_counter) is null then plpdf.PrintText(p_indent,l_vertical_offset_for_works+(l_works_counter*4), p_quote_data.quote_works(l_works_counter)); l_caveat_desc_works_offset := l_vertical_offset_for_works+(l_works_counter*4); end if; @@ -947,7 +997,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS end loop; -- DESC_WORK caveat here if p_quote_data.caveat_desc_works is not null then - -- print_caveats(p_quote_data.caveat_desc_works, l_vertical_offset_for_works+(l_works_counter*4)); print_caveats(p_quote_data.caveat_desc_works, l_caveat_desc_works_offset+1); end if; plpdf.SetPrintFont(p_font,null,10); --unset bold @@ -964,9 +1013,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.PrintText(85,p_vertical_offset+114,'£'||to_char(p_quote_data.total_cost,'FM999999D90')); --end if; l_ybefore := plpdf.GetCurrentY; + -- CONT_SUM caveat here if p_quote_data.caveat_cont_sum is not null then - print_caveats(p_quote_data.caveat_cont_sum, p_vertical_offset+115,4,1); + print_one_line_caveats(p_quote_data.caveat_cont_sum, p_vertical_offset+111,plpdf.GetCurrentY+4,4); end if; l_vertical_offset_for_costs := l_vertical_offset_for_costs+(plpdf.GetCurrentY-l_ybefore); plpdf.SetPrintFont(p_font,null,10); --unset bold @@ -983,12 +1033,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS 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); plpdf.PrintText(p_indent,l_cost_totals_offset+6,'Total costs:'); - --only show the lifing gear caveat if we give a price for lifting gear - --if p_quote_data.show_lifting_gear = true then - -- plpdf.PrintText(120,l_cost_totals_offset+6,'£'||to_char(p_quote_data.total_cost,'FM999999D90')||' excluding lifting gear if required'); - --else plpdf.PrintText(120,l_cost_totals_offset+6,'£'||to_char(p_quote_data.total_cost,'FM999999D90')); - --end if; + -- 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; end build_costs_page; /* PROCEDURE build_caveats_page @@ -1336,17 +1385,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetPrintFont(p_font,null,10); --unset bold plpdf.PrintText(p_indent,p_vertical_offset+62,'Contract sum (excluding V.A.T): '); plpdf.SetPrintFont(p_font,'B',10); --set bold - --only show the lifing gear caveat if we give a price for lifting gear - --if p_quote_data.show_lifting_gear = true then - -- plpdf.PrintText(85,p_vertical_offset+62,'£'||p_quote_data.total_cost||' excluding lifting gear if required.'); - --else plpdf.PrintText(85,p_vertical_offset+62,'£'||p_quote_data.total_cost); - -- end if; plpdf.SetCurrentY(66); l_ybefore := plpdf.GetCurrentY; -- CONT_SUM_QA caveat here if p_quote_data.caveat_cont_sum_qa is not null then - print_caveats(p_quote_data.caveat_cont_sum_qa, p_vertical_offset+63,4,1); + --print_caveats(p_quote_data.caveat_cont_sum_qa, p_vertical_offset+63,4,1); + print_one_line_caveats(p_quote_data.caveat_cont_sum_qa, p_vertical_offset+59,plpdf.GetCurrentY+40,4); end if; l_vertical_offset := l_vertical_offset+(plpdf.GetCurrentY-l_ybefore); plpdf.SetPrintFont(p_font,null,10); --unset bold