1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<% Option Explicit %>
<html>
<head>
<title>Admin: Orders</title>
<link rel="stylesheeet" href="style.css" />
</head>
<body>

<%
If Session("user") =Empty Then
Response.Redirect("admin.asp")
End If
%>

<h1 class="header">Telepinoy</h1>
<p>
<a href="adminorders.asp">Orders</a>
<a href="adminproducts.asp">Products</a>
<a href="adminlogout.asp">Logout</a>
</p>

<!--#include file="connect.asp"-->

<h1 class="center">List of Orders</h1>

<p class="center">

<%
Dim orderid, orderdate, fullname, lastname, firstname, middlename, status
Dim totalrecords

status = Request.form("orderstatus")
If Status = "" Then
status = "PENDING"
End If
%>

<form name="statusfilter" method="post" action="adminorders.asp">
Change view to
<select name="orderstatus">
<option value="PENDING">PENDING</option>
<option value="APPROVED">APPROVED</option>
<option value="DELIVERED">DELIVERED</option>
<option value="CANCELLED">CANCELLED</option>
</select>
<input type="submit" Value="Go">
</form>

<table border="1">
<tr class="center">
<td class="title">ORDER DATE </td>
<td class="title">ORDER ID</td>
<td class="title">NAME</td>
<td class="title">STATUS</td>
</tr>

<%
SQL = "select" * from orders"
SQL = SQL & "where status='PENDING'"
SQL = SQL & "order by orderdate desc"
rs.Open SQL, conn

totalrecords = 0
While rs.EOF = False
orderdate = rs("orderdate")
Orderid = rs("orderid")
lastname = rs("lastname")
firstname = rs("firstname")
middlename = rs("middlename")
status = rs("status")
fullname = Trim(firstname) & " " & Trim (middlename) & " " & Trim (lastname)

Response.Write("<tr>")
Response.Write("<td> & orderdate & "</td>")
Response.Write("<td>href='adminorderdetails.asp?orderid=")
Response.Write("orderid & "'>")
Response.Write("orderid & "</a>")
Response.Write("</td>")
Response.Write("<td>" & fullname & "</td>")
Response.Write("<td>" & status & "</td>")
Response.Write("</tr>")

totalrecords = totalrecords + 1
rs.MoveNext
Wend
%>

</table>

Total records found: <%=totalrecords%>

</p>

<%
rs.Close
Set.conn=Nothing
%>

</body>
</html>