Help! This keeps failing after the first 25 records are displayed and it
shows all records in the database 25 at a time not just the ones queried
originally by say company_name. Anyone know why?
<cfset todayDate = Now()>
<!--- query the EmployeeDirectory table. Cache the result set for 15
minutes. --->
<CFPARAM NAME="StartRow" DEFAULT="1">
<CFPARAM NAME="DisplayRows" DEFAULT="25">
<cfquery name="getCompanyData"
datasource="LOADDATA">
SELECT
company_name,
container_no,
billdate,LOADDATA.ID,
SUM(("IN" - out) * rate) AS total_rate,
SUM("IN" - out) AS OnHand
FROM
rate_calc
<cfif IsDefined("DUE")>WHERE BILLDATE > '#DateFormat(todayDate,
"mm/dd/yy")#'
<cfelseif isdefined("PASTDUE")>WHERE BILLDATE < '#DateFormat(todayDate,
"mm/dd/yy")#'
<cfelseif isdefined("TODAY")>WHERE BILLDATE = '#DateFormat(todayDate,
"mm/dd/yy")#'
<cfelseif isdefined("FORM.COMPANY_NAME")>WHERE COMPANY_NAME =
'#company_name#'
<cfelseif isdefined("FORM.CONTAINER_NO")>WHERE CONTAINER_NO =
'#container_no#'
</cfif>
GROUP BY
company_name,
container_no,
billdate, LOADDATA.ID
ORDER BY company_name, CONTAINER_NO, BILLDATE
</cfquery>
<cfinclude template="header.cfm">
<!--- Set a variable to hold the record number of the last
record to output on the current page. --->
<CFSET ToRow = StartRow + (DisplayRows - 1)>
<CFIF ToRow GT getCompanyData.RecordCount>
<CFSET ToRow = getCompanyData.RecordCount>
</CFIF>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
INPUT, TEXTAREA, SELECT {font-family: Tahoma; font-size: x-small;}
.cfmmaker {font-family: Tahoma; font-size: x-small;}
.ewTableOrderIndicator {font-family: Webdings;}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<CFOUTPUT>
<H4>Displaying records #StartRow# - #ToRow# from the
#getCompanyData.RecordCount# total records in your query.</H4>
</CFOUTPUT>
<table width="500" border="0" class="cfmmaker">
<tr bgcolor="##CCCCCC">
<td>Company Name</td>
<td>Container Number</td>
<td>Total Billable</td>
<td>Bill Date</td>
<td>On Hand</td>
</tr>
<CFOUTPUT query="GETCOMPANYDATA" STARTROW="#url.StartRow#"
MAXROWS="#DisplayRows#">
<tr BGCOLOR="###IIF(GETCOMPANYDATA.currentrow MOD 2, DE('E6E6E6'),
DE('C0C0C0'))#">
<td>#COMPANY_NAME#</td>
<td><a href="loaddataContainerView.cfm?ID=#ID#">#CONTAINER_NO#</td>
<td>#DollarFormat(total_rate)#</td>
<td>#Billdate#</td>
<td>#OnHand#</td>
</tr>
</CFOUTPUT>
</table>
<!--- update the values for the next and previous rows to be returned
--->
<CFSET Next = StartRow + DisplayRows>
<CFSET Previous = StartRow - DisplayRows>
<!--- Create a previous records link if the records being displayed aren't
the
first set --->
<CFOUTPUT>
<CFIF Previous GTE 1>
<A HREF="loaddataSummaryResults.cfm?StartRow=#Previous#"><B>Previous
#DisplayRows#
Records</B></A>
<CFELSE>
Previous Records
</CFIF>
<B>|</B>
<!--- Create a next records link if there are more records in the record set
that haven't yet been displayed. --->
<CFIF Next LTE GETCOMPANYDATA.RecordCount>
<A HREF="loaddataSummaryResults.cfm?StartRow=#Next#"><B>Next
<CFIF (GETCOMPANYDATA.RecordCount - Next) LT DisplayRows>
#Evaluate((GETCOMPANYDATA.RecordCount - Next)+1)#
<CFELSE>
#DisplayRows#
</CFIF> Records</B></A>
<CFELSE>
Next Records
</CFIF>
</CFOUTPUT> <a href="javascript: history.go(-1)">Back</a> </body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207241
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54