added code to set a watermark on the pdf if the file test_watermark.jpg exists in the application images, if it does not exist then no watermark will be shown
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3293 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -772,11 +772,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
%param p_logo_blob - the logo(image) to display at the top of the page
|
%param p_logo_blob - the logo(image) to display at the top of the page
|
||||||
%param p_signature_blob - the signature(image) to display at the bottom of the page
|
%param p_signature_blob - the signature(image) to display at the bottom of the page
|
||||||
*/
|
*/
|
||||||
PROCEDURE build_covering_letter(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_logo_blob blob,p_signature_blob blob) 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,p_watermark_blob blob) is
|
||||||
l_contracts_text varchar2(500);
|
l_contracts_text varchar2(500);
|
||||||
l_cell_margin number;
|
l_cell_margin number;
|
||||||
begin
|
begin
|
||||||
plpdf.NewPage;
|
plpdf.NewPage;
|
||||||
|
--set watermark if it exists
|
||||||
|
if p_watermark_blob is not null then
|
||||||
|
plpdf.PutImage('test watermark',p_watermark_blob,50,50,200,200);
|
||||||
|
end if;
|
||||||
-- set margins
|
-- set margins
|
||||||
plpdf.SetLeftMargin(31.7);
|
plpdf.SetLeftMargin(31.7);
|
||||||
plpdf.SetRightMargin(31.7);
|
plpdf.SetRightMargin(31.7);
|
||||||
@@ -842,7 +846,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
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+176,'If you have any queries, please contact the team on the number above');
|
||||||
plpdf.PrintText(p_indent,p_vertical_offset+184,'Yours sincerely');
|
plpdf.PrintText(p_indent,p_vertical_offset+184,'Yours sincerely');
|
||||||
--put on daves signature
|
--put on daves signature
|
||||||
plpdf.PutImage('dhsignature',p_signature_blob,p_indent,222,44,11);
|
-- 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+216,'David Harper');
|
||||||
plpdf.PrintText(p_indent,p_vertical_offset+220,'I&C Technical Manager');
|
plpdf.PrintText(p_indent,p_vertical_offset+220,'I&C Technical Manager');
|
||||||
plpdf.PrintText(p_indent,p_vertical_offset+224,'National Grid Metering');
|
plpdf.PrintText(p_indent,p_vertical_offset+224,'National Grid Metering');
|
||||||
@@ -856,7 +860,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
%param p_indent - the left margin measurement.
|
%param p_indent - the left margin measurement.
|
||||||
%param p_vertical_offset - the top margin measurement.
|
%param p_vertical_offset - the top margin measurement.
|
||||||
*/
|
*/
|
||||||
PROCEDURE build_costs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
|
PROCEDURE build_costs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_watermark_blob blob) is
|
||||||
l_cost_line_counter number;
|
l_cost_line_counter number;
|
||||||
l_vertical_offset_for_costs number := p_vertical_offset+110;
|
l_vertical_offset_for_costs number := p_vertical_offset+110;
|
||||||
l_works_counter number;
|
l_works_counter number;
|
||||||
@@ -866,6 +870,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
begin
|
begin
|
||||||
--Page 2
|
--Page 2
|
||||||
plpdf.NewPage;
|
plpdf.NewPage;
|
||||||
|
--set watermark if it exists
|
||||||
|
if p_watermark_blob is not null then
|
||||||
|
plpdf.PutImage('test watermark',p_watermark_blob,50,50,200,200);
|
||||||
|
end if;
|
||||||
-- set margins
|
-- set margins
|
||||||
plpdf.SetLeftMargin(31.7);
|
plpdf.SetLeftMargin(31.7);
|
||||||
plpdf.SetRightMargin(31.7);
|
plpdf.SetRightMargin(31.7);
|
||||||
@@ -886,8 +894,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
exit when l_works_counter is null;
|
exit when l_works_counter is null;
|
||||||
if p_quote_data.quote_works(l_works_counter) is not null then
|
if p_quote_data.quote_works(l_works_counter) is not null then
|
||||||
plpdf.PrintText(p_indent,l_vertical_offset_for_works+(l_works_counter*4), p_quote_data.quote_works(l_works_counter));
|
plpdf.PrintText(p_indent,l_vertical_offset_for_works+(l_works_counter*4), p_quote_data.quote_works(l_works_counter));
|
||||||
l_works_counter := p_quote_data.quote_works.next(l_works_counter);
|
|
||||||
end if;
|
end if;
|
||||||
|
l_works_counter := p_quote_data.quote_works.next(l_works_counter);
|
||||||
end loop;
|
end loop;
|
||||||
-- DESC_WORK caveat here
|
-- DESC_WORK caveat here
|
||||||
if p_quote_data.caveat_desc_works is not null then
|
if p_quote_data.caveat_desc_works is not null then
|
||||||
@@ -929,10 +937,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
%param p_indent - the left margin measurement.
|
%param p_indent - the left margin measurement.
|
||||||
%param p_vertical_offset - the top margin measurement.
|
%param p_vertical_offset - the top margin measurement.
|
||||||
*/
|
*/
|
||||||
PROCEDURE build_caveats_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
|
PROCEDURE build_caveats_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_watermark_blob blob) is
|
||||||
begin
|
begin
|
||||||
--Page 3
|
--Page 3
|
||||||
plpdf.NewPage;
|
plpdf.NewPage;
|
||||||
|
--set watermark if it exists
|
||||||
|
if p_watermark_blob is not null then
|
||||||
|
plpdf.PutImage('test watermark',p_watermark_blob,50,50,200,200);
|
||||||
|
end if;
|
||||||
-- set margins
|
-- set margins
|
||||||
plpdf.SetLeftMargin(31.7);
|
plpdf.SetLeftMargin(31.7);
|
||||||
plpdf.SetRightMargin(31.7);
|
plpdf.SetRightMargin(31.7);
|
||||||
@@ -977,12 +989,16 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
%param p_house_blob - the image of the house
|
%param p_house_blob - the image of the house
|
||||||
%param p_module_blob - the image of the module
|
%param p_module_blob - the image of the module
|
||||||
*/
|
*/
|
||||||
PROCEDURE build_drawings_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number, p_base_blob blob, p_house_blob blob, p_module_blob blob) 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_base_blob blob, p_house_blob blob, p_module_blob blob,p_watermark_blob blob) is
|
||||||
l_img_props img_props;
|
l_img_props img_props;
|
||||||
begin
|
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;
|
||||||
|
--set watermark if it exists
|
||||||
|
if p_watermark_blob is not null then
|
||||||
|
plpdf.PutImage('test watermark',p_watermark_blob,50,50,200,200);
|
||||||
|
end if;
|
||||||
-- set margins
|
-- set margins
|
||||||
plpdf.SetLeftMargin(31.7);
|
plpdf.SetLeftMargin(31.7);
|
||||||
plpdf.SetRightMargin(31.7);
|
plpdf.SetRightMargin(31.7);
|
||||||
@@ -1085,10 +1101,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
%param p_indent - the left margin measurement.
|
%param p_indent - the left margin measurement.
|
||||||
%param p_vertical_offset - the top margin measurement.
|
%param p_vertical_offset - the top margin measurement.
|
||||||
*/
|
*/
|
||||||
PROCEDURE build_module_specs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number) is
|
PROCEDURE build_module_specs_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_watermark_blob blob) is
|
||||||
begin
|
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;
|
||||||
|
--set watermark if it exists
|
||||||
|
if p_watermark_blob is not null then
|
||||||
|
plpdf.PutImage('test watermark',p_watermark_blob,50,50,200,200);
|
||||||
|
end if;
|
||||||
-- set margins
|
-- set margins
|
||||||
plpdf.SetLeftMargin(31.7);
|
plpdf.SetLeftMargin(31.7);
|
||||||
plpdf.SetRightMargin(31.7);
|
plpdf.SetRightMargin(31.7);
|
||||||
@@ -1188,10 +1208,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
%param p_vertical_offset - the top margin measurement.
|
%param p_vertical_offset - the top margin measurement.
|
||||||
%param p_logo_blob - the logo(image) to display at the top of the page
|
%param p_logo_blob - the logo(image) to display at the top of the page
|
||||||
*/
|
*/
|
||||||
PROCEDURE build_acceptance_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_logo_blob blob) is
|
PROCEDURE build_acceptance_page(p_quote_data in quote_data, p_font in varchar2, p_indent in number, p_vertical_offset in number,p_logo_blob blob,p_watermark_blob blob) is
|
||||||
begin
|
begin
|
||||||
---weeeeee last page
|
---weeeeee last page
|
||||||
plpdf.NewPage;
|
plpdf.NewPage;
|
||||||
|
--set watermark if it exists
|
||||||
|
if p_watermark_blob is not null then
|
||||||
|
plpdf.PutImage('test watermark',p_watermark_blob,50,50,200,200);
|
||||||
|
end if;
|
||||||
-- set margins
|
-- set margins
|
||||||
plpdf.SetLeftMargin(31.7);
|
plpdf.SetLeftMargin(31.7);
|
||||||
plpdf.SetRightMargin(31.7);
|
plpdf.SetRightMargin(31.7);
|
||||||
@@ -1269,6 +1293,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
l_enty_code varchar2(80); --the type of enquiry
|
l_enty_code varchar2(80); --the type of enquiry
|
||||||
l_logo_blob blob;
|
l_logo_blob blob;
|
||||||
l_signature_blob blob;
|
l_signature_blob blob;
|
||||||
|
l_watermark_blob blob;
|
||||||
l_success boolean; --holds whether the quote was saved in the docuemnts tables or not
|
l_success boolean; --holds whether the quote was saved in the docuemnts tables or not
|
||||||
l_base_blob blob; --the base drawing
|
l_base_blob blob; --the base drawing
|
||||||
l_house_blob blob; --the house drawing
|
l_house_blob blob; --the house drawing
|
||||||
@@ -1285,6 +1310,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
SELECT blob_content
|
SELECT blob_content
|
||||||
FROM wwv_flow_files
|
FROM wwv_flow_files
|
||||||
WHERE filename = cp_signature;
|
WHERE filename = cp_signature;
|
||||||
|
CURSOR c_get_watermark(cp_watermark varchar2) IS
|
||||||
|
SELECT blob_content
|
||||||
|
FROM wwv_flow_files
|
||||||
|
WHERE filename = cp_watermark;
|
||||||
CURSOR c_get_enty(cp_quid varchar2) IS
|
CURSOR c_get_enty(cp_quid varchar2) IS
|
||||||
SELECT enty_code
|
SELECT enty_code
|
||||||
FROM quote_items
|
FROM quote_items
|
||||||
@@ -1303,6 +1332,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
FETCH c_get_signature
|
FETCH c_get_signature
|
||||||
INTO l_signature_blob;
|
INTO l_signature_blob;
|
||||||
CLOSE c_get_signature;
|
CLOSE c_get_signature;
|
||||||
|
IF NOT c_get_watermark%ISOPEN THEN
|
||||||
|
OPEN c_get_watermark('test_watermark.jpg');
|
||||||
|
END IF;
|
||||||
|
FETCH c_get_watermark
|
||||||
|
INTO l_watermark_blob;
|
||||||
|
CLOSE c_get_watermark;
|
||||||
IF NOT c_get_enty%ISOPEN THEN
|
IF NOT c_get_enty%ISOPEN THEN
|
||||||
OPEN c_get_enty(p_quote_id);
|
OPEN c_get_enty(p_quote_id);
|
||||||
END IF;
|
END IF;
|
||||||
@@ -1317,15 +1352,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
|||||||
-- Initialize PDF
|
-- Initialize PDF
|
||||||
plpdf.init;
|
plpdf.init;
|
||||||
--build the pages for the quote
|
--build the pages for the quote
|
||||||
build_covering_letter(p_quote_data,l_font,l_indent,l_vertical_offset,l_logo_blob, l_signature_blob);--1
|
build_covering_letter(p_quote_data,l_font,l_indent,l_vertical_offset,l_logo_blob, l_signature_blob, l_watermark_blob);--1
|
||||||
build_costs_page(p_quote_data,l_font,l_indent,l_vertical_offset); --2
|
build_costs_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_watermark_blob); --2
|
||||||
build_caveats_page(p_quote_data,l_font,l_indent,l_vertical_offset); --3
|
build_caveats_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_watermark_blob); --3
|
||||||
--OFMAT, Addon jobs don't have module diagrams
|
--OFMAT, Addon jobs don't have module diagrams
|
||||||
if not (l_enty_code = 'OFMAT' or l_enty_code = 'AMR' or l_enty_code = 'EMS') then
|
if not (l_enty_code = 'OFMAT' or l_enty_code = 'AMR' or l_enty_code = 'EMS') then
|
||||||
build_drawings_page(p_quote_data,l_font,l_indent,l_vertical_offset, l_base_blob, l_house_blob, l_module_blob); --4
|
build_drawings_page(p_quote_data,l_font,l_indent,l_vertical_offset, l_base_blob, l_house_blob, l_module_blob,l_watermark_blob); --4
|
||||||
end if;
|
end if;
|
||||||
build_module_specs_page(p_quote_data,l_font,l_indent,l_vertical_offset); --5
|
build_module_specs_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_watermark_blob); --5
|
||||||
build_acceptance_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_logo_blob); --6
|
build_acceptance_page(p_quote_data,l_font,l_indent,l_vertical_offset,l_logo_blob,l_watermark_blob); --6
|
||||||
--get our beautiful pdf into the local var l_blob
|
--get our beautiful pdf into the local var l_blob
|
||||||
plpdf.SendDoc(l_blob);
|
plpdf.SendDoc(l_blob);
|
||||||
--punt the created pdf into the APEX files table
|
--punt the created pdf into the APEX files table
|
||||||
|
|||||||
Reference in New Issue
Block a user