Solved

cfdocument producing blank browser page

Posted on 2010-08-18
5
667 Views
Last Modified: 2013-12-24
I use cfdocument to produce pdf files that contain purchase order information.  I have successfully used cfdocument on other pages of my site.  This particular page will render all correct information to the browser until I add the cfdocument tags.  At this point I get a blank browser screen.  The pdf reader does not even open. I am confused!
<cfsetting requestTimeOut = "120" >


<cfoutput>
<cfdocument name="Create" format="pdf" backgroundvisible="yes" scale="65">
<cfdump var="#session#">
            <cfset Cost = 0>
			<cfset Occurrences = 0>
            <cfset Total = 0>
            <cfset Price = 0>

<cfloop list="session.transid" index="x">
     <cfquery name="qryUpdateEmbr" datasource="#application.dsn#">
        update tblTransaction
        Set EmbroideryPOCreated = #Now()#
        where transactionid in (#session.transid#)
    </cfquery> 

</cfloop>

  <cfquery name="qryFanshop" datasource="#application.dsn#">
    	Select distinct fanshop
        from tblTransaction
        where transactionid in (#session.transid#)
    </cfquery>
    
<cfset fanshoplist = ''>
    
<cfloop query="qryfanshop">
	<cfif fanshoplist EQ ''>
    	<cfset fanshoplist = #fanshop#>
    <cfelse>
    	<cfset fanshoplist = #fanshoplist# & ',' & #fanshop#>
    </cfif>	    
</cfloop> 
   


<!--- Loop over the transid list--->

<cfloop list="#fanshoplist#" index="j">  <!--- Begin the transid loop ---> 
      


	<cfquery name="qryTransactions" datasource="#application.dsn#">
    	Select distinct a.logo, b.productStyleNumber, a.color, a.fanshop
        from tblTransaction a
        left outer join skorsports.dbo.ppiproducts b
        on a.productid = b.productid
        where fanshop = '#j#'
        and a.transactionid in (#session.transid#)
    </cfquery>
    <cfquery name="qryVendor" datasource="#application.dsn#">
    	Select *
        from tblVendor
        where vendorid = #session.vendor#
    </cfquery>
    
              <!--- Find Valid PO Number--->	
                <cfquery name="qryPONUM" datasource="#application.dsn#">
                    select PONum
                    from tblPurchaseOrder
                    Order by PONum DESC
                </cfquery>
                
                <cfset PONUM = #qryPONUM.PONUM# + 1>
        
	<!--- BEGIN:  First Create the pdf file to attach to the email message --->

    



<body>

        <table border="0" cellspacing="0" align="center">
        	<tr>
                
                <td colspan="3">
                    <img src="../images/SKOR_FAN_SHOP_LOGO.jpg" height="150px" width="200px" />
                </td>
                <td colspan="4">
                    <font size="+2">SkorFanShop Purchase Order #PONUM#</font>
                </td>
             </tr> 
             <tr height="75px">
            	<td colspan="9">
             		<hr />
                </td>
           	</tr> 
            <tr>
            	<td colspan="3" style="border-style:solid;">
                	<table border="0">
                    	
                         <tr>
                        	<td colspan="3"><b>Skor Sports</b></td>
                        </tr>
                         <tr>
                        	<td colspan="3">952 Big Tree Rd</td>
                        </tr>
                        <tr>
                        	<td>South Daytona</td>
                            <td>FL</td>
                            <td>32119</td>
                        </tr>
                        <tr>
                        	<td colspan="3">&nbsp;</td>
                        </tr>
                        <tr>
                        	<td colspan="1">Phone:</td>
                            <td colspan="2">(386) 258-1900</td>
                        </tr>
                         <tr>
                        	<td colspan="1">Fax:</td>
                            <td colspan="2">(386) 255-2980</td>
                        </tr>
                    	<tr height="50px" valign="bottom">
                        	
                        </tr>
                         <tr>
                        	<td colspan="3"><hr /></td>
                        </tr>
                        <tr>
                        	<td colspan="3">#qryVendor.VendorName#</td>
                        </tr>
                         <tr>
                        	<td colspan="3">#qryVendor.ContactName#</td>
                        </tr>
                         
                        <tr>
                        	<td colspan="3">#qryVendor.Address#</td>
                        </tr>
                        <tr>
                        	<td>#qryVendor.City#,</td>
                            <td>#qryVendor.State#</td>
                            <td>#qryVendor.zip#</td>
                        </tr>
                        <tr>
                        	<td colspan="1">Phone:</td>
                            <td colspan="2">#qryVendor.telephone#</td>
                        </tr>
                         <tr>
                        	<td colspan="3">&nbsp;</td>
                        </tr>
                         <tr>
                        	<td colspan="1">Fax:</td>
                            <td colspan="2">#qryVendor.fax#</td>
                        </tr>
                        <tr>
                        	<td colspan="1">Email:</td>
                            <td colspan="2">#qryVendor.emailAddress#</td>
                        </tr>
                    </table> 
                </td>
               
                <td align="center" colspan="2" valign="top">
                	<table>
                    	<tr height="75px">
            				<td colspan="9">&nbsp;
                				
                			</td>
           				 </tr>    
                        <tr>
                        	<td colspan="3">Ship To:</td>
                        </tr>
                         <tr>
                        	<td colspan="3"><hr /></td>
                        </tr>
                         <tr>
                        	<td colspan="3">Skor Sports</td>
                        </tr>
                        <tr>
                        	<td colspan="3">952 Big Tree Rd</td>
                        </tr>
                        <tr>
                        	<td>South Daytona</td>
                            <td>FL</td>
                            <td>12345</td>
                        </tr>
                        <tr>
                        	<td colspan="3">
                            	<hr />
                            </td>
                        </tr>  
                        <tr>
                        	<td colspan="3">
                            	<b>Please Ship Using:</b>
                            </td>
                        </tr>  
                        <tr>
                        	<td colspan="3">
                            UPS Account Number
                            </td>
                        </tr> 
                        <tr>
                        	<td colspan="3" align="center">
                            <b>A40T11</b>
                            </td>
                        </tr>   
                    </table> 
                </td>
            </tr>
            <tr><td colspan="9">&nbsp;</td></tr>
            <tr><td colspan="9">&nbsp;</td></tr>
            <tr bgcolor="##CCCCCC"><td colspan="2" align="left"><b>Product List:</b></td><td><b>Vendor:</b></td>
                        	<td colspan="1"><b>#qryVendor.VendorName#</b></td><td colspan="2"><b>Account Number:</b></td>
                        	<td colspan="2"><b>#qryVendor.AccountNumber#</b></td></tr> 
           <tr><td colspan="9">&nbsp;</td></tr>
           <tr><td colspan="9">&nbsp;</td></tr>
            <tr bgcolor="##CCCCCC">
            	<!---<td width="150px" align="center">Vendor Name</td>--->
                <td width="100px" align="center">Logo</td>
                <td width="100px" align="center">Product Style Number</td>
                <td width="200px" align="center">Color</td>
                <td width="150px" align="center">Quantity</td>
                <td width="150px" align="center">Cost</td>
                <td width="150px" align="center">Per Item Total</td>
                <td width="250px" align="center">Running Total</td>
            </tr>
            <tr><td colspan="9"><hr /></td></tr> 
             <tr><td colspan="9">&nbsp;</td></tr>
             
             

            
            
            <cfloop query="qryTransactions">
            
             
				
                 
                 <cfquery name="qryColors" datasource="#application.dsn#">
                 	select distinct color, COUNT(color) AS ColorNumOccurrences,b.productStyleNumber, Sum(quantity) AS numProducts, b.productcost, a.transactionid
                    from tblTransaction a
                    left outer join skorsports.dbo.ppiProducts b
                    on a.productid = b.productid
                    left outer join tblVendor c
                    on b.vendorid = c.vendorid
                    where b.productStyleNumber = '#productStyleNumber#'
                    and color = '#color#'
                    GROUP BY a.productid, a.color,b.productStyleNumber, b.productcost, a.transactionid
                 </cfquery>
                 
                <!--- Insert details into tblPODetails--->
               	<cfquery name="qryDetail" datasource="#application.dsn#">
                	insert into tblPODetail(transactionID, PONUM)
                    values('#qryColors.transactionid#', #PONUM#)
                </cfquery>   
               
               	<!---<cfloop query="qryColors">--->
                
                
                
                	<cfif #qryColors.numProducts# NEQ ''>
                    	 <cfset Occurrences = #qryColors.numProducts#>   
                    </cfif>
                    
                	
                    	
                    
                      
                    <cfif #session.POType# EQ 1>
                    	<cfset Cost =  4.00>       
                    <cfelse>
                    	<cfset Cost =  #productCost#>   
                    </cfif> 
                       
               		<cfset Price = #Cost# * #Occurrences#>
                 	<cfset Total = #Total# + #Price#>
                    
              <!--- Get the correct Vendor Color --->      
                	<cfset colorlist = listtoarray(color,"[]")>
                    <cfset VendorColor = #colorlist[1]#>
                    <cfset VendorColor = #REPLACE(VendorColor,'_',' ','All')#>
                    
                	<tr height="50px" <CFIF (CurrentRow MOD 2) IS 0> bgcolor="##82CAFF"<cfelse>bgcolor="##AFC7C7"</cfif>>
                    	<!---<td align="center">#qryTransactions.VendorName#</td>--->
                        <td align="center" ><img src="http://www.#fanshop#.skorfanshop.com/images/Logo/#logo#" height="75px" width="75px"/></td>
                        <td align="center">#qryTransactions.productStyleNumber#</td>
                        <td align="center">#color#</td>
                        <td align="center">#qryColors.numProducts#</td>
                        <td align="center">#LSCurrencyFormat(Cost,"local")#</td>
                        <td align="center">#LSCurrencyFormat(Price, "local")#</td>
                        <td align="center">#LSCurrencyFormat(Total, "local")#</td>
                    </tr>
                    
                     
             
              
            </cfloop>
             <tr><td colspan="9">&nbsp;</td></tr>
            <tr><td colspan="9"><hr style="border:none;" /></td></tr>
            <tr><td colspan="9" align="right" bgcolor="##CCCCCC"><font size="+3"><b>Total: #LSCurrencyFormat(Total, "local")#</b></font></td></tr>
        </table>
       
</body>        


        <!--- BEGIN:  Now that we have the pdf, mail it to the right person --->
<!---<cfdocumentitem type="pagebreak"/> --->			
        </cfloop><!--- End the transid loop --->  
</cfdocument>         

</cfoutput>

Open in new window

0
Comment
Question by:clayo
  • 3
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 33464306
>> <cfdocument name="Create"

It's because you're using the "name" attribute.  That will send the output to a variable named "create" instead of displaying the pdf in the browser.  Remove that attribute and the pdf will display in the browser as you expect.
0
 

Author Comment

by:clayo
ID: 33464335
Wow that is kind of embarassing...  But very greatful for your post
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33464430
No need to be embarrassed.  How do you think I knew that was the problem so fast ... ;-)
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33467462
... I've um.... done the same thing myself ;-)
0
 

Author Comment

by:clayo
ID: 33468485
thanks for your help
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question