Added: March/08/2005 at 2:37pm | IP Logged
|
|
|
I need help formatting currency in this script, where and how do I format the result in the last column of the table. Thanks in advance for your help
adoConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBpath
promocode = REQUEST("promocode") ' '************************************************ ' ' If Len(promocode)=0 then response.write "Sorry, there is no revenue for this affiliate" Set Q1 = Server.CreateObject("ADODB.Connection") 'Initialize a DB connection object Q1.Open adoConn 'Open the connection object Set rsQ = Server.CreateObject("ADODB.Recordset") 'Open a recordset object SQLx = "SELECT borrowerName, closingDate, loanAmount, adFee FROM t_revenue WHERE promocode='" & promocode & "'" 'Set the SQL command rsQ.Open SQLx, Q1 Dataflag = NOT rsQ.eof If DataFlag then aDB = rsQ.GetRows 'Read the recordset into an array variable rsQ.close : Set rsQ=Nothing 'Close the recordset Q1.close : Set Q1 = Nothing 'Close the DB ' ' Got the data, now build the table ' TSum = 0 If DataFlag then %>
<%response.write("<p>Total Revenue for: " & request("promocode"))%><br>
<table border="1" cellspacing="0" cellpadding="0"> <tr><td bgcolor="#C0C0C0"><font face="Verdana" size="1" color="#000080"><b>Borrower Name </b></td><td bgcolor="#C0C0C0"><font face="Verdana" size="1" color="#000080"><b>Closing Date </b></td><td bgcolor="#C0C0C0"><font face="Verdana" size="1" color="#000080"><b>Loan Amount </b></td><td bgcolor="#C0C0C0"><font face="Verdana" size="1" color="#000080"><b>Advertising Fee </b></td><td bgcolor="#C0C0C0"><font face="Verdana" size="1" color="#000080"><b>Total Revenue </b></td></tr> <% For I = 0 To UBound(aDB, 2) Tresult = CCur(CDbl(aDB(2, I))*CDbl(aDB(3, I))) TSum = TSum + Tresult %> <tr><td><%=aDB(0, I)%> </td><td><%=aDB(1, I)%> </td><td><%=aDB(2, I)%> </td><td><%=aDB(3, I)%> </td><td><%=Tresult%> </td></tr> <% Next %> <tr><td colspan=5 align=right><%="Note: Decimal is 2 digits, Total Revenue: " & TSum %> </td></tr>
</table> <% Else response.write "Sorry, there is no revenue for this affiliate" End If %></td> </tr></td> </tr> </table>
|