new function in mip_files to set the file association for drawings/enquiries and quotes. Fixed a few more bugs in the quote pdf builder, and have made a short start on getting the module drawings into the quote.
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3175 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -56,7 +56,8 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS
|
||||
module_inlet_type varchar2(80),
|
||||
module_outlet_type varchar2(80),
|
||||
module_inlet_orientation varchar2(80),
|
||||
module_outlet_orientation varchar2(80)
|
||||
module_outlet_orientation varchar2(80),
|
||||
meter_reference varchar(80)
|
||||
);
|
||||
|
||||
-- Public constant declarations
|
||||
@@ -65,7 +66,7 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS
|
||||
-- Public variable declarations
|
||||
--<VariableName> <Datatype>;
|
||||
|
||||
|
||||
function get_total_cost(p_quoteid number) return number;
|
||||
-- Public function and procedure declarations
|
||||
-- function <FunctionName>(<Parameter> <Datatype>) return <Datatype>;
|
||||
function get_mam(p_region_code varchar2) return varchar2;
|
||||
@@ -239,17 +240,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
*/
|
||||
function get_total_cost(p_quoteid number) return number is
|
||||
l_quote_total_cost number;
|
||||
CURSOR c_get_total_cost (cp_id number) is
|
||||
SELECT SUM(selling_price + delivery_price)
|
||||
FROM quote_items
|
||||
WHERE qute_id = cp_id;
|
||||
|
||||
begin
|
||||
IF NOT c_get_total_cost%ISOPEN THEN
|
||||
OPEN c_get_total_cost(p_quoteid);
|
||||
END IF;
|
||||
FETCH c_get_total_cost
|
||||
INTO l_quote_total_cost;
|
||||
CLOSE c_get_total_cost;
|
||||
|
||||
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 <> 'LIFTING GEAR');
|
||||
|
||||
return l_quote_total_cost;
|
||||
end get_total_cost;
|
||||
|
||||
@@ -283,7 +281,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
FROM enquiry_types
|
||||
WHERE code = cp_enty_code;
|
||||
--Quote Items
|
||||
l_quote_item_row quote_items%ROWTYPE;
|
||||
CURSOR c_get_quote_item(cp_quoteid number) IS
|
||||
SELECT *
|
||||
FROM quote_items
|
||||
@@ -299,11 +296,29 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
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_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
|
||||
if quote_item_rec.quit_type = 'LQI' then
|
||||
l_service_pressure := quote_item_rec.svcpt_code;
|
||||
l_meter_type := quote_item_rec.mety_code;
|
||||
l_enqu_type := quote_item_rec.enty_code;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
|
||||
--cycle through the quote items picking up each item to display on the
|
||||
--description of works section
|
||||
|
||||
l_counter := 0;
|
||||
FOR quote_item_rec IN c_get_quote_item(p_quoteid) LOOP
|
||||
--get the meter type, pressure and job type so we can
|
||||
--determine whether to display the lifting gear cost line or not
|
||||
l_counter := l_counter + 1;
|
||||
case quote_item_rec.quit_type
|
||||
when 'BQI' then --base item
|
||||
@@ -362,15 +377,26 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
--LP Diaphgram install/std install jobs
|
||||
--Get costs
|
||||
l_add_item_row := get_additional_item(quote_item_rec.adit_code);
|
||||
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;
|
||||
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
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
end if;
|
||||
--set the list of add-ons for this quote
|
||||
l_addons := l_addons || ', '||l_add_item_row.description;
|
||||
--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;
|
||||
when 'MQI' then --module item
|
||||
--get costs
|
||||
p_quote_data.quote_costs(l_counter).cost_description := 'Module Materials cost';
|
||||
@@ -382,7 +408,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
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 || ' ' || l_module_row.metr_code;
|
||||
l_works(3) := 'Meter Type: '|| l_module_row.svcp_code || ' ' || p_quote_data.meter_reference;
|
||||
p_quote_data.outlet_termninal_size := l_module_row.outlet_size;
|
||||
--module technical details
|
||||
p_quote_data.module_dimensions(1) := l_module_row.dim_a;
|
||||
@@ -395,6 +421,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
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_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;
|
||||
p_quote_data.module_outlet_height := l_module_row.outlet_height;
|
||||
p_quote_data.module_inlet_size := l_module_row.inlet_size;
|
||||
@@ -406,7 +433,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
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);
|
||||
|
||||
p_quote_data.module_qmax := l_meter_row.qmax;
|
||||
p_quote_data.module_qmin := l_meter_row.qmin;
|
||||
when 'LQI' then --Labour cost
|
||||
@@ -421,11 +447,27 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
|
||||
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
|
||||
l_works(5) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||', '|| p_enqu_row.existing_meter_model;
|
||||
end if;
|
||||
if quote_item_rec.enty_code <> 'OFMAT' and quote_item_rec.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;
|
||||
p_quote_data.liquid_damage_cap := 200;
|
||||
else
|
||||
p_quote_data.liquid_damage_day := (l_total_cost/100)*2.5;
|
||||
p_quote_data.liquid_damage_cap := (l_total_cost/100)*25;
|
||||
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(p_enqu_row.enty_code);
|
||||
OPEN c_get_enquiry_type(l_enqu_type );
|
||||
END IF;
|
||||
|
||||
FETCH c_get_enquiry_type
|
||||
@@ -434,24 +476,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
|
||||
l_works(1) := 'Works Type: '||l_enqu_type_row.description;
|
||||
--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' 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' 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;
|
||||
p_quote_data.liquid_damage_cap := 200;
|
||||
else
|
||||
p_quote_data.liquid_damage_day := (l_total_cost/100)*2.5;
|
||||
p_quote_data.liquid_damage_cap := (l_total_cost/100)*25;
|
||||
end if;
|
||||
end if;
|
||||
l_works(2) := 'Service Pressure: '|| l_service_pressure;
|
||||
--
|
||||
--add up all the addons and format the string
|
||||
l_works(5) := 'Add-Ons: '|| l_addons;
|
||||
l_works(4) := 'Add-Ons: '|| ltrim(l_addons, ',');
|
||||
p_quote_data.quote_works := l_works;
|
||||
end set_quote_items_data;
|
||||
|
||||
@@ -609,6 +637,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
*/
|
||||
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) is
|
||||
l_contracts_text varchar2(500);
|
||||
l_cell_margin number;
|
||||
begin
|
||||
plpdf.NewPage;
|
||||
-- set margins
|
||||
@@ -646,32 +675,37 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+78,'E-mail address: iandcrequests1@uk.ngrid.com');
|
||||
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: '||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
|
||||
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 := l_contracts_text||' General Conditions of Contract for Transactional Meter Works not Exceeding 7 Bar.';
|
||||
l_cell_margin:= plpdf.GetCellMargin;
|
||||
plpdf.SetLeftMargin(33.7);
|
||||
plpdf.SetCellMargin(-2);
|
||||
plpdf.SetCurrentY(p_vertical_offset+106);
|
||||
plpdf.PrintFlowingText(6,l_contracts_text);
|
||||
plpdf.PrintFlowingText(4,l_contracts_text);
|
||||
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.');
|
||||
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.PrintText(p_indent,p_vertical_offset+136,'assumptions are correct. If it is later determined, by either party prior to works commencing on');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+140,'site, that any stated assumption is significantly incorrect, National Grid Metering will determine');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+144,'whether the quotation shall be varied or withdrawn. Works will only then commence if any');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+148,'variation is agreed in line with the relevant General Conditions of Contract.');
|
||||
plpdf.SetCellMargin(l_cell_margin);
|
||||
plpdf.SetLeftMargin(31.7);
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+120,'This quotation is produced on the basis that, the information provided in the request is correct.');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+124,'Your acceptance of the quotation will be taken to mean that you also accept that the stated');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+128,'assumptions are correct. If it is later determined, by either party prior to works commencing on');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+132,'site, that any stated assumption is significantly incorrect, National Grid Metering will determine');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+136,'whether the quotation shall be varied or withdrawn. Works will only then commence if any');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+140,'variation is agreed in line with the relevant General Conditions of Contract.');
|
||||
--
|
||||
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.PrintText(p_indent,p_vertical_offset+160,'or complete the enclosed Acceptance Form and return it to the above National Grid Metering''');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+164,'office.');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+148,'To accept the quotation please submit a work request via IX, as outlined in the Rainbow Manual,');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+152,'or complete the enclosed Acceptance Form and return it to the above National Grid Metering''');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+156,'office.');
|
||||
--
|
||||
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.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.PrintText(p_indent,p_vertical_offset+180,'correspondence relating to this request.');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+164,'Please note that this quotation is valid for 90 days from the date specified in the quotation.');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+168,'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+172,'correspondence relating to this request.');
|
||||
--
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+188,'If you have any queries, please contact the team on the number above');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+196,'Yours sincerely');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+176,'If you have any queries, please contact the team on the number above');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+184,'Yours sincerely');
|
||||
--put on daves signature
|
||||
plpdf.PutImage('dhsignature',p_signature_blob,p_indent,230,40,10);
|
||||
plpdf.PutImage('dhsignature',p_signature_blob,p_indent,222,44,11);
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+216,'David Harper');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+220,'I&C Technical Manager');
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+224,'National Grid Metering');
|
||||
@@ -705,7 +739,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+22,'Customer Reference: '|| p_quote_data.transaction_ref);
|
||||
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: '||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+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
|
||||
@@ -729,15 +763,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
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,'<27>'||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,'<27>'||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;
|
||||
--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(p_indent,l_cost_totals_offset,'Lifting Gear if required');
|
||||
plpdf.PrintText(120,l_cost_totals_offset,'<27>220');
|
||||
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,'<27>'||to_char(p_quote_data.total_cost,'FM999999D90')||' excluding lifting gear if required');
|
||||
@@ -779,9 +809,9 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
--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+200,'Liquidated Damages (sum per day)(excluding V.A.T):');
|
||||
plpdf.PrintText(130,p_vertical_offset+200,'<27>'||p_quote_data.liquid_damage_day);
|
||||
plpdf.PrintText(130,p_vertical_offset+200,'<27>'||to_char(p_quote_data.liquid_damage_day,'FM999999D90'));
|
||||
plpdf.PrintText(p_indent,p_vertical_offset+208,'Liquidated Damages (monetary cap)(excluding V.A.T):');
|
||||
plpdf.PrintText(130,p_vertical_offset+208,'<27>'||p_quote_data.liquid_damage_cap);
|
||||
plpdf.PrintText(130,p_vertical_offset+208,'<27>'||to_char(p_quote_data.liquid_damage_cap,'FM999999D90'));
|
||||
|
||||
end build_caveats_page;
|
||||
/*
|
||||
@@ -793,7 +823,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
%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
|
||||
PROCEDURE build_drawings_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number, p_module_blob blob) is
|
||||
begin
|
||||
--Okay here come the pretty pictures, the technical spec for the module, house & base
|
||||
--this will be page 4 for the quotation
|
||||
@@ -805,8 +835,7 @@ 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: '||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.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 --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
|
||||
@@ -867,10 +896,11 @@ 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,'Weight:',1,0,'L',0);
|
||||
plpdf.PrintCell(15,6,p_quote_data.module_dimensions(9),1,1,'R',0);
|
||||
plpdf.PutImage('module',p_module_blob,p_indent,10,52,18);
|
||||
plpdf.SetPrintFont(p_font,null,9); --set to 9pt
|
||||
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(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
|
||||
@@ -892,7 +922,7 @@ 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: '||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');
|
||||
@@ -1014,7 +1044,7 @@ 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: '||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+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
|
||||
@@ -1056,9 +1086,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
%return - l_pdf_id the id of the pdf file we have created
|
||||
*/
|
||||
FUNCTION generate_detailed_quote_pdf(p_quote_data in quote_data) RETURN NUMBER is
|
||||
l_doc_id number; -- the id of the stored pdf
|
||||
l_blob blob;
|
||||
l_logo_blob blob;
|
||||
l_signature_blob blob;
|
||||
l_module_blob blob; --the module drawing
|
||||
l_pdf_id number; -- the id of the quote we generate
|
||||
l_indent number := 31.7;
|
||||
l_vertical_offset number := 30;
|
||||
@@ -1071,6 +1103,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
SELECT blob_content
|
||||
FROM wwv_flow_files
|
||||
WHERE filename = cp_signature;
|
||||
--!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
|
||||
--This will not work need to reference through the
|
||||
--document roles table to get the file name (uri) then
|
||||
--we can search the wwv_flow_files
|
||||
CURSOR c_get_module(cp_module varchar2) IS
|
||||
SELECT blob_content
|
||||
FROM wwv_flow_files
|
||||
WHERE filename = cp_module;
|
||||
begin
|
||||
IF NOT c_get_logo%ISOPEN THEN
|
||||
OPEN c_get_logo('quote_logo.jpg');
|
||||
@@ -1084,6 +1124,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
FETCH c_get_signature
|
||||
INTO l_signature_blob;
|
||||
CLOSE c_get_signature;
|
||||
IF NOT c_get_module%ISOPEN THEN
|
||||
OPEN c_get_module(p_quote_data.module_diagram);
|
||||
END IF;
|
||||
FETCH c_get_module
|
||||
INTO l_module_blob;
|
||||
CLOSE c_get_module;
|
||||
|
||||
-- Initialize PDF
|
||||
plpdf.init;
|
||||
@@ -1091,15 +1137,31 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
build_covering_letter(p_quote_data,l_font,l_indent,l_vertical_offset,l_logo_blob, l_signature_blob);--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_drawings_page(p_quote_data,l_font,l_indent,l_vertical_offset, l_module_blob); --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,l_logo_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, filename, title, mime_type, flow_id, doc_size ,description, blob_content )
|
||||
values (TO_CHAR(SYSDATE,'SSSSS')||'/quote',p_quote_data.quote_ref||'_quote.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)
|
||||
insert into wwv_flow_files( name, title, mime_type, flow_id, doc_size ,description, blob_content )
|
||||
values (TO_CHAR(SYSDATE,'SSSSS')||'/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 id into l_pdf_id;
|
||||
--reference it in the documents table
|
||||
insert into documents( uri, description, id, docu_type )
|
||||
values (TO_CHAR(SYSDATE,'SSSSS')||'/quote_'||p_quote_data.quote_ref||'.pdf',
|
||||
'Automatically Generated Quotation for quote '||p_quote_data.quote_ref,
|
||||
docu_seq.NEXTVAL,
|
||||
'INDO')
|
||||
returning id into l_doc_id;
|
||||
--set up a role for the document
|
||||
insert into document_roles(rt_code, start_date,description,qute_id,id,doro_type,docu_id)
|
||||
values ('GENERATED QUOTATION',
|
||||
sysdate,
|
||||
'Automatically Generated Quotation for quote '||p_quote_data.quote_ref,
|
||||
p_quote_data.quote_ref,
|
||||
doro_seq.NEXTVAL,
|
||||
'QUDO',
|
||||
l_doc_id);
|
||||
|
||||
return l_pdf_id; -- return the id of the newly created blob pdf record
|
||||
end generate_detailed_quote_pdf;
|
||||
|
||||
Reference in New Issue
Block a user