From a40b896dd5a362f89cb20d734ea1e57b3a543cca Mon Sep 17 00:00:00 2001 From: PriestJ Date: Tue, 11 Mar 2008 15:04:22 +0000 Subject: [PATCH] fix for ticket #365, the code was trying to get the supplier address changed this to the agent address, also the code was never going to get an address as the call to get the address occurred before we got the supplier/agent ids, so it was always passing a null as the supplier/agent id. git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3944 248e525c-4dfb-0310-94bc-949c084e9493 --- Modules/mip_quotation_document.pck | 568 +++++++++++++++-------------- 1 file changed, 285 insertions(+), 283 deletions(-) diff --git a/Modules/mip_quotation_document.pck b/Modules/mip_quotation_document.pck index 49b3949..ac74cd1 100644 --- a/Modules/mip_quotation_document.pck +++ b/Modules/mip_quotation_document.pck @@ -12,7 +12,7 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS type cost_line is record( cost_description varchar2(80), cost_price number); - + type address is varray(7) of varchar2(160); type works is varray(20) of varchar2(160); type costs is varray(20) of cost_line; @@ -21,7 +21,7 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS type quote_data is record (quote_ref NUMBER, transaction_ref VARCHAR2(80), - mprn number(30), + mprn number(30), supplier_address address := address(null,null,null,null,null,null,null), current_date DATE, agent_first_name varchar2(80), @@ -68,7 +68,7 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS svcpt_code varchar(10) ); - FUNCTION generate_quote_pdf(p_quote_id in number) RETURN VARCHAR2; + FUNCTION generate_quote_pdf(p_quote_id in number) RETURN VARCHAR2; END mip_quotation_document; / @@ -79,7 +79,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS %param p_caveats - an array of caveat paragraphs to print %param p_vertical_offset - how far down the page we start printing %param p_line_spacing - the line spacing to use, defaults to 4 - */ + */ procedure print_caveats(p_caveats in caveat_text, p_vertical_offset in number, p_line_spacing in number :=4) is l_caveats_counter number; l_cell_margin number; @@ -89,29 +89,29 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetLeftMargin(33.7); plpdf.SetCellMargin(-2); plpdf.SetCurrentY(p_vertical_offset); - + l_caveats_counter :=1; - while p_caveats(l_caveats_counter) is not null + while p_caveats(l_caveats_counter) is not null loop plpdf.PrintFlowingText(p_line_spacing, p_caveats(l_caveats_counter)); - plpdf.LineBreak; - plpdf.LineBreak; + plpdf.LineBreak; + plpdf.LineBreak; l_caveats_counter := l_caveats_counter +1; end loop; - + --revert back to the original screen settings plpdf.SetCellMargin(l_cell_margin); - plpdf.SetLeftMargin(31.7); - end print_caveats; + plpdf.SetLeftMargin(31.7); + end print_caveats; /* FUNCTION scale_image_dimensions --The scale_image_dimensions provides the width and height of an image to - --correctly scale into a specified size. + --correctly scale into a specified size. %param p_req_width - The maximum width required for the image %param p_req_height - The maximum height required for the image %param p_image_blob - The image we may need to scale down %return img_props - the new width and height of the image - */ + */ function scale_image_dimensions(p_req_width in number, p_req_height in number, p_image_blob in blob) return img_props is l_new_width number; l_ratio number; @@ -123,7 +123,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --Get the properties for the image from plpdf l_image_props:=plpdf_img.getimageprops(p_image_blob); --if the image is too high cut it down to the limit and record the ratio - --and cutting the width by the recored ratio + --and cutting the width by the recored ratio if l_image_props.height > p_req_height then l_new_height := p_req_height; l_ratio := l_image_props.height/p_req_height; @@ -133,7 +133,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_cur_width := l_image_props.width; end if; --if it's too wide then cut it down to the limit and record the ratio - --and cutting the height by the recored ratio + --and cutting the height by the recored ratio if l_cur_width > p_req_width then l_new_width := p_req_width; l_ratio := l_cur_width/p_req_width; @@ -145,13 +145,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_new_dimensions.height := l_new_height; return l_new_dimensions; end scale_image_dimensions; - + /* FUNCTION get_drawing - --The get_drawing function returns a blob of the drawing code + --The get_drawing function returns a blob of the drawing code %param p_drwg_code - the code of the drawing you want the blob of. %return blob the drawing image - */ + */ function get_drawing(p_drwg_code varchar2) return blob is l_blob blob; CURSOR c_get_drawing(cp_drwg varchar2) IS @@ -173,16 +173,16 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS end get_drawing; /* FUNCTION get_mam - --The get_mam function returns a meter asset manager description for the supplied region code. + --The get_mam function returns a meter asset manager description for the supplied region code. %param p_region_code - the code of the region you want to get the mam description of. %return varchar(80)description of the supplied regions code mam - */ + */ function get_mam(p_region_code varchar2) return varchar2 is l_mam_desc varchar2(80); CURSOR c_get_mam(cp_region_code varchar2) IS SELECT quotation_text FROM regions - WHERE code = cp_region_code; + WHERE code = cp_region_code; begin IF NOT c_get_mam%ISOPEN THEN OPEN c_get_mam(p_region_code); @@ -190,71 +190,71 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FETCH c_get_mam INTO l_mam_desc; CLOSE c_get_mam; - return l_mam_desc; + return l_mam_desc; end get_mam; /* FUNCTION get_enquiry_row - --The get_enquiry_row function returns an enquiry record for the supplied enquiry id. + --The get_enquiry_row function returns an enquiry record for the supplied enquiry id. %param p_enquiry_id - the id of the enquiry you want to get a record of. %return enquiry row of the supplied enquiry id - */ + */ function get_enquiry_row(p_enquiry_id number) return enquiries%ROWTYPE is - --Enquiry data + --Enquiry data l_enqu_row enquiries%ROWTYPE; CURSOR c_get_enquiry(cp_enqu_id number) IS SELECT * FROM enquiries WHERE id = cp_enqu_id; begin - --get the enquiry data + --get the enquiry data IF NOT c_get_enquiry%ISOPEN THEN OPEN c_get_enquiry(p_enquiry_id); END IF; - + FETCH c_get_enquiry INTO l_enqu_row; CLOSE c_get_enquiry; - + return l_enqu_row; end get_enquiry_row; /* FUNCTION get_quote_row - --The get_quote_row funcdsf sdfsdfsd fsdfsdfsdftion returns an enquiry record for the supplied enquiry id. + --The get_quote_row funcdsf sdfsdfsd fsdfsdfsdftion returns an enquiry record for the supplied enquiry id. %param p_enquiry_id - the id of the enquiry you want to get a record of. %return enquiry row of the supplied enquiry id - */ + */ function get_quote_row(p_quote_id number) return quotes%ROWTYPE is - --Quote data + --Quote data l_quote_row quotes%ROWTYPE; CURSOR c_get_quote(cp_quote_id number) IS SELECT * FROM quotes WHERE id = cp_quote_id; begin - --get the quote data + --get the quote data IF NOT c_get_quote%ISOPEN THEN OPEN c_get_quote(p_quote_id); END IF; - + FETCH c_get_quote INTO l_quote_row; CLOSE c_get_quote; - + return l_quote_row; end get_quote_row; /* FUNCTION get_meter_row - --The get_meter_row function returns a meter record for the supplied meter code. + --The get_meter_row function returns a meter record for the supplied meter code. %param p_code - the code of the meter you want to get a record of. %return meters row of the supplied meter code - */ + */ function get_meter_row(p_code varchar2) return meters%ROWTYPE is l_meter_row meters%ROWTYPE; CURSOR c_get_meter(cp_meter_code varchar2) IS SELECT * FROM meters - WHERE code = cp_meter_code; + WHERE code = cp_meter_code; begin IF NOT c_get_meter%ISOPEN THEN OPEN c_get_meter(p_code); @@ -262,20 +262,20 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FETCH c_get_meter INTO l_meter_row; CLOSE c_get_meter; - return l_meter_row; + return l_meter_row; end get_meter_row; /* FUNCTION get_module_row - --The get_module_row function returns a module record for the supplied module code. + --The get_module_row function returns a module record for the supplied module code. %param p_code - the code of the module you want to get a record of. %return modules row of the supplied module code - */ + */ function get_module_row(p_code varchar2) return modules%ROWTYPE is l_module_row modules%ROWTYPE; CURSOR c_get_module(cp_module_code varchar2) IS SELECT * FROM modules - WHERE code = cp_module_code; + WHERE code = cp_module_code; begin IF NOT c_get_module%ISOPEN THEN OPEN c_get_module(p_code); @@ -283,20 +283,20 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FETCH c_get_module INTO l_module_row; CLOSE c_get_module; - return l_module_row; + return l_module_row; end get_module_row; /* FUNCTION get_housing_row - --The get_housing_row function returns a housing record for the supplied housing code. + --The get_housing_row function returns a housing record for the supplied housing code. %param p_code - the code of the housing you want to get a record of. %return housings row of the supplied housing code - */ + */ function get_housing_row(p_code varchar2) return housings%ROWTYPE is l_housing_row housings%ROWTYPE; CURSOR c_get_housing(cp_housing_code varchar2) IS SELECT * FROM housings - WHERE code = cp_housing_code; + WHERE code = cp_housing_code; begin IF NOT c_get_housing%ISOPEN THEN OPEN c_get_housing(p_code); @@ -304,11 +304,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FETCH c_get_housing INTO l_housing_row; CLOSE c_get_housing; - return l_housing_row; + return l_housing_row; end get_housing_row; /* FUNCTION get_base_row - --The get_base_row function returns a base record for the supplied base code. + --The get_base_row function returns a base record for the supplied base code. %param p_code - the code of the base you want to get a record of. %return bases row of the supplied base code */ @@ -317,7 +317,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS CURSOR c_get_base(cp_base_code varchar2) IS SELECT * FROM bases - WHERE code = cp_base_code; + WHERE code = cp_base_code; begin IF NOT c_get_base%ISOPEN THEN OPEN c_get_base(p_code); @@ -325,12 +325,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FETCH c_get_base INTO l_base_row; CLOSE c_get_base; - return l_base_row; + return l_base_row; end get_base_row; /* FUNCTION get_additional_item --The get_additional_item function returns an additional_item record for the supplied additional - --item code. + --item code. %param p_code - the code of the additional item you want to get a record of. %return additional_items row of the supplied item code */ @@ -346,12 +346,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS IF NOT c_get_add_item%ISOPEN THEN OPEN c_get_add_item(p_code); END IF; - + FETCH c_get_add_item INTO l_add_item_row; CLOSE c_get_add_item; return l_add_item_row; - end get_additional_item; + end get_additional_item; /* FUNCTION get_max_lead_time --The get_max lead_time function returns the contracted lead time for the provided quotation. @@ -359,7 +359,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --hence the max bit %param p_quoteid - the id of the quote you want to get the lead time. %return number the maximum contacted lead time for the supplied quotation - */ + */ function get_max_lead_time(p_quoteid number) return number is l_quote_item_maxlt number; CURSOR c_get_max_lead_time (cp_id number) is @@ -383,17 +383,17 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS */ function get_total_cost(p_quoteid number) return number is l_quote_total_cost number; - + begin - + SELECT SUM(selling_price + nvl(delivery_price,0)) into l_quote_total_cost FROM quote_items WHERE qute_id = p_quoteid and not (quit_type = 'AQI' and adit_code in ('LIFTING GEAR','PURGING')); - + return l_quote_total_cost; - end get_total_cost; - + end get_total_cost; + /* PROCEDURE set_quote_items --This procedure sets the data for each of the items associated with the quotation. @@ -418,17 +418,17 @@ 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_addons varchar(300); --list of addons for the quote - l_housing_row housings%ROWTYPE; + l_addons varchar(300); --list of addons for the quote + l_housing_row housings%ROWTYPE; l_base_row bases%ROWTYPE; l_meter_row meters%ROWTYPE; -- used to get the qmax and qmin of the meter l_total_cost number; --used to figure out the liquidated damages costs l_counter number; - l_service_pressure varchar2(80); --these three used to determine whether to set - l_meter_type varchar2(80); --the lifting gear item or not + l_service_pressure varchar2(80); --these three used to determine whether to set + l_meter_type varchar2(80); --the lifting gear item or not l_enqu_type varchar2(80); begin - + --get the meter type, pressure and job type so we can --determine whether to display the lifting gear cost line or not FOR quote_item_rec IN c_get_quote_item(p_quoteid) LOOP @@ -437,8 +437,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_meter_type := quote_item_rec.mety_code; l_enqu_type := quote_item_rec.enty_code; end if; - end loop; - + end loop; + --cycle through the quote items picking up each item to store in the --p_quote_data record l_counter := 0; @@ -451,16 +451,16 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_addons := l_addons || ', Base'; --Set the costs p_quote_data.quote_costs(l_counter).cost_description := 'Base Materials cost'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; if not (quote_item_rec.delivery_price is null) then l_counter:=l_counter +1; p_quote_data.quote_costs(l_counter).cost_description := 'Base Delivery cost'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; end if; --get base technical details p_quote_data.base_dimensions(1) := l_base_row.depth; p_quote_data.base_dimensions(2) := l_base_row.dim_a; - p_quote_data.base_dimensions(3) := l_base_row.dim_b; + p_quote_data.base_dimensions(3) := l_base_row.dim_b; p_quote_data.base_dimensions(4) := l_base_row.dim_c; p_quote_data.base_dimensions(5) := l_base_row.dim_d; p_quote_data.base_dimensions(6) := l_base_row.dim_e; @@ -473,54 +473,54 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_addons := l_addons || ', Housing'; --Set up the costs p_quote_data.quote_costs(l_counter).cost_description := 'Housing Materials cost'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; if not (quote_item_rec.delivery_price is null) then l_counter:=l_counter +1; p_quote_data.quote_costs(l_counter).cost_description := 'Housing Delivery cost'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; - end if; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; + end if; --get housing technical details p_quote_data.house_dimensions(1) := l_housing_row.dim_l; p_quote_data.house_dimensions(2) := l_housing_row.dim_w; - p_quote_data.house_dimensions(3) := l_housing_row.dim_h; + p_quote_data.house_dimensions(3) := l_housing_row.dim_h; p_quote_data.house_dimensions(4) := l_housing_row.weight; p_quote_data.house_diagram := l_housing_row.drwg_code; - + when 'AQI' then --add-on item - --If we get time add an if statement round this that checks if the + --If we get time add an if statement round this that checks if the --Additional Item is lifting gear that it only appears for --LP Diaphgram install/std install jobs --Get costs l_add_item_row := get_additional_item(quote_item_rec.adit_code); if quote_item_rec.adit_code = 'LIFTING GEAR' then - if l_service_pressure = 'LP' and l_meter_type = 'DIAPHRAGM' and (l_enqu_type = 'INSTALL' or l_enqu_type = 'STD INSTALL') then + if l_service_pressure = 'LP' and l_meter_type = 'DIAPHRAGM' and (l_enqu_type = 'INSTALL' or l_enqu_type = 'STD INSTALL') then null; else 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.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; end if; else 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; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; end if; if not(quote_item_rec.delivery_price is null) then l_counter:=l_counter +1; 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; + 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 l_addons := l_addons || ', '||l_add_item_row.description; - end if; + end if; when 'MQI' then --module item --get costs p_quote_data.quote_costs(l_counter).cost_description := 'Module Materials cost'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; if not(quote_item_rec.delivery_price is null) then l_counter:=l_counter +1; p_quote_data.quote_costs(l_counter).cost_description := 'Module Delivery cost'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; - end if; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; + end if; --other module details l_module_row := get_module_row (quote_item_rec.modu_code); l_works(3) := 'Meter Type: '|| l_module_row.svcp_code || ' ' || p_quote_data.meter_reference; @@ -528,13 +528,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --module technical details p_quote_data.module_dimensions(1) := l_module_row.dim_a; p_quote_data.module_dimensions(2) := l_module_row.dim_b; - p_quote_data.module_dimensions(3) := l_module_row.dim_c; + p_quote_data.module_dimensions(3) := l_module_row.dim_c; p_quote_data.module_dimensions(4) := l_module_row.dim_d; p_quote_data.module_dimensions(5) := l_module_row.dim_e; p_quote_data.module_dimensions(6) := l_module_row.dim_h; p_quote_data.module_dimensions(7) := l_module_row.inlet_height; p_quote_data.module_dimensions(8) := l_module_row.outlet_height; - p_quote_data.module_dimensions(9) := l_module_row.weight; + p_quote_data.module_dimensions(9) := l_module_row.weight; p_quote_data.module_reference := l_module_row.code; p_quote_data.meter_reference := l_module_row.metr_code; p_quote_data.module_inlet_height := l_module_row.inlet_height; @@ -546,7 +546,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS p_quote_data.module_inlet_orientation := l_module_row.inlet_cnor_code; p_quote_data.module_outlet_orientation := l_module_row.outlet_cnor_code; p_quote_data.module_diagram := l_module_row.drwg_code; - --get meters qmax/qmin tech specs + --get meters qmax/qmin tech specs l_meter_row := get_meter_row(l_module_row.metr_code); p_quote_data.module_qmax := l_meter_row.qmax; p_quote_data.module_qmin := l_meter_row.qmin; @@ -566,15 +566,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS when 'LQI' then --Labour cost --get costs p_quote_data.quote_costs(l_counter).cost_description := 'Labour Costs'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; if not(quote_item_rec.delivery_price is null) then l_counter:=l_counter +1; p_quote_data.quote_costs(l_counter).cost_description := 'Labour Delivery cost'; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; - end if; - - end case; - + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; + end if; + + end case; + --get existing meter if appropriate if quote_item_rec.enty_code is not null then if quote_item_rec.enty_code <>'INSTALL' and quote_item_rec.enty_code <>'STD INSTALL' then @@ -596,13 +596,13 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS end if; end if; end if; - + END LOOP; --get type of enquiry to display as works type IF NOT c_get_enquiry_type%ISOPEN THEN OPEN c_get_enquiry_type(l_enqu_type ); END IF; - + FETCH c_get_enquiry_type INTO l_enqu_type_row; CLOSE c_get_enquiry_type; @@ -615,12 +615,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS if l_addons is not null then l_works(4) := 'Add-Ons: '|| ltrim(l_addons, ','); end if; - p_quote_data.quote_works := l_works; - + p_quote_data.quote_works := l_works; + --get caveats - + end set_quote_items_data; - + /* FUNCTION get_detailed_quote_data --This function should return all required data for the quotation. @@ -632,7 +632,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FUNCTION get_detailed_quote_data(p_quoteid in number) RETURN quote_data is --Quote data l_quote_data quote_data; - l_quote_row quotes%ROWTYPE; + l_quote_row quotes%ROWTYPE; --Enquiry data l_enquiry_id number; l_enqu_row enquiries%ROWTYPE; @@ -643,7 +643,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FROM v_current_party_addresses WHERE id = cp_party_id and rt_code=cp_rt_type; l_supplier_id number; - l_agent_id number; + l_agent_id number; --Party name l_party_row parties%ROWTYPE; CURSOR c_get_party(cp_party_id number) IS @@ -653,8 +653,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --The caveats CURSOR c_get_caveats(cp_enty_code varchar2, cp_mety_code varchar2, cp_svcpt_code varchar2) IS select * - from caveat_texts t - where enty_code = cp_enty_code and mety_code = cp_mety_code and svcpt_code = cp_svcpt_code + from caveat_texts t + where enty_code = cp_enty_code and mety_code = cp_mety_code and svcpt_code = cp_svcpt_code order by 1,2,3,4,5; --Agent Name l_agent_first_name varchar2(80); @@ -670,27 +670,29 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS begin --get the quote's data record l_quote_row := get_quote_row(p_quoteid); - - --get the enquiry data - l_enquiry_id := l_quote_row.enqu_id; - l_enqu_row := get_enquiry_row(l_enquiry_id); - --get the latest supplier address - IF NOT c_get_address%ISOPEN THEN - OPEN c_get_address(l_supplier_id,'OFFICE'); - END IF; + --get the enquiry data + l_enquiry_id := l_quote_row.enqu_id; + l_enqu_row := get_enquiry_row(l_enquiry_id); - FETCH c_get_address - INTO l_addr_row; - CLOSE c_get_address; --get current supplier and agent ids for enquiry l_supplier_id := mip_enquiry.get_enquiry_role(l_enqu_row.id,'ENQ SUPP'); l_agent_id := mip_enquiry.get_enquiry_role(l_enqu_row.id,'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; + --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; @@ -699,15 +701,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS 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; - + l_quote_data.quote_ref := l_quote_row.id; l_quote_data.transaction_ref := l_enqu_row.transaction_reference; l_quote_data.mprn := l_enqu_row.mprn; @@ -721,7 +723,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_quote_data.current_date := sysdate; l_quote_data.agent_first_name := l_agent_first_name; l_quote_data.site_address(1) := l_enqu_row.install_sub_building; - l_quote_data.site_address(2) := l_enqu_row.install_building; + l_quote_data.site_address(2) := l_enqu_row.install_building; l_quote_data.site_address(3) := l_enqu_row.install_street; l_quote_data.site_address(4) := l_enqu_row.install_city; l_quote_data.site_address(5) := l_enqu_row.install_postcode; @@ -745,23 +747,23 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS for rec in c_get_caveats(l_enqu_row.enty_code, l_quote_data.mety_code, l_quote_data.svcpt_code) loop case rec.document_position - when 'TERM_COND' then --terms and conditions/specialfeatures caveat point - l_quote_data.caveat_term_cond(l_tc_counter) := rec.text; + when 'TERM_COND' then --terms and conditions/specialfeatures caveat point + l_quote_data.caveat_term_cond(l_tc_counter) := rec.text; l_tc_counter := l_tc_counter +1; - when 'DESC_WORK' then --description of works caveat point - l_quote_data.caveat_desc_works(l_dw_counter) := rec.text; + when 'DESC_WORK' then --description of works caveat point + l_quote_data.caveat_desc_works(l_dw_counter) := rec.text; l_dw_counter := l_dw_counter +1; - when 'CONT_SUM' then --description of works caveat point - l_quote_data.caveat_cont_sum(l_cs_counter) := rec.text; - l_cs_counter := l_cs_counter +1; - when 'CONT_SUM_QA' then --description of works caveat point - l_quote_data.caveat_cont_sum_qa(l_csqa_counter) := rec.text; - l_csqa_counter := l_csqa_counter +1; - end case; + when 'CONT_SUM' then --description of works caveat point + l_quote_data.caveat_cont_sum(l_cs_counter) := rec.text; + l_cs_counter := l_cs_counter +1; + when 'CONT_SUM_QA' then --description of works caveat point + l_quote_data.caveat_cont_sum_qa(l_csqa_counter) := rec.text; + l_csqa_counter := l_csqa_counter +1; + end case; end loop; - --phew, lets return all that lovely data we captured then... + --phew, lets return all that lovely data we captured then... return l_quote_data; - end get_detailed_quote_data; + end get_detailed_quote_data; /* PROCEDURE build_covering_letter --This procedure builds the covering letter for the quotation, it writes data @@ -769,10 +771,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS %param p_quote_data in - The current data for this quote %param p_font - the type of font to use - typically 'Arial'. %param p_indent - the left margin measurement. - %param p_vertical_offset - the top margin measurement. + %param p_vertical_offset - the top margin measurement. %param p_logo_blob - the logo(image) to display at the top of the page %param p_signature_blob - the signature(image) to display at the bottom of the page - */ + */ PROCEDURE build_covering_letter(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_logo_blob blob,p_signature_blob blob,p_watermark_blob blob) is l_note_text varchar2(500); l_cell_margin number; @@ -787,18 +789,18 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetRightMargin(31.7); plpdf.SetTopMargin(25.4); - plpdf.SetPrintFont(p_font,null,7); + plpdf.SetPrintFont(p_font,null,7); -- Set header stuff up plpdf.PutImage('ngmlogo',p_logo_blob,p_indent,10,52,18); plpdf.PrintText(140,10,'4 Abbotts Lane '); plpdf.PrintText(140,13,'Coventry'); plpdf.PrintText(140,16,'CV1 4AY'); - plpdf.PrintText(170,10,'T +44 (0) 24 7628 6000'); + plpdf.PrintText(170,10,'T +44 (0) 24 7628 6000'); plpdf.PrintText(170,13,'F +44 (0) 24 7628 6022'); - plpdf.PrintText(170,16,'www.nationalgrid.com'); + plpdf.PrintText(170,16,'www.nationalgrid.com'); -- And Footer stuff plpdf.PrintText(50,280,'National Grid Metering is the trading name for National Grid Metering Ltd.'); - plpdf.PrintText(50,283,'Registered Office: 1-3 Strand, London, WCZN 5EH. Registered in England and Wales, No. 3705992'); + plpdf.PrintText(50,283,'Registered Office: 1-3 Strand, London, WCZN 5EH. Registered in England and Wales, No. 3705992'); plpdf.SetPrintFont(p_font,null,10); -- set back to 10 pt plpdf.PrintText(p_indent,p_vertical_offset+10,'National Grid Metering''s Ref: '|| to_char(p_quote_data.quote_ref)); plpdf.PrintText(p_indent,p_vertical_offset+14,'Customer Reference: '|| p_quote_data.transaction_ref); @@ -814,18 +816,18 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.PrintText(p_indent,p_vertical_offset+66,'Quotation Contact: Non Standard Customer Service Team'); plpdf.PrintText(p_indent,p_vertical_offset+70,'Mailbox ; ic.nonstandard1@uk.ngrid.com'); plpdf.PrintText(p_indent,p_vertical_offset+74,'Hunt Group 02476 286322'); - plpdf.PrintText(p_indent,p_vertical_offset+78,'Fax 02476 286044'); + plpdf.PrintText(p_indent,p_vertical_offset+78,'Fax 02476 286044'); plpdf.PrintText(p_indent,p_vertical_offset+90,'Dear '|| p_quote_data.agent_first_name); --agent first name plpdf.SetPrintFont(p_font,'B',10); --set bold - plpdf.PrintText(p_indent,p_vertical_offset+98,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address + plpdf.PrintText(p_indent,p_vertical_offset+98,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address l_note_text := 'Note: National Grid Metering are a service provider working on behalf of '; l_note_text := l_note_text || p_quote_data.mam;--mam - l_note_text := l_note_text || ', please direct all enquiries regarding this quote to National Grid Metering.'; + l_note_text := l_note_text || ', please direct all enquiries regarding this quote to National Grid Metering.'; l_cell_margin:= plpdf.GetCellMargin; plpdf.SetLeftMargin(33.7); plpdf.SetCellMargin(-2); plpdf.SetCurrentY(p_vertical_offset+106); - plpdf.PrintFlowingText(4,l_note_text); + plpdf.PrintFlowingText(4,l_note_text); plpdf.LineBreak; plpdf.LineBreak; plpdf.SetPrintFont(p_font,null,10); --unset bold @@ -837,8 +839,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetPrintFont(p_font,'B',10); --set bold plpdf.PrintFlowingText(4,' Please note, if you accept this quotation you are agreeing to be bound by the terms of the '||p_quote_data.mam||' and General Conditions of Contract for Transactional Meter Works Not Exceeding 7 Bar, and all subsequent work will be performed in accordance with that contract.'); plpdf.SetCellMargin(l_cell_margin); - plpdf.SetLeftMargin(31.7); - plpdf.SetPrintFont(p_font,null,10); --unset bold + plpdf.SetLeftMargin(31.7); + plpdf.SetPrintFont(p_font,null,10); --unset bold plpdf.PrintText(p_indent,p_vertical_offset+148,'This quotation is produced on the basis that, the information provided in the request is correct.'); plpdf.PrintText(p_indent,p_vertical_offset+152,'Your acceptance of the quotation will be taken to mean that you also accept that the stated'); plpdf.PrintText(p_indent,p_vertical_offset+156,'assumptions are correct. If it is later determined, by either party prior to works commencing on'); @@ -848,19 +850,19 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS -- plpdf.PrintText(p_indent,p_vertical_offset+176,'To accept the quotation please submit a work request via IX, as outlined in the Rainbow Manual,'); plpdf.PrintText(p_indent,p_vertical_offset+180,'or complete the enclosed Acceptance Form and return it to the above National Grid Metering'''); - plpdf.PrintText(p_indent,p_vertical_offset+184,'office.'); + plpdf.PrintText(p_indent,p_vertical_offset+184,'office.'); -- - plpdf.PrintText(p_indent,p_vertical_offset+192,'Please note that this quotation is valid for 90 days from the date specified in the quotation.'); - plpdf.PrintText(p_indent,p_vertical_offset+196,'Please use National Grid Metering''s Reference, which is at the top of the letter, on any future'); - plpdf.PrintText(p_indent,p_vertical_offset+200,'correspondence relating to this request.'); + plpdf.PrintText(p_indent,p_vertical_offset+192,'Please note that this quotation is valid for 90 days from the date specified in the quotation.'); + plpdf.PrintText(p_indent,p_vertical_offset+196,'Please use National Grid Metering''s Reference, which is at the top of the letter, on any future'); + plpdf.PrintText(p_indent,p_vertical_offset+200,'correspondence relating to this request.'); -- plpdf.PrintText(p_indent,p_vertical_offset+208,'If you have any queries, please contact the team on the number above.'); plpdf.PrintText(p_indent,p_vertical_offset+216,'Yours sincerely'); --put on daves signature - plpdf.PutImage('dhsignature',p_signature_blob,p_indent,248,44,11); + plpdf.PutImage('dhsignature',p_signature_blob,p_indent,248,44,11); plpdf.PrintText(p_indent,p_vertical_offset+234,'David Harper'); - plpdf.PrintText(p_indent,p_vertical_offset+238,'I&C Technical Manager'); - plpdf.PrintText(p_indent,p_vertical_offset+242,'National Grid Metering'); + plpdf.PrintText(p_indent,p_vertical_offset+238,'I&C Technical Manager'); + plpdf.PrintText(p_indent,p_vertical_offset+242,'National Grid Metering'); end build_covering_letter; /* PROCEDURE build_costs_page @@ -869,15 +871,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS %param p_quote_data in - The current data for this quote %param p_font - the type of font to use - typically 'Arial'. %param p_indent - the left margin measurement. - %param p_vertical_offset - the top margin measurement. - */ + %param p_vertical_offset - the top margin measurement. + */ PROCEDURE build_costs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_watermark_blob blob) is l_cost_line_counter number; l_vertical_offset_for_costs number := p_vertical_offset+126; l_works_counter number; - l_vertical_offset_for_works number := p_vertical_offset+52; + l_vertical_offset_for_works number := p_vertical_offset+52; l_cost_totals_offset number; --used to position the cost totals after the cost line items - l_caveat_desc_works_offset number; --used to position caveat_desc_works as running calculation in + l_caveat_desc_works_offset number; --used to position caveat_desc_works as running calculation in --function parameter causes error on pdf begin --Page 2 @@ -890,7 +892,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetLeftMargin(31.7); plpdf.SetRightMargin(31.7); plpdf.SetTopMargin(25.4); - plpdf.SetPrintFont(p_font,'B',10); --set bold + plpdf.SetPrintFont(p_font,'B',10); --set bold plpdf.PrintText(p_indent,p_vertical_offset+10,'QUOTATION'); plpdf.SetPrintFont(p_font,null,10); --unset bold plpdf.PrintText(p_indent,p_vertical_offset+18,'National Grid Metering''s Ref: '|| to_char(p_quote_data.quote_ref)); @@ -898,15 +900,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.PrintText(p_indent,p_vertical_offset+26,'MPRN: '|| to_char(p_quote_data.mprn)); plpdf.PrintText(p_indent,p_vertical_offset+30,'Date: '||p_quote_data.current_date); plpdf.SetPrintFont(p_font,'B',10); --set bold - plpdf.PrintText(p_indent,p_vertical_offset+38,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address - plpdf.SetPrintFont(p_font,'U',10); --set underline + plpdf.PrintText(p_indent,p_vertical_offset+38,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address + plpdf.SetPrintFont(p_font,'U',10); --set underline plpdf.PrintText(p_indent,p_vertical_offset+48,'Full Description of Works to be carried out by National Grid Metering:'); plpdf.SetPrintFont(p_font,'B',10); --set bold - l_works_counter := p_quote_data.quote_works.first; - loop + 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 - plpdf.PrintText(p_indent,l_vertical_offset_for_works+(l_works_counter*4), p_quote_data.quote_works(l_works_counter)); + if p_quote_data.quote_works(l_works_counter) is not 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; l_works_counter := p_quote_data.quote_works.next(l_works_counter); @@ -917,32 +919,32 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS print_caveats(p_quote_data.caveat_desc_works, l_caveat_desc_works_offset+1); end if; - plpdf.SetPrintFont(p_font,null,10); --unset bold - plpdf.PrintText(p_indent,p_vertical_offset+106, 'Indicative Lead Time from Acceptance to Physical Commencement: '); + plpdf.SetPrintFont(p_font,null,10); --unset bold + plpdf.PrintText(p_indent,p_vertical_offset+106, 'Indicative Lead Time from Acceptance to Physical Commencement: '); 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.SetPrintFont(p_font,null,10); --unset bold plpdf.PrintText(p_indent,p_vertical_offset+114,'Contract sum (excluding V.A.T): '); - plpdf.SetPrintFont(p_font,'B',10); --set bold + plpdf.SetPrintFont(p_font,'B',10); --set bold plpdf.PrintText(85,p_vertical_offset+114,'£'||to_char(p_quote_data.total_cost,'FM999999D90')); -- 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+118); - end if; - plpdf.SetPrintFont(p_font,null,10); --unset bold - plpdf.PrintText(p_indent,p_vertical_offset+122,'Analysis of Costs (all costs exclude V.A.T)'); - plpdf.SetPrintFont(p_font,'B',10); --set bold + end if; + plpdf.SetPrintFont(p_font,null,10); --unset bold + plpdf.PrintText(p_indent,p_vertical_offset+122,'Analysis of Costs (all costs exclude V.A.T)'); + plpdf.SetPrintFont(p_font,'B',10); --set bold 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); - plpdf.PrintText(120,l_vertical_offset_for_costs+l_cost_line_counter*4,'£'||to_char(p_quote_data.quote_costs(l_cost_line_counter).cost_price,'FM999999D90')); + 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); + plpdf.PrintText(120,l_vertical_offset_for_costs+l_cost_line_counter*4,'£'||to_char(p_quote_data.quote_costs(l_cost_line_counter).cost_price,'FM999999D90')); l_cost_line_counter := l_cost_line_counter +1; end loop; 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:'); - plpdf.PrintText(120,l_cost_totals_offset+6,'£'||to_char(p_quote_data.total_cost,'FM999999D90')||' excluding lifting gear if required'); + plpdf.PrintText(120,l_cost_totals_offset+6,'£'||to_char(p_quote_data.total_cost,'FM999999D90')||' excluding lifting gear if required'); end build_costs_page; /* PROCEDURE build_caveats_page @@ -951,8 +953,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS %param p_quote_data in - The current data for this quote %param p_font - the type of font to use - typically 'Arial'. %param p_indent - the left margin measurement. - %param p_vertical_offset - the top margin measurement. - */ + %param p_vertical_offset - the top margin measurement. + */ PROCEDURE build_caveats_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_watermark_blob blob, p_logger_caveat_required in boolean) is l_cell_margin number; begin @@ -961,7 +963,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --set watermark if it exists if p_watermark_blob is not null then plpdf.PutImage('test watermark',p_watermark_blob,50,50,200,200); - end if; + end if; -- set margins plpdf.SetLeftMargin(31.7); plpdf.SetRightMargin(31.7); @@ -970,19 +972,19 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --house plpdf.PrintText(p_indent,p_vertical_offset+10,'Meter Housing Details (if required):'); plpdf.PrintText(p_indent,p_vertical_offset+18,'Length: '||p_quote_data.house_length||' mm'); - plpdf.PrintText(p_indent+40,p_vertical_offset+18,'Depth: '||p_quote_data.house_depth||' mm'); + plpdf.PrintText(p_indent+40,p_vertical_offset+18,'Depth: '||p_quote_data.house_depth||' mm'); plpdf.PrintText(p_indent+80,p_vertical_offset+18,'Height: '||p_quote_data.house_height||' mm'); - --plpdf.PrintText(p_indent,p_vertical_offset+26,'Minimum Ventilation: '||p_quote_data.house_ventilation/10||' sq. cm'); + --plpdf.PrintText(p_indent,p_vertical_offset+26,'Minimum Ventilation: '||p_quote_data.house_ventilation/10||' sq. cm'); --base plpdf.PrintText(p_indent,p_vertical_offset+34,'Meter Housing Base (if required):'); plpdf.PrintText(p_indent,p_vertical_offset+42,'Length: '||p_quote_data.base_length||' mm'); - plpdf.PrintText(p_indent+40,p_vertical_offset+42,'Depth: '||p_quote_data.base_depth||' mm'); + plpdf.PrintText(p_indent+40,p_vertical_offset+42,'Depth: '||p_quote_data.base_depth||' mm'); plpdf.PrintText(p_indent+80,p_vertical_offset+42,'Height: '||p_quote_data.base_height||' mm'); - --plpdf.PrintText(p_indent,p_vertical_offset+58,'Minimum Ventilation: '||p_quote_data.outlet_termninal_size||' mm'); + --plpdf.PrintText(p_indent,p_vertical_offset+58,'Minimum Ventilation: '||p_quote_data.outlet_termninal_size||' mm'); plpdf.PrintText(p_indent,p_vertical_offset+58,'Special Features/Terms/Conditions:'); - plpdf.SetPrintFont(p_font,'B',10); --set bold + plpdf.SetPrintFont(p_font,'B',10); --set bold -- TERM_COND caveat here - if p_quote_data.caveat_term_cond is not null then + if p_quote_data.caveat_term_cond is not null then print_caveats(p_quote_data.caveat_term_cond, p_vertical_offset+62); end if; if p_logger_caveat_required then @@ -994,14 +996,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --revert back to the original screen settings plpdf.SetCellMargin(l_cell_margin); plpdf.SetLeftMargin(31.7); - end if; - + end if; + --the caveats will be looped in so the positioning of the the following items will - --need to be dynamic (see the quote costs code above for an example) + --need to be dynamic (see the quote costs code above for an example) plpdf.SetPrintFont(p_font,null,10); --unset bold plpdf.PrintText(p_indent,p_vertical_offset+230,'Liquidated Damages (sum per day)(excluding V.A.T):'); plpdf.PrintText(130,p_vertical_offset+230,'£'||to_char(p_quote_data.liquid_damage_day,'FM999999D90')); - plpdf.PrintText(p_indent,p_vertical_offset+238,'Liquidated Damages (monetary cap)(excluding V.A.T):'); + plpdf.PrintText(p_indent,p_vertical_offset+238,'Liquidated Damages (monetary cap)(excluding V.A.T):'); plpdf.PrintText(130,p_vertical_offset+238,'£'||to_char(p_quote_data.liquid_damage_cap,'FM999999D90')); end build_caveats_page; @@ -1012,11 +1014,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS %param p_quote_data in - The current data for this quote %param p_font - the type of font to use - typically 'Arial'. %param p_indent - the left margin measurement. - %param p_vertical_offset - the top margin measurement. - %param p_base_blob - the image of the base - %param p_house_blob - the image of the house - %param p_module_blob - the image of the module - */ + %param p_vertical_offset - the top margin measurement. + %param p_base_blob - the image of the base + %param p_house_blob - the image of the house + %param p_module_blob - the image of the module + */ PROCEDURE build_drawings_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number, p_base_blob blob, p_house_blob blob, p_module_blob blob,p_watermark_blob blob) is l_img_props img_props; begin @@ -1038,28 +1040,28 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --Base Details plpdf.SetPrintFont(p_font,'BU',12); --set bold,underline and 12pt plpdf.PrintText(p_indent,p_vertical_offset+12,'Floor Area/Base Requirements'); - plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain - plpdf.SetCurrentXY(p_indent,p_vertical_offset+25); + plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain + plpdf.SetCurrentXY(p_indent,p_vertical_offset+25); plpdf.PrintCell(15,6,'Depth:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.base_dimensions(1),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.base_dimensions(1),1,1,'R',0); plpdf.PrintCell(15,6,'Dim A:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.base_dimensions(2),1,1,'R',0); plpdf.PrintCell(15,6,'Dim B:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.base_dimensions(3),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.base_dimensions(3),1,1,'R',0); plpdf.PrintCell(15,6,'Dim C:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.base_dimensions(4),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.base_dimensions(4),1,1,'R',0); plpdf.PrintCell(15,6,'Dim D:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.base_dimensions(5),1,1,'R',0); plpdf.PrintCell(15,6,'Dim E:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.base_dimensions(6),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.base_dimensions(6),1,1,'R',0); plpdf.PrintCell(15,6,'Dim F:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.base_dimensions(7),1,1,'R',0); plpdf.PrintCell(15,6,'Dim G:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.base_dimensions(8),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.base_dimensions(8),1,1,'R',0); plpdf.PrintCell(15,6,'Dim H:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.base_dimensions(9),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.base_dimensions(9),1,1,'R',0); plpdf.PrintCell(15,6,'Dim I:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.base_dimensions(10),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.base_dimensions(10),1,1,'R',0); if p_base_blob is null then plpdf.PrintText(p_indent+50,p_vertical_offset+50,'No Base Diagram Available'); else @@ -1069,46 +1071,46 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --House Details plpdf.SetPrintFont(p_font,'BU',12); --set bold,underline and 12pt plpdf.PrintText(p_indent,p_vertical_offset+100,'Housing / Work Area'); - plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain - plpdf.SetCurrentXY(p_indent,p_vertical_offset+108); + plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain + plpdf.SetCurrentXY(p_indent,p_vertical_offset+108); plpdf.PrintCell(15,6,'Length:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.house_dimensions(1),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.house_dimensions(1),1,1,'R',0); plpdf.PrintCell(15,6,'Width:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.house_dimensions(2),1,1,'R',0); plpdf.PrintCell(15,6,'Height:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.house_dimensions(3),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.house_dimensions(3),1,1,'R',0); plpdf.PrintCell(15,6,'Weight:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.house_dimensions(4),1,1,'R',0); if p_house_blob is null then plpdf.PrintText(p_indent+50,p_vertical_offset+132,'No Housing Diagram Available'); else - + l_img_props := scale_image_dimensions(100, 60, p_house_blob ); plpdf.PutImage('house',p_house_blob,p_indent+50,p_vertical_offset+108,l_img_props.width,l_img_props.height); end if; - --Module details + --Module details plpdf.SetPrintFont(p_font,'BU',12); --set bold,underline and 12pt plpdf.PrintText(p_indent,p_vertical_offset+168,'Module Dimensions'); - plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain - plpdf.SetCurrentXY(p_indent,p_vertical_offset+180); + plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain + plpdf.SetCurrentXY(p_indent,p_vertical_offset+180); plpdf.PrintCell(15,6,'Dim A:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.module_dimensions(1),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.module_dimensions(1),1,1,'R',0); plpdf.PrintCell(15,6,'Dim B:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.module_dimensions(2),1,1,'R',0); plpdf.PrintCell(15,6,'Dim C:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.module_dimensions(3),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.module_dimensions(3),1,1,'R',0); plpdf.PrintCell(15,6,'Dim D:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.module_dimensions(4),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.module_dimensions(4),1,1,'R',0); plpdf.PrintCell(15,6,'Dim E:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.module_dimensions(5),1,1,'R',0); plpdf.PrintCell(15,6,'Dim H:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.module_dimensions(6),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.module_dimensions(6),1,1,'R',0); plpdf.PrintCell(15,6,'Dim I:',1,0,'L',0); plpdf.PrintCell(15,6,p_quote_data.module_dimensions(7),1,1,'R',0); plpdf.PrintCell(15,6,'Dim O:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.module_dimensions(8),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.module_dimensions(8),1,1,'R',0); plpdf.PrintCell(15,6,'Weight:',1,0,'L',0); - plpdf.PrintCell(15,6,p_quote_data.module_dimensions(9),1,1,'R',0); + plpdf.PrintCell(15,6,p_quote_data.module_dimensions(9),1,1,'R',0); if p_module_blob is null then plpdf.PrintText(p_indent+50,p_vertical_offset+205,'No Module Diagram Available'); else @@ -1127,8 +1129,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS %param p_quote_data in - The current data for this quote %param p_font - the type of font to use - typically 'Arial'. %param p_indent - the left margin measurement. - %param p_vertical_offset - the top margin measurement. - */ + %param p_vertical_offset - the top margin measurement. + */ PROCEDURE build_module_specs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_watermark_blob blob) is begin --this will be page 5 (part of the technical spec sheet) for the quotation @@ -1144,63 +1146,63 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetPrintFont(p_font,'B',18); --set bold and 18pt plpdf.PrintText(p_indent,p_vertical_offset,'Technical Specification for '||p_quote_data.quote_ref); plpdf.SetPrintFont(p_font,'B',10); --set back to 10pt - plpdf.PrintText(p_indent,p_vertical_offset+6,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address + plpdf.PrintText(p_indent,p_vertical_offset+6,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address plpdf.SetPrintFont(p_font,null,10); --set back to plain plpdf.PrintText(p_indent,p_vertical_offset+14,'The supply point must be of a suitable size and capacity to provide the specified Lowest'); plpdf.PrintText(p_indent,p_vertical_offset+18,'Operating Pressure(LOP-from table1) at the Emergency Control Valve(ECV) outlet'); plpdf.PrintText(p_indent,p_vertical_offset+22,'under the requested Q Max load as detailed below in table 2'); --table 1 - plpdf.SetCurrentXY(p_indent,p_vertical_offset+30); - plpdf.SetPrintFont(p_font,'B',10); --set to bold - plpdf.PrintCell(90,6,'Table 1',1,0,'L',0); + plpdf.SetCurrentXY(p_indent,p_vertical_offset+30); + plpdf.SetPrintFont(p_font,'B',10); --set to bold + plpdf.PrintCell(90,6,'Table 1',1,0,'L',0); plpdf.PrintCell(30,6,'ECV Outlet (u)',1,0,'C',0); - plpdf.PrintCell(40,6,'Consumer Outlet (c)',1,1,'C',0); + plpdf.PrintCell(40,6,'Consumer Outlet (c)',1,1,'C',0); plpdf.SetPrintFont(p_font,null,10); --set back to plain if p_quote_data.svcpt_code = 'LP' then - plpdf.PrintCell(90,6,'Design Minimum Pressure (DMP)',1,0,'L',0); + plpdf.PrintCell(90,6,'Design Minimum Pressure (DMP)',1,0,'L',0); plpdf.PrintCell(30,6,'19 mbar',1,0,'C',0); plpdf.PrintCell(40,6,'15 mbar',1,1,'C',0); - plpdf.PrintCell(90,6,'Lowest Operating Pressure (LOP)',1,0,'L',0); + plpdf.PrintCell(90,6,'Lowest Operating Pressure (LOP)',1,0,'L',0); plpdf.PrintCell(30,6,'25 mbar',1,0,'C',0); - plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); - plpdf.PrintCell(90,6,'Pressure Tier',1,0,'L',0); + plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); + plpdf.PrintCell(90,6,'Pressure Tier',1,0,'L',0); plpdf.PrintCell(30,6,'75 mbar',1,0,'C',0); plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); else --for MP - plpdf.PrintCell(90,6,'Design Minimum Pressure (DMP)',1,0,'L',0); + plpdf.PrintCell(90,6,'Design Minimum Pressure (DMP)',1,0,'L',0); plpdf.PrintCell(30,6,'270 mbar',1,0,'C',0); plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); - plpdf.PrintCell(90,6,'Lowest Operating Pressure (LOP)',1,0,'L',0); + plpdf.PrintCell(90,6,'Lowest Operating Pressure (LOP)',1,0,'L',0); plpdf.PrintCell(30,6,'270 mbar',1,0,'C',0); - plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); - plpdf.PrintCell(90,6,'Pressure Tier',1,0,'L',0); + plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); + plpdf.PrintCell(90,6,'Pressure Tier',1,0,'L',0); plpdf.PrintCell(30,6,'2000 mbar',1,0,'C',0); plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); - end if; + end if; --table 2 - plpdf.SetCurrentXY(p_indent,p_vertical_offset+60); - plpdf.SetPrintFont(p_font,'B',10); --set to bold - plpdf.PrintCell(90,6,'Table 2',1,0,'L',0); + plpdf.SetCurrentXY(p_indent,p_vertical_offset+60); + plpdf.SetPrintFont(p_font,'B',10); --set to bold + plpdf.PrintCell(90,6,'Table 2',1,0,'L',0); plpdf.PrintCell(70,6,'Meter Module Design',1,1,'C',0); - plpdf.SetPrintFont(p_font,null,10); --set back to plain - plpdf.PrintCell(90,6,'Requested Q Max (kw/h)',1,0,'L',0); + plpdf.SetPrintFont(p_font,null,10); --set back to plain + plpdf.PrintCell(90,6,'Requested Q Max (kw/h)',1,0,'L',0); plpdf.PrintCell(70,6,p_quote_data.requested_qmax,1,1,'C',0); - plpdf.PrintCell(90,6,'Q Max of the meter module (kw/h)',1,0,'L',0); + plpdf.PrintCell(90,6,'Q Max of the meter module (kw/h)',1,0,'L',0); plpdf.PrintCell(70,6,p_quote_data.module_qmax,1,1,'C',0); - plpdf.PrintCell(90,6,'Q Min of the meter module (kw/h)',1,0,'L',0); + plpdf.PrintCell(90,6,'Q Min of the meter module (kw/h)',1,0,'L',0); plpdf.PrintCell(70,6,p_quote_data.module_qmin,1,1,'C',0); --table 3 - plpdf.SetCurrentXY(p_indent,p_vertical_offset+90); - plpdf.SetPrintFont(p_font,'B',10); --set to bold - plpdf.PrintCell(90,6,'Table 3',1,0,'L',0); + plpdf.SetCurrentXY(p_indent,p_vertical_offset+90); + plpdf.SetPrintFont(p_font,'B',10); --set to bold + plpdf.PrintCell(90,6,'Table 3',1,0,'L',0); plpdf.PrintCell(70,6,'Module Design Parameters',1,1,'C',0); - plpdf.SetPrintFont(p_font,null,10); --set back to plain + plpdf.SetPrintFont(p_font,null,10); --set back to plain plpdf.PrintMultilineCell(60,6,'Note: Inlet connection size and location details must be checked against supply point details supplied by GT to ensure compatibility ',1,'L',0); --Multi line cell thing is a bit annoying the printcell will not wrap to --the edge of the multi-line cell so we have to set the cursor for the --remaining parts of the table, have found a fix for this will do if we --have any time - plpdf.SetCurrentXY(91.7,p_vertical_offset+96); + plpdf.SetCurrentXY(91.7,p_vertical_offset+96); plpdf.PrintCell(30,6,'',1,0,'C',0); plpdf.PrintCell(35,6,'Inlet',1,0,'C',0); plpdf.PrintCell(35,6,'Outlet',1,1,'C',0); @@ -1211,11 +1213,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetCurrentX(91.7); plpdf.PrintCell(30,6,'Size',1,0,'C',0); plpdf.PrintCell(35,6,p_quote_data.module_inlet_size||'mm',1,0,'C',0); - plpdf.PrintCell(35,6,p_quote_data.module_outlet_size||'mm',1,1,'C',0); + plpdf.PrintCell(35,6,p_quote_data.module_outlet_size||'mm',1,1,'C',0); plpdf.SetCurrentX(91.7); plpdf.PrintCell(30,6,'Type',1,0,'C',0); plpdf.PrintCell(35,6,p_quote_data.module_inlet_type,1,0,'C',0); - plpdf.PrintCell(35,6,p_quote_data.module_outlet_type,1,1,'C',0); + plpdf.PrintCell(35,6,p_quote_data.module_outlet_type,1,1,'C',0); plpdf.SetCurrentX(91.7); plpdf.PrintCell(30,6,'Orientation',1,0,'C',0); plpdf.PrintCell(35,6,p_quote_data.module_inlet_orientation,1,0,'C',0); @@ -1230,12 +1232,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.PrintText(p_indent,p_vertical_offset+162,'the ventilation be found to be inadequate, the connection will not be made and the'); plpdf.PrintText(p_indent,p_vertical_offset+166,'requirements to allow the connection reported to you. The quotation does not include'); plpdf.PrintText(p_indent,p_vertical_offset+170,'the provision of a separate instrumentation cabinet.'); - plpdf.SetPrintFont(p_font,null,7); --set to 7 pt + plpdf.SetPrintFont(p_font,null,7); --set to 7 pt plpdf.PrintText(p_indent,p_vertical_offset+178,'Definitions'); plpdf.PrintText(p_indent,p_vertical_offset+182,'DMP - The minimum pressure that may occur at the point of reference at the time of system design flow rate under extreme gas supply conditions'); - plpdf.PrintText(p_indent,p_vertical_offset+186,'LOP - The lowest pressure that may occur under normal operating conditions'); + plpdf.PrintText(p_indent,p_vertical_offset+186,'LOP - The lowest pressure that may occur under normal operating conditions'); plpdf.PrintText(p_indent,p_vertical_offset+190,'Conversion calculations are based on an average CV of 38.4 MJ/m3'); - plpdf.SetPrintFont(p_font,null,9); --set to 9 pt + plpdf.SetPrintFont(p_font,null,9); --set to 9 pt plpdf.PrintText(p_indent,p_vertical_offset+260,'National Grid Metering, Abbotts Lane, Coventry, West Midlands, CV1 4AY Tel 02476 286000 Fax 02476 286022'); end build_module_specs_page; /* @@ -1245,9 +1247,9 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS %param p_quote_data in - The current data for this quote %param p_font - the type of font to use - typically 'Arial'. %param p_indent - the left margin measurement. - %param p_vertical_offset - the top margin measurement. - %param p_logo_blob - the logo(image) to display at the top of the page - */ + %param p_vertical_offset - the top margin measurement. + %param p_logo_blob - the logo(image) to display at the top of the page + */ PROCEDURE build_acceptance_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_logo_blob blob,p_watermark_blob blob) is begin ---weeeeee last page @@ -1262,16 +1264,16 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.SetTopMargin(25.4); -- Set header stuff up plpdf.PutImage('ngmlogo',p_logo_blob,p_indent,10,52,18); - plpdf.SetPrintFont(p_font,null,7); + plpdf.SetPrintFont(p_font,null,7); plpdf.PrintText(140,10,'4 Abbotts Lane '); plpdf.PrintText(140,13,'Coventry'); plpdf.PrintText(140,16,'CV1 4AY'); - plpdf.PrintText(170,10,'T +44 (0) 24 7628 6000'); + plpdf.PrintText(170,10,'T +44 (0) 24 7628 6000'); plpdf.PrintText(170,13,'F +44 (0) 24 7628 6022'); - plpdf.PrintText(170,16,'www.nationalgrid.com'); + plpdf.PrintText(170,16,'www.nationalgrid.com'); -- And Footer stuff plpdf.PrintText(50,280,'National Grid Metering is the trading name for National Grid Metering Ltd.'); - plpdf.PrintText(50,283,'Registered Office: 1-3 Strand, London, WCZN 5EH. Registered in England and Wales, No. 3705992'); + plpdf.PrintText(50,283,'Registered Office: 1-3 Strand, London, WCZN 5EH. Registered in England and Wales, No. 3705992'); plpdf.SetPrintFont(p_font,null,10); -- big text please plpdf.PrintText(p_indent,p_vertical_offset+10,'National Grid Metering''s Ref: '|| to_char(p_quote_data.quote_ref)); plpdf.PrintText(p_indent,p_vertical_offset+14,'Customer Reference: '|| p_quote_data.transaction_ref); @@ -1283,18 +1285,18 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.PrintText(p_indent,p_vertical_offset+42,'Coventry'); plpdf.PrintText(p_indent,p_vertical_offset+46,'CV1 4AY'); plpdf.SetPrintFont(p_font,'B',10); --set bold - plpdf.PrintText(p_indent,p_vertical_offset+54,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address - plpdf.SetPrintFont(p_font,null,10); --unset bold + plpdf.PrintText(p_indent,p_vertical_offset+54,'Re: '||rtrim(ltrim(p_quote_data.site_address(1)||', '||p_quote_data.site_address(2)||', '||p_quote_data.site_address(3)||', '||p_quote_data.site_address(4)||', '||p_quote_data.site_address(5)||', '||p_quote_data.site_address(6)||', '||p_quote_data.site_address(7),', '),', ')); --site address + 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 + plpdf.SetPrintFont(p_font,'B',10); --set bold plpdf.PrintText(85,p_vertical_offset+62,'£'||p_quote_data.total_cost||' excluding lifting gear if required.'); -- 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+66); - end if; - plpdf.SetPrintFont(p_font,null,10); --unset bold - plpdf.PrintText(p_indent,p_vertical_offset+74,'* I confirm on behalf of my Company that I accept the above referenced quotation for the conduct'); - plpdf.PrintText(p_indent,p_vertical_offset+78,'of works as detailed therein, and here by certify on behalf of my Company that no additional'); + end if; + plpdf.SetPrintFont(p_font,null,10); --unset bold + plpdf.PrintText(p_indent,p_vertical_offset+74,'* I confirm on behalf of my Company that I accept the above referenced quotation for the conduct'); + plpdf.PrintText(p_indent,p_vertical_offset+78,'of works as detailed therein, and here by certify on behalf of my Company that no additional'); plpdf.PrintText(p_indent,p_vertical_offset+82,'terms and conditions (other than those set out in the quotation) are required.'); plpdf.PrintText(p_indent,p_vertical_offset+90,'OR'); plpdf.PrintText(p_indent,p_vertical_offset+98,'* I confirm on behalf of my Company that the above referenced quotation for the conduct or works'); @@ -1307,18 +1309,18 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.PrintText(p_indent,p_vertical_offset+134,'works by the General Conditions of Contract for Transactional Meter Works Not'); plpdf.PrintText(p_indent,p_vertical_offset+138,'Exceeding 7 Bar (as ammended by the quotation).'); plpdf.PrintText(p_indent,p_vertical_offset+146,'Commencement'); - plpdf.PrintText(p_indent,p_vertical_offset+154,'Permission to organise directly with site contact'); - plpdf.PrintText(p_indent+120,p_vertical_offset+154,'Yes / No'); - plpdf.PrintText(p_indent,p_vertical_offset+162,'Earliest date site ready for work to commence'); + plpdf.PrintText(p_indent,p_vertical_offset+154,'Permission to organise directly with site contact'); + plpdf.PrintText(p_indent+120,p_vertical_offset+154,'Yes / No'); + plpdf.PrintText(p_indent,p_vertical_offset+162,'Earliest date site ready for work to commence'); plpdf.PrintText(p_indent+120,p_vertical_offset+162,'___/___/___'); - plpdf.PrintText(p_indent,p_vertical_offset+170,'Anticipated date gas required on site'); + plpdf.PrintText(p_indent,p_vertical_offset+170,'Anticipated date gas required on site'); plpdf.PrintText(p_indent+120,p_vertical_offset+170,'___/___/___'); - plpdf.PrintText(p_indent,p_vertical_offset+178,'Signed on behalf of the Company'); - plpdf.PrintText(p_indent,p_vertical_offset+186,'Name:________________________________'); - plpdf.PrintText(p_indent+85,p_vertical_offset+186,'Position:____________________________'); - plpdf.PrintText(p_indent,p_vertical_offset+194,'Company:_____________________________'); - plpdf.PrintText(p_indent+85,p_vertical_offset+194,'Date:_______________________________'); - plpdf.PrintText(p_indent,p_vertical_offset+202,'Signature:_____________________________________________________________________'); + plpdf.PrintText(p_indent,p_vertical_offset+178,'Signed on behalf of the Company'); + plpdf.PrintText(p_indent,p_vertical_offset+186,'Name:________________________________'); + plpdf.PrintText(p_indent+85,p_vertical_offset+186,'Position:____________________________'); + plpdf.PrintText(p_indent,p_vertical_offset+194,'Company:_____________________________'); + plpdf.PrintText(p_indent+85,p_vertical_offset+194,'Date:_______________________________'); + plpdf.PrintText(p_indent,p_vertical_offset+202,'Signature:_____________________________________________________________________'); end build_acceptance_page; /* @@ -1327,7 +1329,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --the supplied data and stores the resulting pdf document in the database. %param p_quote_data - the data to build into the quote. %return - l_pdf_id the id of the pdf file we have created - */ + */ FUNCTION generate_detailed_quote_pdf(p_quote_data in quote_data,p_quote_id in number) RETURN VARCHAR2 is l_blob blob; l_enty_code varchar2(80); --the type of enquiry @@ -1341,7 +1343,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_pdf_name varchar2(90); -- the id of the quote we generate l_indent number := 31.7; l_vertical_offset number := 30; - l_font varchar2(40) := 'Arial'; --arial not daz + l_font varchar2(40) := 'Arial'; --arial not daz CURSOR c_get_logo(cp_logo varchar2) IS SELECT blob_content FROM wwv_flow_files @@ -1353,7 +1355,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS CURSOR c_get_watermark(cp_watermark varchar2) IS SELECT blob_content FROM wwv_flow_files - WHERE filename = cp_watermark; + WHERE filename = cp_watermark; CURSOR c_get_enty(cp_quid varchar2) IS SELECT enty_code FROM quote_items @@ -1377,14 +1379,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS END IF; FETCH c_get_watermark INTO l_watermark_blob; - CLOSE c_get_watermark; + CLOSE c_get_watermark; IF NOT c_get_enty%ISOPEN THEN OPEN c_get_enty(p_quote_id); END IF; FETCH c_get_enty INTO l_enty_code; CLOSE c_get_enty; - + --get the quote diagrams l_base_blob := get_drawing(p_quote_data.base_diagram); l_house_blob := get_drawing(p_quote_data.house_diagram); @@ -1401,15 +1403,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS end if; --OFMAT, Addon jobs don't have module diagrams if not (l_enty_code = 'OFMAT' or l_enty_code = 'AMR' or l_enty_code = 'EMS') then - build_drawings_page(p_quote_data,l_font,l_indent,l_vertical_offset, l_base_blob, l_house_blob, l_module_blob,l_watermark_blob); --4 + build_drawings_page(p_quote_data,l_font,l_indent,l_vertical_offset, l_base_blob, l_house_blob, l_module_blob,l_watermark_blob); --4 end if; - build_module_specs_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_watermark_blob); --5 - build_acceptance_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_logo_blob,l_watermark_blob); --6 - --get our beautiful pdf into the local var l_blob + build_module_specs_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_watermark_blob); --5 + build_acceptance_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_logo_blob,l_watermark_blob); --6 + --get our beautiful pdf into the local var l_blob plpdf.SendDoc(l_blob); --punt the created pdf into the APEX files table insert into wwv_flow_files( name, title, mime_type, flow_id, doc_size ,description, blob_content ) - values ( sys_guid()||'/quote_'||p_quote_data.quote_ref||'.pdf', 'Quotation - '||p_quote_data.quote_ref, 'application/pdf', 190, DBMS_LOB.GETLENGTH(l_blob),'this is an auto generated quotation from mip_quotation_document.generate_detailed_quote for quotation '||p_quote_data.quote_ref, l_blob) + values ( sys_guid()||'/quote_'||p_quote_data.quote_ref||'.pdf', 'Quotation - '||p_quote_data.quote_ref, 'application/pdf', 190, DBMS_LOB.GETLENGTH(l_blob),'this is an auto generated quotation from mip_quotation_document.generate_detailed_quote for quotation '||p_quote_data.quote_ref, l_blob) returning name into l_pdf_name; --set up the file associations within our documents tables l_success:= mip_files.set_file_association(l_pdf_name, @@ -1421,22 +1423,22 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS null, 'QUDO'); return l_pdf_name; -- return the id of the newly created blob pdf record - end generate_detailed_quote_pdf; + end generate_detailed_quote_pdf; /* FUNCTION generate_quote_pdf --The generate_detailed_quote_pdf builds the pdf document for the quotation from --the supplied quote id and stores the resulting pdf document in the database. %param p_quote_id - the id of the quote you want to build a pdf for. %return - the name of the pdf file we have created. This is a unique value within the wwv_flow_files table - */ + */ FUNCTION generate_quote_pdf(p_quote_id in number) RETURN VARCHAR2 is l_quote_data quote_data; begin l_quote_data := get_detailed_quote_data(p_quote_id); return generate_detailed_quote_pdf(l_quote_data, p_quote_id); end generate_quote_pdf; - - + + BEGIN -- Initialization NULL;