-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadmin-report-view.php
More file actions
109 lines (78 loc) · 2.68 KB
/
Copy pathadmin-report-view.php
File metadata and controls
109 lines (78 loc) · 2.68 KB
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
101
102
103
104
105
106
107
108
109
<?php include('includes/connection.php') ?>
<?php include('includes/session.php') ?>
<?php
//Unauthorized Access Check
checkSession();
if(!isset($_SESSION['usertype']) || $_SESSION['usertype'] != 'a'){
$message = base64_encode(urlencode("Please Login"));
header('Location:login.php?msg=' . $message);
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>All Orders</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<?php include('includes/header.php') ?>
<hr>
<div class="row-100 bg-grey">
<h1 class="div-c">All Orders</h1>
</div>
<div class="row-100">
<h3 class="error-msg"><?php include_once('includes/message.php'); ?></h3>
<div class="row-100">
<?php
$finalUnits = 0;
$finalTotal = 0;
$retrieve = "SELECT * FROM orders;";
//Selecting all data from Table
$result = mysqli_query($connection,$retrieve);//Passing SQL
echo "<table class=\"user\">
<tr>
<th>Order ID</th>
<th>Customer ID</th>
<th>Vendor ID</th>
<th>Product ID</th>
<th>Product Name</th>
<th>Unit Price</th>
<th>Units</th>
<th>Total</th>
</tr>
";
while($row = mysqli_fetch_assoc($result)){
$finalUnits = $finalUnits + $row['units'];
$finalTotal = $finalTotal + $row['total'];
echo "
<tr>
<td>".$row['orderID']."</td>
<td>".$row['customerID']."</td>
<td>".$row['vendorID']."</td>
<td>".$row['productID']."</td>
<td>".$row['productName']."</td>
<td>".$row['unitPrice']."</td>
<td>".$row['units']."</td>
<td>".$row['total']."</td>
</tr>
";
}
echo "</table>";
echo "<br>";
echo "<table class=\"user\">
<tr>
<th>Total Units Ordered</th>
<td>$finalUnits</td>
</tr>
<tr>
<th>Total Price of Orders</th>
<td>Rs. $finalTotal/=</td>
</tr>
</table>
";
?>
</div>
</div>
</body>
</html>