<% 'first determine is the user has been here and is requesting a record update... if request.querystring("process") = "update" then 'execute an UPDATE SQL statement to change the status... SQL = "UPDATE purchase_tbl SET status = '"&request("status")&"' WHERE record_id = "&request("record") call openconn call openCMD(SQL) call closeCMD if request("status") = "done" Then 'now execute some SQL to change the cc number to just the last 4 if status is DONE SQL = "UPDATE purchase_tbl SET cc_number ='..."&request("cc_number")&"' WHERE record_id = "&request("record")&";" call openCMD(SQL) end if call cleanup end if 'SQL to handle the return display SQL = "SELECT [class_datetime_tbl].[class_datetime], [class_tbl].[class_name], " SQL = SQL & "[class_tbl].[class_price], [customer_tbl].[Customer_lname], " SQL = SQL & "[customer_tbl].[customer_fname], [customer_tbl].[customer_phone], " SQL = SQL & "[customer_tbl].[customer_address], [customer_tbl].[customer_address2], " SQL = SQL & "[customer_tbl].[customer_city], [customer_tbl].[customer_state], " SQL = SQL & "[customer_tbl].[customer_zip], " SQL = SQL & "[customer_tbl].[customer_email], [purchase_tbl].[purchase_id], " SQL = SQL & "[purchase_tbl].[purchase_datetime], [purchase_tbl].[cc_number], " SQL = SQL & "[purchase_tbl].[cc_exp], [purchase_tbl].[cc_type], " SQL = SQL & "[purchase_tbl].[record_id], [purchase_tbl].[ssid], [purchase_tbl].[status] " SQL = SQL & "FROM (class_tbl INNER JOIN class_datetime_tbl ON [class_tbl].[class_id] " SQL = SQL & "=[class_datetime_tbl].[class_id]) INNER JOIN (customer_tbl INNER " SQL = SQL & "JOIN purchase_tbl ON [customer_tbl].[customer_id] =[purchase_tbl].[customer_id]) " SQL = SQL & "ON [class_datetime_tbl].[class_datetime_id] " SQL = SQL & "=[purchase_tbl].[class_datetime_id]" if request("rebuild") = "TRUE" then 'user is requesting new sorts, reassign the sessions for sorting session("orderby") = request("orderby") session("where")= request("where") end if 'if request("rebuild") = "TRUE" then SELECT CASE UCASE(session("where")) CASE "PENDING" SQL = SQL & " WHERE [purchase_tbl].[status] = 'pending'" CASE "DONE" SQL = SQL & " WHERE [purchase_tbl].[status] = 'done'" CASE "DELETE" SQL = SQL & " WHERE [purchase_tbl].[status] = 'deleted'" CASE "ALL" 'nothing CASE ELSE 'by default, just show pending SQL = SQL & " WHERE [purchase_tbl].[status] = 'pending'" END SELECT SELECT CASE UCASE(session("orderby")) CASE "LNAME" SQL = SQL & " ORDER BY [customer_tbl].[Customer_lname];" CASE "DATETIME" SQL = SQL & " ORDER BY [purchase_tbl].[purchase_datetime];" CASE ELSE 'nothing END SELECT 'end if 'take action if the user is updating the record... 'if delete, modify the the cc num and change status 'anything else, just change the status to the new status %>

PURCHASE REPORT

<% 'four versions depending on the session state... 'this makes sure that the radio buttons match what is being displayed SELECT CASE UCASE(session("where")) CASE "PENDING"%> Pending Transactions
Done Transacations
Deleted Transactions
All Transactions
<%CASE "DONE"%> Pending Transactions
Done Transacations
Deleted Transactions
All Transactions
<%CASE "DELETE"%> Pending Transactions
Done Transacations
Deleted Transactions
All Transactions
<%CASE "ALL"%> Pending Transactions
Done Transacations
Deleted Transactions
All Transactions
<%CASE ELSE 'by default, just show pending%> Pending Transactions
Done Transacations
Deleted Transactions
All Transactions
<%END SELECT%>
<% SELECT CASE UCASE(session("orderby")) CASE "LNAME"%> Timestamp
Last Name
<%CASE "DATETIME"%> Timestamp
Last Name
<%CASE ELSE%> Timestamp
Last Name
<%END SELECT%>


<% call openConn call openRS(SQL) conf = "q"'any record will not be equal to this var rowcolor= "000000" while not rs.eof if conf = rs("purchase_id") then 'belongs to the same group, spare the personal info if rowcolor = "9CB2FF" then rowcolor = "9CB2FF" else 'say rowcolor = red rowcolor = "FFE89C" end if conf = rs("purchase_id") totalprice = totalprice + ccur(rs("class_price")) 'the following lines are the following classes displayed (4th+ line of the display)... response.write "" 'end of the display of the remaining cart items else 'belongs to new group, give personal info, 1st class info if rowcolor = "9CB2FF" then rowcolor = "FFE89C" else 'say rowcolor = red rowcolor = "9CB2FF" end if conf = rs("purchase_id") 'these are the first two lines of the returned information... response.write "" response.write "" 'total up the prices... totalprice = ccur(rs("class_price")) 'the following lines are the first class displayed (3rd line of the display)... if len(rs("class_name")) > 21 then elipsis = "..." else elipsis = "" end if response.write "" 'end of the display of the first cart item end if 'look at every record and determine if the confirmation # is the same as the last 'record. If it is, then do not bother putting the name, phone, etc, just the 'class information and the ability to change that record status 'alternate colors only if the confirmation number is different rs.movenext wend call cleanup %>
 »"&left(rs("class_name"),21)&"..."&trimseconds(rs("class_datetime"))&""&formatcurrency(rs("class_price"))&""&formatcurrency(totalprice)&"
" 'check the individual radio buttons for each record... SELECT CASE UCASE(rs("status")) CASE "PENDING" response.write " PEND  DONE  DEL   " CASE "DONE" response.write " PEND  DONE  DEL   " CASE "DELETED" response.write " PEND  DONE  DEL   " END SELECT response.write "
"&trimseconds(rs("purchase_datetime"))&""&rs("customer_lname")&", "&rs("customer_fname")&""&rs("customer_phone")&"  "&rs("customer_address")&" / "&rs("customer_address2")&", "&rs("customer_city")&", "&rs("customer_state")&" "&rs("customer_zip")&"
 SSID#: "&rs("ssid")&"CC Exp:"&rs("cc_exp")&"  "&rs("cc_type")&"#:"&rs("cc_number")&"
 »"&left(rs("class_name"),21)&elipsis&""&trimseconds(rs("class_datetime"))&""&formatcurrency(rs("class_price"))&""&formatcurrency(totalprice)&"
" 'check the individual radio buttons for each record... SELECT CASE UCASE(rs("status")) CASE "PENDING" response.write " PEND  DONE  DEL   " CASE "DONE" response.write " PEND  DONE  DEL   " CASE "DELETED" response.write " PEND  DONE  DEL   " END SELECT response.write "