I need help in achieving the desired output
I am stuck doing a program in ASP
I have got a table in SQL that with three columns
Amount,
Reference and
Deposit_Date
and has the following records.
Amount Reference Deposit_Date
7.00 declined 2007/06/02
62.00 released 2007/06/02
32.00 Preauth 2007/06/02
56.00 declined 2007/06/04
45.00 released 2007/06/04
13.00 declined 2007/06/05
19.00 PreAuth 2007/06/05
2.00 declined 2007/06/12
6.00 declined 2007/06/13
39.00 released 2007/06/13
4.00 declined 2007/06/14
25.00 released 2007/06/14
I want to be able to display in these records in the ASP the released amount and the declined amount
against each date.
for example
on 2nd June 2007 there is declined amount and released amount.
which should be displayed (OUTPUT) AS
Date Released Declined PreAuth
2007/06/02 62.00 7.00 32.00
2007/06/04 45.00 56.00 0.00
2007/06/05 19.00 0.00 13.00
Expand|Select|Wrap|Line Numbers
- <table>
- <tr>
- <td>
- Deposit Date
- </td>
- <td>
- Released
- </td>
- <td>
- PreAuth
- </td>
- </tr>
- <%
- Dim strReleased
- Dim strDeclined
- Dim strPreAuth
- Dim totRel
- Dim totDec
- Dim totPre
- totRel = 0
- totDec = 0
- totPre = 0
- strReleased = "Released"
- strDeclined = "Declined"
- strPreAuth = "PreAuth"
- While not rs.eof
- %>
- <tr>
- <td><%=rs("deposit_date")%></td>
- <td><%
- If lcase(trim(rs("reference"))) = lcase(trim(strReleased)) Then
- totRel = totRel + rs("Amount")
- Else
- Response.write "0"
- End If
- %></td>
- <td><%
- If lcase(trim(rs("reference"))) = lcase(trim(strDeclined)) Then
- totDec = totDec + rs("Amount")
- Else
- Response.write "0"
- End If
- %></td>
- <td><%
- If lcase(trim(rs("reference"))) = lcase(trim(strPreAuth)) Then
- totPre = totPre + rs("Amount")
- Else
- Response.write "0"
- End If
- %></td>
- </tr>
- <%
- rs.movenext
- wend
- %>
- %>
- </table>