added another couple of pages top the pdf a few things still need sorting on it, need to talk to AH about the quote_items table and if he is going to populate all the table columns with data

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3121 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2008-01-03 18:42:35 +00:00
parent 53df2a260d
commit a117f49d54

View File

@@ -40,12 +40,12 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS
liquid_damage_day number,
liquid_damage_cap number,
base_dimensions dimensions := dimensions(null,null,null,null,null,null,null,null,null,null),
base_diagram number,
base_diagram varchar2(80),
house_dimensions dimensions := dimensions(null,null,null,null,null,null,null,null,null,null),
house_diagram number,
house_diagram varchar2(80),
module_dimensions dimensions := dimensions(null,null,null,null,null,null,null,null,null,null),
module_reference varchar2(80),
module_diagram number,
module_diagram varchar2(80),
requested_qmax number,
module_qmax number,
module_qmin number,
@@ -332,6 +332,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
p_quote_data.base_dimensions(8) := l_base_row.dim_g;
p_quote_data.base_dimensions(9) := l_base_row.dim_h;
p_quote_data.base_dimensions(10) := l_base_row.dim_i;
p_quote_data.base_diagram := l_base_row.drwg_code;
when 'HQI' then --housing item
l_addons := l_addons || ', Housing';
--Set up the costs
@@ -352,6 +353,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
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(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
@@ -398,6 +400,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
p_quote_data.module_outlet_type := l_module_row.outlet_cnty_code;
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
l_meter_row := get_meter_row(l_module_row.metr_code);
@@ -421,10 +424,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
--get service pressure
l_works(2) := 'Service Pressure: '|| p_enqu_row.required_svcp_code; --may need to get this from quote items table instead
--get existing meter if appropriate
if l_quote_item_row.enty_code <>'INSTALL' or l_quote_item_row.enty_code <>'STD INSTALL' then
if l_quote_item_row.enty_code <>'INSTALL' and l_quote_item_row.enty_code <>'STD INSTALL' then
l_works(4) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||', '|| p_enqu_row.existing_meter_model;
end if;
if l_quote_item_row.enty_code <> 'OFMAT' or l_quote_item_row.enty_code <> 'ADVERSARIAL'then
if l_quote_item_row.enty_code <> 'OFMAT' and l_quote_item_row.enty_code <> 'ADVERSARIAL'then
l_total_cost := p_quote_data.total_cost;
if l_total_cost <= 1000 then
p_quote_data.liquid_damage_day := 20;
@@ -593,9 +596,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document 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_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
-- Get the blob from somewhere
--Simple example to retrieve and use template:
@@ -663,7 +669,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.PrintText(l_indent,l_vertical_offset+230,'David Harper');
plpdf.PrintText(l_indent,l_vertical_offset+234,'I&C Technical Manager');
plpdf.PrintText(l_indent,l_vertical_offset+238,'National Grid Metering');
----Das page one complete
----Das page one complete, now lets do page 2...
plpdf.NewPage;
plpdf.SetPrintFont(l_font,'B',10); --set bold
plpdf.PrintText(l_indent,l_vertical_offset+10,'QUOTATION');
@@ -685,8 +691,203 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.SetPrintFont(l_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_vertical_offset+90, 'Indicative Lead Time from Acceptance to Physical Commencement: ');
plpdf.SetPrintFont(l_font,'B',10); --set bold
plpdf.PrintText(140,l_vertical_offset+90, p_quote_data.lead_time||' working days');
plpdf.PrintText(140,l_vertical_offset+90, p_quote_data.lead_time||' working days');
plpdf.SetPrintFont(l_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_vertical_offset+98,'Contract sum (excluding V.A.T): ');
plpdf.SetPrintFont(l_font,'B',10); --set bold
plpdf.PrintText(85,l_vertical_offset+98,'<27>'||p_quote_data.total_cost);
plpdf.SetPrintFont(l_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_vertical_offset+106,'Analysis of Costs (all costs exclude V.A.T)');
plpdf.SetPrintFont(l_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(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(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;
end loop;
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
--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(120,l_cost_totals_offset,'<27>220');
plpdf.DrawLine(l_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(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
plpdf.NewPage;
plpdf.SetPrintFont(l_font,null,10); --unset bold
--house
plpdf.PrintText(l_indent,l_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(l_indent+40,l_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(l_indent,l_vertical_offset+26,'Minimum Ventilation: '||p_quote_data.house_ventilation||' sq. cm');
--base
plpdf.PrintText(l_indent,l_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(l_indent+40,l_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(l_indent,l_vertical_offset+58,'Minimum Ventilation: '||p_quote_data.outlet_termninal_size||' mm');
plpdf.PrintText(l_indent,l_vertical_offset+74,'Special Features/Terms/Conditions:');
--CAVEATS GO HERE DUDES/DUDETTES
plpdf.SetPrintFont(l_font,'B',10); --set bold
--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)
plpdf.SetPrintFont(l_font,null,10); --unset bold
plpdf.PrintText(l_indent,l_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(l_indent,l_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);
--Okay here come the pretty pictures, the technical spec for the module, house & base
--this will be page 4 for the quotation
plpdf.NewPage;
plpdf.SetPrintFont(l_font,'B',18); --set bold and 18pt
plpdf.PrintText(l_indent,l_vertical_offset,'Technical Specification for '||p_quote_data.quote_ref);
plpdf.SetPrintFont(l_font,'B',10); --set back to 10pt
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
--Base Details
plpdf.SetPrintFont(l_font,'BU',12); --set bold,underline and 12pt
plpdf.PrintText(l_indent,l_vertical_offset+12,'Floor Area/Base Requirements');
plpdf.SetPrintFont(l_font,null,10); --set back to 10pt plain
plpdf.SetCurrentXY(l_indent,l_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,'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,'Dim C:',1,0,'L',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,'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,'Dim H:',1,0,'L',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);
--House Details
plpdf.SetPrintFont(l_font,'BU',12); --set bold,underline and 12pt
plpdf.PrintText(l_indent,l_vertical_offset+100,'Housing / Work Area');
plpdf.SetPrintFont(l_font,null,10); --set back to 10pt plain
plpdf.SetCurrentXY(l_indent,l_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,'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,'Weight:',1,0,'L',0);
plpdf.PrintCell(15,6,p_quote_data.house_dimensions(4),1,1,'R',0);
--Module details
plpdf.SetPrintFont(l_font,'BU',12); --set bold,underline and 12pt
plpdf.PrintText(l_indent,l_vertical_offset+168,'Module Dimensions');
plpdf.SetPrintFont(l_font,null,10); --set back to 10pt plain
plpdf.SetCurrentXY(l_indent,l_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,'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,'Dim D:',1,0,'L',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,'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,'Weight:',1,0,'L',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.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(l_indent,l_vertical_offset+260,'National Grid Metering, Abbotts Lane, Coventry, West Midlands, CV1 4AY Tel 02476 286000 Fax 02476 286022');
--this will be page 5 (part of the technical spec sheet) for the quotation
plpdf.NewPage;
plpdf.SetPrintFont(l_font,'B',18); --set bold and 18pt
plpdf.PrintText(l_indent,l_vertical_offset,'Technical Specification for '||p_quote_data.quote_ref);
plpdf.SetPrintFont(l_font,'B',10); --set back to 10pt
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.SetPrintFont(l_font,null,10); --set back to plain
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(l_indent,l_vertical_offset+18,'Operating Pressure(LOP-from table1) at the Emergency Control Valve(ECV) outlet');
plpdf.PrintText(l_indent,l_vertical_offset+22,'under the requested Q Max load as detailed below in table 2');
plpdf.SetCurrentXY(l_indent,l_vertical_offset+30);
plpdf.SetPrintFont(l_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.SetPrintFont(l_font,null,10); --set back to plain
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(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(30,6,'75 mbar',1,0,'C',0);
plpdf.PrintCell(40,6,'21 mbar',1,1,'C',0);
plpdf.SetCurrentXY(l_indent,l_vertical_offset+60);
plpdf.SetPrintFont(l_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(l_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(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(70,6,p_quote_data.module_qmin,1,1,'C',0);
plpdf.SetCurrentXY(l_indent,l_vertical_offset+90);
plpdf.SetPrintFont(l_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(l_font,null,10); --set back to plain
plpdf.PrintMultilineCell(60,30,'Note: Inlet connection',1,'L',0);
plpdf.SetCurrentXY(91.7,l_vertical_offset+101);
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);
plpdf.SetCurrentX(91.7);
plpdf.PrintCell(30,6,'Height',1,0,'C',0);
plpdf.PrintCell(35,6,p_quote_data.module_inlet_height||'mm',1,0,'C',0);
plpdf.PrintCell(35,6,p_quote_data.module_outlet_height||'mm',1,1,'C',0);
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.SetCurrentX(91.7);
plpdf.PrintCell(30,6,'Type',1,0,'C',0);
plpdf.PrintCell(35,6,p_quote_data.module_inlet_type||'mm',1,0,'C',0);
plpdf.PrintCell(35,6,p_quote_data.module_outlet_type||'mm',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);
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(l_indent,l_vertical_offset+134,'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(l_indent,l_vertical_offset+142,'during maintenance it will be necessary to disrupt supplies.');
--
plpdf.PrintText(l_indent,l_vertical_offset+150,'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(l_indent,l_vertical_offset+158,'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(l_indent,l_vertical_offset+166,'the provision of a separate instrumentation cabinet.');
plpdf.SetPrintFont(l_font,null,9); --set back to plain
plpdf.PrintText(l_indent,l_vertical_offset+174,'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(l_indent,l_vertical_offset+182,'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');
--get our beautiful pdf into the local var l_blob
plpdf.SendDoc(l_blob);
--punt the created pdf into the testpdf table