Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

cfdocument producing blank browser page

Posted on 2010-08-18
5
Medium Priority
?
706 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

670 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