Here is a coldfusion page I have created to keep track of my mileage. The code is below. You can also download the page and an access database. You will have to change the datasourcename (line 1) to your datasource name and you will have to change the purchase date on line 88 from 01/01/2000 to your purchase date. All I ask is if you use this just put a link back to my site. You can see this code in action at my TSX Avg MPG page
<!--- CODE BEGINS HERE --->
<cfquery name="Qmileage" datasource="mileagedatasource">
SELECT Totalprice, Totalgallons, Pricepergallon, Milesoncar, Date
FROM mileagedata
ORDER BY Date ASC</cfquery>
<cfset milesoncarpreviousrow = 0>
<cfset totalgallonsalldates = 0>
<cfset totalmoneyspent = 0>
<cfset totalpricepergallon = 0>
<cfset totalmilespergallon = 0>
<cfset totalcostpermile = 0>
<cfset totalmilesoncar = 0>
<cfset checkcolor = "white">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MILEAGE DEMO PAGE</title>
<style type="text/css">
<!--
.mileagetableheader {
font-family: "Times New Roman", Times, serif;
font-size: 10pt;
font-weight: bold;
text-align: center;
}
.textmileagechat {
font-family: "Times New Roman", Times, serif;
font-size: 10pt;
}
-->
</style>
</head>
<body>
<table width = "720" border = 1 align = "center" cellpadding="0" cellspacing="0">
<tr>
<td colspan = "8" class="textmileagechat" >Header goes here</td>
</tr>
<tr>
<td class="mileagetableheader"> Date </td>
<td class="mileagetableheader">Miles on car</td>
<td class="mileagetableheader">Miles Traveled<br>this tank</td>
<td class="mileagetableheader">Price per gallon</td>
<td class="mileagetableheader">Total gallons</td>
<td class="mileagetableheader">Average Miles per Gallon</td>
<td class="mileagetableheader">Total price</td>
<td class="mileagetableheader">Cost per Mile</td>
</tr>
<cfloop query="Qmileage">
<cfif checkcolor eq "lightblue"><cfset color ="white">
<cfelse>
<cfset color = "lightblue">
</cfif>
<cfoutput>
<tr bgcolor="#color#">
<td class="textmileagechat">#LSDateFormat(Qmileage.Date,'MM-DD-YY')#</td>
<td align="right" class="textmileagechat">#LSNumberFormat(Qmileage.Milesoncar)#</td>
<td align="right" class="textmileagechat"><cfset milestraveledthistank =Qmileage.Milesoncar-milesoncarpreviousrow>#milestraveledthistank#</td>
<td align="right" class="textmileagechat">$#LSNumberFormat(Qmileage.Pricepergallon,',99999999999999.999')#</td>
<td align="right" class="textmileagechat">#LSNumberFormat(Qmileage.Totalgallons,',99999999999999.999')#</td>
<td align="right" class="textmileagechat"><cfset avgmpg = milestraveledthistank/Qmileage.Totalgallons>#LSNumberFormat(avgmpg,',99999999999999.99')#</td>
<td align="right" class="textmileagechat">#DollarFormat(Qmileage.Totalprice)#</td>
<td align="right" class="textmileagechat"><cfset costpermile = Qmileage.Totalprice/milestraveledthistank>#LSNumberFormat(costpermile,',99999999999999.999')#¢</td>
</tr>
</cfoutput>
<cfset milesoncarpreviousrow = Qmileage.Milesoncar>
<cfset checkcolor = #color#>
<cfset totalgallonsalldates = totalgallonsalldates + Qmileage.Totalgallons>
<cfset totalmoneyspent = totalmoneyspent + Qmileage.Totalprice>
<cfset totalpricepergallon = totalpricepergallon + Qmileage.Pricepergallon>
<cfset totalmilesoncar = totalmilesoncar + milestraveledthistank>
<cfset lastpurchasedate = #LSDateFormat(Qmileage.Date,'MM/DD/YYYY')#>
</cfloop>
<tr>
<td colspan="5" align="center">
<cfset milesoncarpreviousrow = 0>
<cfchart format="flash" show3d="yes" xaxistitle="Purchase Date" yaxistitle="Avg MPG" chartwidth="400">
<cfchartseries type="scatter" query="Qmileage" paintstyle="shade" markerstyle="circle" >
<cfloop query="Qmileage">
<cfset milespertank = Qmileage.Milesoncar-milesoncarpreviousrow>
<cfset milespergallon = milespertank/Qmileage.Totalgallons>
<cfchartdata item="#LSDateFormat(Qmileage.Date,'MM-DD-YY')#" value="#LSNumberFormat(milespergallon,',99999999999999.99')#">
<cfset milesoncarpreviousrow = Qmileage.Milesoncar>
</cfloop>
</cfchartseries>
</cfchart>
<cfset daysfromlastpurchase = #DateDiff("d", "01/01/2000", "#lastpurchasedate#")#>
<cfset avgpricepergallon = totalmoneyspent/totalgallonsalldates>
<cfset avgmpg = totalmilesoncar/totalgallonsalldates>
<cfset avgcpm = totalmoneyspent/totalmilesoncar>
<cfset avgmilesperday = totalmilesoncar/daysfromlastpurchase>
<cfset avggascostperday = totalmoneyspent/daysfromlastpurchase>
</td>
<td colspan="3" valign="top">
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td class="mileagetableheader" align="left"><p>Days owned through last gas purchase </p></td>
<td class="textmileagechat" align="right"><cfoutput>#daysfromlastpurchase#</cfoutput></td>
</tr>
<tr>
<td class="mileagetableheader" align="left">Total gallons purchased </td>
<td class="textmileagechat" align="right"><cfoutput>#totalgallonsalldates#</cfoutput></td>
</tr>
<tr>
<td class="mileagetableheader" align="left">Total purchased </td>
<td class="textmileagechat" align="right"><cfoutput>#DollarFormat(totalmoneyspent)#</cfoutput></td>
</tr>
<tr>
<td class="mileagetableheader" align="left">Avg price per gallon </td>
<td class="textmileagechat" align="right"><cfoutput>#DollarFormat(avgpricepergallon)#</cfoutput></td>
</tr>
<tr>
<td class="mileagetableheader" align="left">Avg MPG </td>
<td class="textmileagechat" align="right"><cfoutput>#LSNumberFormat(avgmpg,',99999999999999.999')#</cfoutput></td>
</tr>
<tr>
<td class="mileagetableheader" align="left">Avg cost per mile </td>
<td class="textmileagechat" align="right"><cfoutput>#LSNumberFormat(avgcpm,',99999999999999.999')#¢</cfoutput></td>
</tr>
<tr>
<td class="mileagetableheader" align="left">Avg miles per day </td>
<td class="textmileagechat" align="right"><cfoutput>#LSNumberFormat(avgmilesperday,',99999999999999.99')#</cfoutput></td>
</tr>
<tr>
<td class="mileagetableheader" align="left">Avg gas cost per day </td>
<td class="textmileagechat" align="right"><cfoutput>#DollarFormat(avggascostperday)#</cfoutput></td>
</tr>
<td colspan="2" align="left" class="mileagetableheader">This was created by <a href="http://www.damonledet.com">Damon Ledet</a>. Want your own? Go here.</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!--- CODE ENDS HERE --->