====== pears.GetInvoicePDF ====== 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"."GetInvoicePDF" IS {create function GetInvoicePDF /* Application Maintained Function / Procedure - DO NOT EDIT*/ (in @InvoiceNumber char(20),in @DocumentID char(20)) returns long varchar begin declare @rootpath char(250); declare @AccountCode char(12); declare @InvoiceDate date; if isnull(@InvoiceNumber,'') = '' and isnull(@DocumentID,'') = '' then return null end if; set @RootPath=WPKMaintainGetSwitchValue('PDFINDB','GLOBAL','LITERAL'); if "right"(@rootpath,1) <> '\\' then set @rootpath=string(@rootpath,'\\') end if; case when isnull(@InvoiceNumber,'') <> '' then select AccountCode,DocumentDate into @AccountCode,@InvoiceDate from IQACDocument where OurRef = @InvoiceNumber and DocumentClass = 'Invoice' when isnull(@DocumentID,'') <> '' then select AccountCode,DocumentDate,OurRef into @AccountCode,@InvoiceDate,@InvoiceNumber from IQACDocument where DocumentID = @DocumentID end case ; return(string(@rootpath,@AccountCode,'\\',dateformat(@InvoiceDate,'yyyymmdd'),'\\',@InvoiceNumber,'.pdf')) end }