finished off a bit more of quotation pdf, tidied up a few bits. Moved each page inside individual procedures to make things a bit tidier. Now need to figure out how to get it into the APEX files table.

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3128 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2008-01-04 14:03:05 +00:00
parent a117f49d54
commit fa6de4187d

View File

@@ -74,8 +74,8 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS
FUNCTION determine_caveats(p_enquiryid in number) RETURN BOOLEAN; FUNCTION determine_caveats(p_enquiryid in number) RETURN BOOLEAN;
procedure set_quote_items_data (p_quote_data in out quote_data, p_quoteid number, p_enqu_row enquiries%ROWTYPE); procedure set_quote_items_data (p_quote_data in out quote_data, p_quoteid number, p_enqu_row enquiries%ROWTYPE);
FUNCTION get_detailed_quote_data(p_quoteid in number) RETURN quote_data; FUNCTION get_detailed_quote_data(p_quoteid in number) RETURN quote_data;
--PROCEDURE covering_letter(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number);
FUNCTION generate_detailed_quote_pdf(p_quote_data in quote_data) RETURN BOOLEAN; FUNCTION generate_detailed_quote_pdf(p_quote_data in quote_data) RETURN BOOLEAN;
FUNCTION build_detailed_quote(p_enquiryid in number) RETURN BOOLEAN;
END mip_quotation_document; END mip_quotation_document;
/ /
CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
@@ -584,36 +584,25 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
--phew, lets return all that lovely data we captured then... --phew, lets return all that lovely data we captured then...
return l_quote_data; return l_quote_data;
end get_detailed_quote_data; end get_detailed_quote_data;
/* /*
FUNCTION generate_detailed_quote_pdf PROCEDURE build_covering_letter
--This function should return a data populated pdf of the detailed quotation. --This procedure builds the covering letter for the quotation, it writes data
--The return value could be a pdf or reference to a pdf that it has stored in the system? --to an existing plpdf document
%param p_quote_data - the data to build into the quote. %param p_quote_data in - The current data for this quote
%param possibly a few more params to get the required data in %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.
*/ */
FUNCTION generate_detailed_quote_pdf(p_quote_data in quote_data) RETURN BOOLEAN is PROCEDURE build_covering_letter(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
l_blob blob;
l_indent number := 31.7;
l_vertical_offset number := 30;
l_vertical_offset_for_costs number := l_vertical_offset+110;
l_font varchar2(40) := 'Arial';
l_contracts_text varchar2(500); l_contracts_text varchar2(500);
l_big_text varchar2(9000);
l_cost_line_counter number;
l_cost_totals_offset number; --used to position the cost totals after the cost line items
begin begin
-- Get the blob from somewhere
--Simple example to retrieve and use template:
-- Initialize PDF
plpdf.init;
plpdf.NewPage; plpdf.NewPage;
-- Slap on our data -- set margins
plpdf.SetLeftMargin(31.7); plpdf.SetLeftMargin(31.7);
plpdf.SetRightMargin(31.7); plpdf.SetRightMargin(31.7);
plpdf.SetTopMargin(25.4); plpdf.SetTopMargin(25.4);
plpdf.SetPrintFont(l_font,null,7); plpdf.SetPrintFont(p_font,null,7);
-- Set header stuff up -- Set header stuff up
plpdf.PrintText(140,10,'4 Abbotts Lane '); plpdf.PrintText(140,10,'4 Abbotts Lane ');
plpdf.PrintText(140,13,'Coventry'); plpdf.PrintText(140,13,'Coventry');
@@ -624,133 +613,185 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
-- And Footer stuff -- And Footer stuff
plpdf.PrintText(50,280,'National Grid Metering is the trading name for National Grid Metering Ltd.'); 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(l_font,null,10); -- big text please plpdf.SetPrintFont(p_font,null,10); -- set back to 10 pt
plpdf.PrintText(l_indent,l_vertical_offset+10,'National Grid Metering''s Ref: '|| to_char(p_quote_data.quote_ref)); plpdf.PrintText(p_indent,p_vertical_offset+10,'National Grid Metering''s Ref: '|| to_char(p_quote_data.quote_ref));
plpdf.PrintText(l_indent,l_vertical_offset+14,'Customer Reference: '|| p_quote_data.transaction_ref); plpdf.PrintText(p_indent,p_vertical_offset+14,'Customer Reference: '|| p_quote_data.transaction_ref);
plpdf.PrintText(l_indent,l_vertical_offset+18,'MPRN: '|| to_char(p_quote_data.mprn)); plpdf.PrintText(p_indent,p_vertical_offset+18,'MPRN: '|| to_char(p_quote_data.mprn));
plpdf.PrintText(l_indent,l_vertical_offset+26,p_quote_data.supplier_address(1)); plpdf.PrintText(p_indent,p_vertical_offset+26,p_quote_data.supplier_address(1));
plpdf.PrintText(l_indent,l_vertical_offset+30,p_quote_data.supplier_address(2)); plpdf.PrintText(p_indent,p_vertical_offset+30,p_quote_data.supplier_address(2));
plpdf.PrintText(l_indent,l_vertical_offset+34,p_quote_data.supplier_address(3)); plpdf.PrintText(p_indent,p_vertical_offset+34,p_quote_data.supplier_address(3));
plpdf.PrintText(l_indent,l_vertical_offset+38,p_quote_data.supplier_address(4)); plpdf.PrintText(p_indent,p_vertical_offset+38,p_quote_data.supplier_address(4));
plpdf.PrintText(l_indent,l_vertical_offset+42,p_quote_data.supplier_address(5)); plpdf.PrintText(p_indent,p_vertical_offset+42,p_quote_data.supplier_address(5));
plpdf.PrintText(l_indent,l_vertical_offset+46,p_quote_data.supplier_address(6)); plpdf.PrintText(p_indent,p_vertical_offset+46,p_quote_data.supplier_address(6));
plpdf.PrintText(l_indent,l_vertical_offset+50,p_quote_data.supplier_address(7)); plpdf.PrintText(p_indent,p_vertical_offset+50,p_quote_data.supplier_address(7));
plpdf.PrintText(l_indent,l_vertical_offset+58,'Date: '||p_quote_data.current_date); plpdf.PrintText(p_indent,p_vertical_offset+58,'Date: '||p_quote_data.current_date);
plpdf.PrintText(l_indent,l_vertical_offset+66,'Quotation Contact: Customer Services Team 1'); plpdf.PrintText(p_indent,p_vertical_offset+66,'Quotation Contact: Customer Services Team 1');
plpdf.PrintText(l_indent,l_vertical_offset+70,'Telephone Number: 02476 286 320'); plpdf.PrintText(p_indent,p_vertical_offset+70,'Telephone Number: 02476 286 320');
plpdf.PrintText(l_indent,l_vertical_offset+74,'Fax Number: 02476 286 044'); plpdf.PrintText(p_indent,p_vertical_offset+74,'Fax Number: 02476 286 044');
plpdf.PrintText(l_indent,l_vertical_offset+78,'E-mail address: iandcrequests1@uk.ngrid.com'); plpdf.PrintText(p_indent,p_vertical_offset+78,'E-mail address: iandcrequests1@uk.ngrid.com');
plpdf.PrintText(l_indent,l_vertical_offset+90,'Dear '|| p_quote_data.agent_first_name); --agent first name plpdf.PrintText(p_indent,p_vertical_offset+90,'Dear '|| p_quote_data.agent_first_name); --agent first name
plpdf.SetPrintFont(l_font,'B',10); --set bold plpdf.SetPrintFont(p_font,'B',10); --set bold
plpdf.PrintText(l_indent,l_vertical_offset+98,'Re: '||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: '||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(l_font,null,10); --unset bold plpdf.SetPrintFont(p_font,null,10); --unset bold
l_contracts_text :='I am pleased to provide you with a quotation for works in accordance with the '||p_quote_data.mam;--mam l_contracts_text :='I am pleased to provide you with a quotation for works in accordance with the '||p_quote_data.mam;--mam
l_contracts_text := l_contracts_text||' General Conditions of Contract for Transactional Meter Works not Exceeding 7 Bar.'; l_contracts_text := l_contracts_text||' General Conditions of Contract for Transactional Meter Works not Exceeding 7 Bar.';
plpdf.SetCurrentY(l_vertical_offset+106); plpdf.SetCurrentY(p_vertical_offset+106);
plpdf.PrintFlowingText(6,l_contracts_text); plpdf.PrintFlowingText(6,l_contracts_text);
plpdf.LineBreak; plpdf.LineBreak;
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+128,'This quotation is produced on the basis that, the information provided in the request is correct.');
l_big_text := 'This quotation is produced on the basis that, the information provided in the request is correct. Your acceptance of the quotation will be taken to mean that you also accept that the stated assumptions are correct. If it is later determined, by either party prior to works commencing on site, that any stated assumption is significantly incorrect, National Grid Metering will determine whether the quotation shall be varied or withdrawn. Works will only then commence if any variation is agreed in line with the relevant General Conditions of Contract.'; plpdf.PrintText(p_indent,p_vertical_offset+132,'Your acceptance of the quotation will be taken to mean that you also accept that the stated');
plpdf.PrintFlowingText(6,l_big_text); plpdf.PrintText(p_indent,p_vertical_offset+136,'assumptions are correct. If it is later determined, by either party prior to works commencing on');
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+140,'site, that any stated assumption is significantly incorrect, National Grid Metering will determine');
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+144,'whether the quotation shall be varied or withdrawn. Works will only then commence if any');
l_big_text := 'To accept the quotation please submit a work request via IX, as outlined in the Rainbow Manual, or complete the enclosed Acceptance Form and return it to the above National Grid Metering office.'; plpdf.PrintText(p_indent,p_vertical_offset+148,'variation is agreed in line with the relevant General Conditions of Contract.');
plpdf.PrintFlowingText(6,l_big_text); --
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+156,'To accept the quotation please submit a work request via IX, as outlined in the Rainbow Manual,');
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+160,'or complete the enclosed Acceptance Form and return it to the above National Grid Metering''');
l_big_text := 'Please note that this quotation is valid for 90 days from the date specified in the quotation. Please use National Grid Metering''s Reference, which is at the top of the letter, on any future correspondence relating to this request.'; plpdf.PrintText(p_indent,p_vertical_offset+164,'office.');
plpdf.PrintFlowingText(6,l_big_text); --
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+172,'Please note that this quotation is valid for 90 days from the date specified in the quotation.');
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+176,'Please use National Grid Metering''s Reference, which is at the top of the letter, on any future');
plpdf.PrintFlowingText(6,'If you have any queries, please contact the team on the number above'); plpdf.PrintText(p_indent,p_vertical_offset+180,'correspondence relating to this request.');
plpdf.LineBreak; --
plpdf.LineBreak; plpdf.PrintText(p_indent,p_vertical_offset+188,'If you have any queries, please contact the team on the number above');
plpdf.PrintFlowingText(6,'Yours sincerely'); plpdf.PrintText(p_indent,p_vertical_offset+196,'Yours sincerely');
plpdf.PrintText(l_indent,l_vertical_offset+230,'David Harper'); plpdf.PrintText(p_indent,p_vertical_offset+216,'David Harper');
plpdf.PrintText(l_indent,l_vertical_offset+234,'I&C Technical Manager'); plpdf.PrintText(p_indent,p_vertical_offset+220,'I&C Technical Manager');
plpdf.PrintText(l_indent,l_vertical_offset+238,'National Grid Metering'); plpdf.PrintText(p_indent,p_vertical_offset+224,'National Grid Metering');
----Das page one complete, now lets do page 2... end build_covering_letter;
/*
PROCEDURE build_costs_page
--This procedure builds the costs page for the quotation, it writes data
--to an existing plpdf document
%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.
*/
PROCEDURE build_costs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
l_cost_line_counter number;
l_vertical_offset_for_costs number := p_vertical_offset+110;
l_cost_totals_offset number; --used to position the cost totals after the cost line items
begin
--Page 2
plpdf.NewPage; plpdf.NewPage;
plpdf.SetPrintFont(l_font,'B',10); --set bold -- set margins
plpdf.PrintText(l_indent,l_vertical_offset+10,'QUOTATION'); plpdf.SetLeftMargin(31.7);
plpdf.SetPrintFont(l_font,null,10); --unset bold plpdf.SetRightMargin(31.7);
plpdf.PrintText(l_indent,l_vertical_offset+18,'National Grid Metering''s Ref: '|| to_char(p_quote_data.quote_ref)); plpdf.SetTopMargin(25.4);
plpdf.PrintText(l_indent,l_vertical_offset+22,'Customer Reference: '|| p_quote_data.transaction_ref); plpdf.SetPrintFont(p_font,'B',10); --set bold
plpdf.PrintText(l_indent,l_vertical_offset+30,'Date: '||p_quote_data.current_date); plpdf.PrintText(p_indent,p_vertical_offset+10,'QUOTATION');
plpdf.SetPrintFont(l_font,'B',10); --set bold plpdf.SetPrintFont(p_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_vertical_offset+38,'Re: '||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+18,'National Grid Metering''s Ref: '|| to_char(p_quote_data.quote_ref));
plpdf.SetPrintFont(l_font,'U',10); --set underline plpdf.PrintText(p_indent,p_vertical_offset+22,'Customer Reference: '|| p_quote_data.transaction_ref);
plpdf.PrintText(l_indent,l_vertical_offset+48,'Full Description of Works to be carried out by National Grid Metering:'); plpdf.PrintText(p_indent,p_vertical_offset+30,'Date: '||p_quote_data.current_date);
plpdf.SetPrintFont(l_font,'B',10); --set bold plpdf.SetPrintFont(p_font,'B',10); --set bold
plpdf.PrintText(l_indent,l_vertical_offset+56, p_quote_data.quote_works(1)); plpdf.PrintText(p_indent,p_vertical_offset+38,'Re: '||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(l_indent,l_vertical_offset+60, p_quote_data.quote_works(2)); plpdf.SetPrintFont(p_font,'U',10); --set underline
plpdf.PrintText(l_indent,l_vertical_offset+64, p_quote_data.quote_works(3)); plpdf.PrintText(p_indent,p_vertical_offset+48,'Full Description of Works to be carried out by National Grid Metering:');
plpdf.PrintText(l_indent,l_vertical_offset+68, p_quote_data.quote_works(4)); plpdf.SetPrintFont(p_font,'B',10); --set bold
plpdf.PrintText(l_indent,l_vertical_offset+72, p_quote_data.quote_works(5)); plpdf.PrintText(p_indent,p_vertical_offset+56, p_quote_data.quote_works(1));
plpdf.PrintText(l_indent,l_vertical_offset+76, p_quote_data.quote_works(6)); plpdf.PrintText(p_indent,p_vertical_offset+60, p_quote_data.quote_works(2));
plpdf.SetPrintFont(l_font,null,10); --unset bold plpdf.PrintText(p_indent,p_vertical_offset+64, p_quote_data.quote_works(3));
plpdf.PrintText(l_indent,l_vertical_offset+90, 'Indicative Lead Time from Acceptance to Physical Commencement: '); plpdf.PrintText(p_indent,p_vertical_offset+68, p_quote_data.quote_works(4));
plpdf.SetPrintFont(l_font,'B',10); --set bold plpdf.PrintText(p_indent,p_vertical_offset+72, p_quote_data.quote_works(5));
plpdf.PrintText(140,l_vertical_offset+90, p_quote_data.lead_time||' working days'); plpdf.PrintText(p_indent,p_vertical_offset+76, p_quote_data.quote_works(6));
plpdf.SetPrintFont(l_font,null,10); --unset bold plpdf.SetPrintFont(p_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_vertical_offset+98,'Contract sum (excluding V.A.T): '); plpdf.PrintText(p_indent,p_vertical_offset+90, 'Indicative Lead Time from Acceptance to Physical Commencement: ');
plpdf.SetPrintFont(l_font,'B',10); --set bold plpdf.SetPrintFont(p_font,'B',10); --set bold
plpdf.PrintText(85,l_vertical_offset+98,'<27>'||p_quote_data.total_cost); plpdf.PrintText(140,p_vertical_offset+90, p_quote_data.lead_time||' working days');
plpdf.SetPrintFont(l_font,null,10); --unset bold plpdf.SetPrintFont(p_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_vertical_offset+106,'Analysis of Costs (all costs exclude V.A.T)'); plpdf.PrintText(p_indent,p_vertical_offset+98,'Contract sum (excluding V.A.T): ');
plpdf.SetPrintFont(l_font,'B',10); --set bold plpdf.SetPrintFont(p_font,'B',10); --set bold
plpdf.PrintText(85,p_vertical_offset+98,'<27>'||p_quote_data.total_cost);
plpdf.SetPrintFont(p_font,null,10); --unset bold
plpdf.PrintText(p_indent,p_vertical_offset+106,'Analysis of Costs (all costs exclude V.A.T)');
plpdf.SetPrintFont(p_font,'B',10); --set bold
l_cost_line_counter:=1; l_cost_line_counter:=1;
while p_quote_data.quote_costs(l_cost_line_counter).cost_description is not null while p_quote_data.quote_costs(l_cost_line_counter).cost_description is not null
loop loop
plpdf.PrintText(l_indent,l_vertical_offset_for_costs+l_cost_line_counter*4,p_quote_data.quote_costs(l_cost_line_counter).cost_description); 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,'<27>'||p_quote_data.quote_costs(l_cost_line_counter).cost_price); plpdf.PrintText(120,l_vertical_offset_for_costs+l_cost_line_counter*4,'<27>'||p_quote_data.quote_costs(l_cost_line_counter).cost_price);
l_cost_line_counter := l_cost_line_counter +1; l_cost_line_counter := l_cost_line_counter +1;
end loop; end loop;
l_cost_totals_offset := l_vertical_offset_for_costs+l_cost_line_counter*4; l_cost_totals_offset := l_vertical_offset_for_costs+l_cost_line_counter*4;
--think this line supposed to be in the cost items collection rather than hardcoded --think this line supposed to be in the cost items collection rather than hardcoded
--also delivery cost price does not seem to be available on the example I've been using --also delivery cost price does not seem to be available on the example I've been using
plpdf.PrintText(l_indent,l_cost_totals_offset,'Lifting Gear if required'); plpdf.PrintText(p_indent,l_cost_totals_offset,'Lifting Gear if required');
plpdf.PrintText(120,l_cost_totals_offset,'<27>220'); plpdf.PrintText(120,l_cost_totals_offset,'<27>220');
plpdf.DrawLine(l_indent,l_cost_totals_offset+2,185,l_cost_totals_offset+2); plpdf.DrawLine(p_indent,l_cost_totals_offset+2,185,l_cost_totals_offset+2);
plpdf.PrintText(l_indent,l_cost_totals_offset+6,'Total costs:'); plpdf.PrintText(p_indent,l_cost_totals_offset+6,'Total costs:');
plpdf.PrintText(120,l_cost_totals_offset+6,'<27>'||p_quote_data.total_cost||' excluding lifting gear if required'); plpdf.PrintText(120,l_cost_totals_offset+6,'<27>'||p_quote_data.total_cost||' excluding lifting gear if required');
--Well 2 pages down just another 2..4 left to go! Let's start page 3 end build_costs_page;
/*
PROCEDURE build_caveats_page
--This procedure builds the caveats page for the quotation, it writes data
--to an existing plpdf document
%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.
*/
PROCEDURE build_caveats_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
begin
--Page 3
plpdf.NewPage; plpdf.NewPage;
plpdf.SetPrintFont(l_font,null,10); --unset bold -- set margins
plpdf.SetLeftMargin(31.7);
plpdf.SetRightMargin(31.7);
plpdf.SetTopMargin(25.4);
plpdf.SetPrintFont(p_font,null,10); --set font to plain
--house --house
plpdf.PrintText(l_indent,l_vertical_offset+10,'Meter Housing Details (if required):'); plpdf.PrintText(p_indent,p_vertical_offset+10,'Meter Housing Details (if required):');
plpdf.PrintText(l_indent,l_vertical_offset+18,'Length: '||p_quote_data.house_length||' mm'); plpdf.PrintText(p_indent,p_vertical_offset+18,'Length: '||p_quote_data.house_length||' mm');
plpdf.PrintText(l_indent+40,l_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(l_indent+80,l_vertical_offset+18,'Height: '||p_quote_data.house_height||' mm'); plpdf.PrintText(p_indent+80,p_vertical_offset+18,'Height: '||p_quote_data.house_height||' mm');
plpdf.PrintText(l_indent,l_vertical_offset+26,'Minimum Ventilation: '||p_quote_data.house_ventilation||' sq. cm'); plpdf.PrintText(p_indent,p_vertical_offset+26,'Minimum Ventilation: '||p_quote_data.house_ventilation||' sq. cm');
--base --base
plpdf.PrintText(l_indent,l_vertical_offset+42,'Meter Housing Base (if required):'); plpdf.PrintText(p_indent,p_vertical_offset+42,'Meter Housing Base (if required):');
plpdf.PrintText(l_indent,l_vertical_offset+50,'Length: '||p_quote_data.base_length||' mm'); plpdf.PrintText(p_indent,p_vertical_offset+50,'Length: '||p_quote_data.base_length||' mm');
plpdf.PrintText(l_indent+40,l_vertical_offset+50,'Depth: '||p_quote_data.base_depth||' mm'); plpdf.PrintText(p_indent+40,p_vertical_offset+50,'Depth: '||p_quote_data.base_depth||' mm');
plpdf.PrintText(l_indent+80,l_vertical_offset+50,'Height: '||p_quote_data.base_height||' mm'); plpdf.PrintText(p_indent+80,p_vertical_offset+50,'Height: '||p_quote_data.base_height||' mm');
plpdf.PrintText(l_indent,l_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(l_indent,l_vertical_offset+74,'Special Features/Terms/Conditions:'); plpdf.PrintText(p_indent,p_vertical_offset+74,'Special Features/Terms/Conditions:');
--CAVEATS GO HERE DUDES/DUDETTES --CAVEATS GO HERE DUDES/DUDETTES
plpdf.SetPrintFont(l_font,'B',10); --set bold plpdf.SetPrintFont(p_font,'B',10); --set bold
--the caveats will be looped in so the positioning of the the following items will --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(l_font,null,10); --unset bold plpdf.SetPrintFont(p_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_vertical_offset+200,'Liquidated Damages (sum per day)(excluding V.A.T):'); plpdf.PrintText(p_indent,p_vertical_offset+200,'Liquidated Damages (sum per day)(excluding V.A.T):');
plpdf.PrintText(130,l_vertical_offset+200,'<27>'||p_quote_data.liquid_damage_day); plpdf.PrintText(130,p_vertical_offset+200,'<27>'||p_quote_data.liquid_damage_day);
plpdf.PrintText(l_indent,l_vertical_offset+208,'Liquidated Damages (monetary cap)(excluding V.A.T):'); plpdf.PrintText(p_indent,p_vertical_offset+208,'Liquidated Damages (monetary cap)(excluding V.A.T):');
plpdf.PrintText(130,l_vertical_offset+208,'<27>'||p_quote_data.liquid_damage_cap); plpdf.PrintText(130,p_vertical_offset+208,'<27>'||p_quote_data.liquid_damage_cap);
end build_caveats_page;
/*
PROCEDURE build_drawings_page
--This procedure builds the drawings page for the quotation, it writes data
--to an existing plpdf document
%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.
*/
PROCEDURE build_drawings_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
begin
--Okay here come the pretty pictures, the technical spec for the module, house & base --Okay here come the pretty pictures, the technical spec for the module, house & base
--this will be page 4 for the quotation --this will be page 4 for the quotation
plpdf.NewPage; plpdf.NewPage;
plpdf.SetPrintFont(l_font,'B',18); --set bold and 18pt -- set margins
plpdf.PrintText(l_indent,l_vertical_offset,'Technical Specification for '||p_quote_data.quote_ref); plpdf.SetLeftMargin(31.7);
plpdf.SetPrintFont(l_font,'B',10); --set back to 10pt plpdf.SetRightMargin(31.7);
plpdf.PrintText(l_indent,l_vertical_offset+6,'Re: '||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.SetTopMargin(25.4);
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: '||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
--Base Details --Base Details
plpdf.SetPrintFont(l_font,'BU',12); --set bold,underline and 12pt plpdf.SetPrintFont(p_font,'BU',12); --set bold,underline and 12pt
plpdf.PrintText(l_indent,l_vertical_offset+12,'Floor Area/Base Requirements'); plpdf.PrintText(p_indent,p_vertical_offset+12,'Floor Area/Base Requirements');
plpdf.SetPrintFont(l_font,null,10); --set back to 10pt plain plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain
plpdf.SetCurrentXY(l_indent,l_vertical_offset+25); plpdf.SetCurrentXY(p_indent,p_vertical_offset+25);
plpdf.PrintCell(15,6,'Depth:',1,0,'L',0); 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,'Dim A:',1,0,'L',0);
@@ -772,10 +813,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.PrintCell(15,6,'Dim I:',1,0,'L',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);
--House Details --House Details
plpdf.SetPrintFont(l_font,'BU',12); --set bold,underline and 12pt plpdf.SetPrintFont(p_font,'BU',12); --set bold,underline and 12pt
plpdf.PrintText(l_indent,l_vertical_offset+100,'Housing / Work Area'); plpdf.PrintText(p_indent,p_vertical_offset+100,'Housing / Work Area');
plpdf.SetPrintFont(l_font,null,10); --set back to 10pt plain plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain
plpdf.SetCurrentXY(l_indent,l_vertical_offset+108); plpdf.SetCurrentXY(p_indent,p_vertical_offset+108);
plpdf.PrintCell(15,6,'Length:',1,0,'L',0); 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,'Width:',1,0,'L',0);
@@ -785,10 +826,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.PrintCell(15,6,'Weight:',1,0,'L',0); plpdf.PrintCell(15,6,'Weight:',1,0,'L',0);
plpdf.PrintCell(15,6,p_quote_data.house_dimensions(4),1,1,'R',0); plpdf.PrintCell(15,6,p_quote_data.house_dimensions(4),1,1,'R',0);
--Module details --Module details
plpdf.SetPrintFont(l_font,'BU',12); --set bold,underline and 12pt plpdf.SetPrintFont(p_font,'BU',12); --set bold,underline and 12pt
plpdf.PrintText(l_indent,l_vertical_offset+168,'Module Dimensions'); plpdf.PrintText(p_indent,p_vertical_offset+168,'Module Dimensions');
plpdf.SetPrintFont(l_font,null,10); --set back to 10pt plain plpdf.SetPrintFont(p_font,null,10); --set back to 10pt plain
plpdf.SetCurrentXY(l_indent,l_vertical_offset+180); plpdf.SetCurrentXY(p_indent,p_vertical_offset+180);
plpdf.PrintCell(15,6,'Dim A:',1,0,'L',0); 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,'Dim B:',1,0,'L',0);
@@ -807,25 +848,43 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
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,'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);
plpdf.SetPrintFont(l_font,null,9); --set to 9pt plpdf.SetPrintFont(p_font,null,9); --set to 9pt
plpdf.PrintText(l_indent,l_vertical_offset+245,'Note: All weights are in kg and all dimensions in mm Module Ref: '||p_quote_data.module_reference); plpdf.PrintText(p_indent,p_vertical_offset+245,'Note: All weights are in kg and all dimensions in mm Module Ref: '||p_quote_data.module_reference);
plpdf.PrintText(l_indent,l_vertical_offset+260,'National Grid Metering, Abbotts Lane, Coventry, West Midlands, CV1 4AY Tel 02476 286000 Fax 02476 286022'); 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_drawings_page;
/*
PROCEDURE build_module_specs_page
--This procedure builds the module specification page for the quotation, it writes data
--to an existing plpdf document
%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.
*/
PROCEDURE build_module_specs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
begin
--this will be page 5 (part of the technical spec sheet) for the quotation --this will be page 5 (part of the technical spec sheet) for the quotation
plpdf.NewPage; plpdf.NewPage;
plpdf.SetPrintFont(l_font,'B',18); --set bold and 18pt -- set margins
plpdf.PrintText(l_indent,l_vertical_offset,'Technical Specification for '||p_quote_data.quote_ref); plpdf.SetLeftMargin(31.7);
plpdf.SetPrintFont(l_font,'B',10); --set back to 10pt plpdf.SetRightMargin(31.7);
plpdf.PrintText(l_indent,l_vertical_offset+6,'Re: '||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.SetTopMargin(25.4);
plpdf.SetPrintFont(l_font,null,10); --set back to plain plpdf.SetPrintFont(p_font,'B',18); --set bold and 18pt
plpdf.PrintText(l_indent,l_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,'Technical Specification for '||p_quote_data.quote_ref);
plpdf.PrintText(l_indent,l_vertical_offset+18,'Operating Pressure(LOP-from table1) at the Emergency Control Valve(ECV) outlet'); plpdf.SetPrintFont(p_font,'B',10); --set back to 10pt
plpdf.PrintText(l_indent,l_vertical_offset+22,'under the requested Q Max load as detailed below in table 2'); plpdf.PrintText(p_indent,p_vertical_offset+6,'Re: '||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.SetCurrentXY(l_indent,l_vertical_offset+30); plpdf.SetPrintFont(p_font,null,10); --set back to plain
plpdf.SetPrintFont(l_font,'B',10); --set to bold 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.PrintCell(90,6,'Table 1',1,0,'L',0);
plpdf.PrintCell(30,6,'ECV Outlet (u)',1,0,'C',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(l_font,null,10); --set back to plain plpdf.SetPrintFont(p_font,null,10); --set back to plain
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(30,6,'19 mbar',1,0,'C',0);
plpdf.PrintCell(40,6,'15 mbar',1,1,'C',0); plpdf.PrintCell(40,6,'15 mbar',1,1,'C',0);
@@ -835,24 +894,29 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.PrintCell(90,6,'Pressure Tier',1,0,'L',0); plpdf.PrintCell(90,6,'Pressure Tier',1,0,'L',0);
plpdf.PrintCell(30,6,'75 mbar',1,0,'C',0); plpdf.PrintCell(30,6,'75 mbar',1,0,'C',0);
plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0); plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0);
plpdf.SetCurrentXY(l_indent,l_vertical_offset+60); --table 2
plpdf.SetPrintFont(l_font,'B',10); --set to bold 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(90,6,'Table 2',1,0,'L',0);
plpdf.PrintCell(70,6,'Meter Module Design',1,1,'C',0); plpdf.PrintCell(70,6,'Meter Module Design',1,1,'C',0);
plpdf.SetPrintFont(l_font,null,10); --set back to plain 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(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(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(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); plpdf.PrintCell(70,6,p_quote_data.module_qmin,1,1,'C',0);
plpdf.SetCurrentXY(l_indent,l_vertical_offset+90); --table 3
plpdf.SetPrintFont(l_font,'B',10); --set to bold 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(90,6,'Table 3',1,0,'L',0);
plpdf.PrintCell(70,6,'Module Design Parameters',1,1,'C',0); plpdf.PrintCell(70,6,'Module Design Parameters',1,1,'C',0);
plpdf.SetPrintFont(l_font,null,10); --set back to plain plpdf.SetPrintFont(p_font,null,10); --set back to plain
plpdf.PrintMultilineCell(60,30,'Note: Inlet connection',1,'L',0); 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);
plpdf.SetCurrentXY(91.7,l_vertical_offset+101); --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
plpdf.SetCurrentXY(91.7,p_vertical_offset+96);
plpdf.PrintCell(30,6,'',1,0,'C',0); plpdf.PrintCell(30,6,'',1,0,'C',0);
plpdf.PrintCell(35,6,'Inlet',1,0,'C',0); plpdf.PrintCell(35,6,'Inlet',1,0,'C',0);
plpdf.PrintCell(35,6,'Outlet',1,1,'C',0); plpdf.PrintCell(35,6,'Outlet',1,1,'C',0);
@@ -872,34 +936,129 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.PrintCell(30,6,'Orientation',1,0,'C',0); plpdf.PrintCell(30,6,'Orientation',1,0,'C',0);
plpdf.PrintCell(35,6,p_quote_data.module_inlet_orientation,1,0,'C',0); plpdf.PrintCell(35,6,p_quote_data.module_inlet_orientation,1,0,'C',0);
plpdf.PrintCell(35,6,p_quote_data.module_outlet_orientation,1,1,'C',0); plpdf.PrintCell(35,6,p_quote_data.module_outlet_orientation,1,1,'C',0);
plpdf.PrintText(l_indent,l_vertical_offset+130,'The meter module offered is a single stream supply with only a nominal maintenance'); plpdf.PrintText(p_indent,p_vertical_offset+134,'The meter module offered is a single stream supply with only a nominal maintenance');
plpdf.PrintText(l_indent,l_vertical_offset+134,'bypass facility. The bypass connections are for use during maintenance, and are only'); plpdf.PrintText(p_indent,p_vertical_offset+138,'bypass facility. The bypass connections are for use during maintenance, and are only');
plpdf.PrintText(l_indent,l_vertical_offset+138,'sized to maintain gas pressure downstream under no load conditions. Therefore'); plpdf.PrintText(p_indent,p_vertical_offset+142,'sized to maintain gas pressure downstream under no load conditions. Therefore');
plpdf.PrintText(l_indent,l_vertical_offset+142,'during maintenance it will be necessary to disrupt supplies.'); plpdf.PrintText(p_indent,p_vertical_offset+146,'during maintenance it will be necessary to disrupt supplies.');
-- --next para
plpdf.PrintText(l_indent,l_vertical_offset+150,'Electric Connections to gas meters are subject to the assesment of the hazardous'); plpdf.PrintText(p_indent,p_vertical_offset+154,'Electric Connections to gas meters are subject to the assesment of the hazardous');
plpdf.PrintText(l_indent,l_vertical_offset+154,'area around the meter, this is largely affected by the ventilation of the housing. Should'); plpdf.PrintText(p_indent,p_vertical_offset+158,'area around the meter, this is largely affected by the ventilation of the housing. Should');
plpdf.PrintText(l_indent,l_vertical_offset+158,'the ventilation be found to be inadequate, the connection will not be made and the'); 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(l_indent,l_vertical_offset+162,'requirements to allow the connection reported to you. The quotation does not include'); plpdf.PrintText(p_indent,p_vertical_offset+166,'requirements to allow the connection reported to you. The quotation does not include');
plpdf.PrintText(l_indent,l_vertical_offset+166,'the provision of a separate instrumentation cabinet.'); plpdf.PrintText(p_indent,p_vertical_offset+170,'the provision of a separate instrumentation cabinet.');
plpdf.SetPrintFont(l_font,null,9); --set back to plain plpdf.SetPrintFont(p_font,null,7); --set to 7 pt
plpdf.PrintText(l_indent,l_vertical_offset+174,'Definitions'); plpdf.PrintText(p_indent,p_vertical_offset+178,'Definitions');
plpdf.PrintText(l_indent,l_vertical_offset+178,'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+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(l_indent,l_vertical_offset+182,'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(l_indent,l_vertical_offset+186,'Conversion calculations are based on an average CV of 38.4 MJ/m3'); 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.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;
/*
PROCEDURE build_acceptance_page
--This procedure builds the acceptance form page for the quotation, it writes data
--to an existing plpdf document
%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.
*/
PROCEDURE build_acceptance_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
begin
---weeeeee last page
plpdf.NewPage;
-- set margins
plpdf.SetLeftMargin(31.7);
plpdf.SetRightMargin(31.7);
plpdf.SetTopMargin(25.4);
-- Set header stuff up
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,13,'F +44 (0) 24 7628 6022');
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.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);
plpdf.PrintText(p_indent,p_vertical_offset+18,'MPRN: '|| to_char(p_quote_data.mprn));
plpdf.PrintText(p_indent,p_vertical_offset+26,'F.A.O');
plpdf.PrintText(p_indent,p_vertical_offset+30,'I&C Work Planning Team');
plpdf.PrintText(p_indent,p_vertical_offset+34,'National Grid Metering Ltd');
plpdf.PrintText(p_indent,p_vertical_offset+38,'Abbott''s Lane');
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: '||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.PrintText(85,p_vertical_offset+62,'<27>'||p_quote_data.total_cost||' excluding lifting gear if required.');
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');
plpdf.PrintText(p_indent,p_vertical_offset+102,'as detailed therein is acceptable to my Company provided that (in addition to the conditions set');
plpdf.PrintText(p_indent,p_vertical_offset+106,'out in the quotation [if any]) the General Conditions of Contract for Transactional Meter Works');
plpdf.PrintText(p_indent,p_vertical_offset+110,'Not Exceeding 7 Bar in respect of the works are modified by the incorporation of the terms and');
plpdf.PrintText(p_indent,p_vertical_offset+114,'conditions annexed hereto.');
plpdf.PrintText(p_indent,p_vertical_offset+122,'(* Delete as appropriate)');
plpdf.PrintText(p_indent,p_vertical_offset+130,'Save as set out above, I confirm that my Company agrees to be bound in connection with the');
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+120,p_vertical_offset+162,'___/___/___');
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:_____________________________________________________________________');
end build_acceptance_page;
/*
FUNCTION generate_detailed_quote_pdf
--The generate_detailed_quote_pdf builds the pdf document for the quotation from
--the supplied data and stores the resulting pdf document in the database.
%param p_quote_data - the data to build into the quote.
%return - true if we created and stored the pdf(perhaps should be the id of the pdf file
*/
FUNCTION generate_detailed_quote_pdf(p_quote_data in quote_data) RETURN BOOLEAN is
l_blob blob;
l_indent number := 31.7;
l_vertical_offset number := 30;
l_font varchar2(40) := 'Arial'; --arial not daz
begin
-- Get the blob from somewhere
--Simple example to retrieve and use template:
-- Initialize PDF
plpdf.init;
--build the pages for the quote
build_covering_letter(p_quote_data,l_font,l_indent,l_vertical_offset); --1
build_costs_page(p_quote_data,l_font,l_indent,l_vertical_offset); --2
build_caveats_page(p_quote_data,l_font,l_indent,l_vertical_offset); --3
build_drawings_page(p_quote_data,l_font,l_indent,l_vertical_offset); --4
--build_module_specs_page(p_quote_data,l_font,l_indent,l_vertical_offset); --5
build_acceptance_page(p_quote_data,l_font,l_indent,l_vertical_offset); --6
--get our beautiful pdf into the local var l_blob --get our beautiful pdf into the local var l_blob
plpdf.SendDoc(l_blob); plpdf.SendDoc(l_blob);
--punt the created pdf into the testpdf table --punt the created pdf into the testpdf table
insert into testpdf (id, pdf_report) insert into testpdf (id, pdf_report)
values (11, l_blob); values (11, l_blob);
return true; return true; -- perhaps we should return the id of the newly created blob record?
end generate_detailed_quote_pdf; end generate_detailed_quote_pdf;
FUNCTION build_detailed_quote(p_enquiryid in number) RETURN BOOLEAN is
begin
null;
end build_detailed_quote;
BEGIN BEGIN
-- Initialization -- Initialization