====== pears.EmailBody ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."EmailBody" IS
'create function EmailBody( in "docid" char(20) )
returns long varchar //
// If you have General Setting group of Accounts number 420 ''Allow users to modify invoice email body text'' set to Y then the docid will not be used as a parameter as the function is not called.
begin
declare "rv" long varchar;
declare "invno" char(12);
declare "coname" char(30);
declare "crlf" char(2);
select "ourref" into "invno" from "iqacdocument" where "documentid" = "docid";
select "dbname" into "coname" from "params";
set "crlf" = "char"(13)+"char"(10);
set "rv" = "string"(''Please find Invoice {invno} attached. '',''If relevant, associated timesheets are included as additional pages in the attached invoice pdf.'',"crlf");
set "rv" = "string"("rv","crlf");
set "rv" = "string"("rv",''Regards'',"crlf");
set "rv" = "string"("rv","coname","crlf");
set "rv" = "string"("rv","crlf");
set "rv" = "string"("rv",''If you are not the addressee indicated in this message (or responsible for delivery of the message to such person),'');
set "rv" = "string"("rv",''you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email.'');
return("rv")
end'