Hi im having trouble with the below piece of code, im trying to set it up to 
add the correct template as a watermark based on the filename in the database 
in field (INVOICE_PDFFile)
can anyone help me out?
at the minute im getting this error message - Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Ambiguous column name 
'InvoiceTemplateType_Key'.


heres my code:
<cfparam name="currentline" default="1">
<cfparam name="previousstring" default="">
<cfset timestamp = timeformat(now(),"HHmmss")>
<cfset pdfname = url.invoice&"_"&timestamp&".pdf">

<cfquery name="qgetinvoice" datasource="#request.dsn#">
select INVOICE_PDFFile
from INVOICE
where INVOICE_Key = #url.invoice#
</cfquery>

<cfpdf action="getinfo"  name="pdfinfo" 
source="#request.maindrivePath#PDFs\#qgetinvoice.INVOICE_PDFFile#">

<cfif pdfinfo.TotalPages gt 1>
        <cfset totalpages = "1-"&pdfinfo.TotalPages>
<cfelse>
        <cfset totalpages = 1>
</cfif>

<cfquery name="qgetcreditnotetemplate" datasource="#request.dsn#">
                                        select InvoiceTemplate_FileName, 
InvoiceTemplateType_Key, Invoive_Key
                                        from InvoiceTemplate IT, INVOICE I
                                        where IINVOICE_Key = #url.invoice#
                                        AND InvoiceTemplateType_Key = 1
                                        </cfquery>


<cfpdf
    action = "addwatermark"
    source = "#request.maindrivePath#PDF\#qgetinvoice.INVOICE_PDFFile#"
    image = "#request.maindrivePath#PDF\#qgetcreditnotetemplate#"
    foreground = "No"
    overwrite = "yes"
    pages = "#totalpages#"
        opacity = "10"
        Position = "10, -50"
     showonprint = "YES"
    destination = "#request.maindrivePath#temppdf\#pdfname#">


<cflocation url="temppdf/#pdfname#"> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326480
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to