-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths_pending_orders.php
More file actions
243 lines (177 loc) · 8.33 KB
/
Copy paths_pending_orders.php
File metadata and controls
243 lines (177 loc) · 8.33 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
session_start();
if( !isset( $_SESSION['email']) ){
echo "You are not authorized to view this page. Go back <a href= '/'>home</a>";
exit();
}
require 's_header.php'
?>
<?php
require 's_db_key.php';
$email=$_SESSION['email'] ;
$sql = "SELECT * FROM seller where email='$email'";
$conn = connect_db();
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$sid = $row["sid"];
$sql="SELECT * FROM seller where email='$email'";
$conn = connect_db();
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$name = $row["name"];
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="HOMEPAGE.css">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css' >
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css' />
<style >
table {
border-collapse: collapse;
width: 100%;
color: #588c7e;
font-family: monospace;
font-size: 15px;
text-align: center;
}
th {
background-color: #588c7e;
color: white;
}
tr:nth-child(odd) {background-color: #f2f2f2}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar">
<div class="container-fluid">
<div class="navbar-header">
<li><a class="btn btn-outline-info" href="HOMEPAGE.php"><i class="fas fa-store" style="color:black;"> <h4>APNA BAZAAR</h4></i></a></li>
</div>
<ul class="nav navbar-nav">
<li ><a href="s_account.php" class="btn-inline-info"><i class="fas fa-home" style="color:black;"><h4>HOME</h4></i></a></li>
<li ><a href="p_register.php" class="btn-inline-info"><i class="fas fa-shopping-cart" style="color:black;"><h4>Register New Products</h4></i></a></li>
<li ><a href="disp_products.php" class="btn-inline-info"><i class="fas fa-check" style="color:black;"><h4>MY PRODUCTS</h4></i></a></li>
<li ><a href="s_pending_orders.php" class="btn-inline-info"><i class="fas fa-check" style="color:black;"><h4>PENDING PRODUCTS</h4></i></a></li>
<li ><a href="profit.php" class="btn-inline-info"><i class="fas fa-chart-bar" style="color:black;"><h4>Profit</h4></i></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li ><a href="sign_in_as.php" class="btn-inline-info"><i class="fa fa-sign-out" style="color:black;"><h4>LOGOUT</h4></i></a></li>
<li><a><i class="fas fa-user"style="color:black;"><h4><?php echo $name ?></h4></i></a></li>
</ul>
</div>
</nav>
<hr><center><h1><b>PENDING ORDERS</b></h1></center><hr>
</body>
</html>
<?php
//require 's_db_key.php';
$conn = connect_db();
//session_start();
$email=$_SESSION['email'];
$sql = "SELECT * FROM seller where email='$email'";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$sid = $row["sid"];
$sql = "SELECT * FROM cart where sid='$sid' and (stat='1' or stat='2')";
$result = $conn->query($sql);
if($result)
{
$sql = $result->fetch_assoc();
if($sql)
{
$p_id=$sql['pid'];
$u_id=$sql['uid'];
}
}
if($sql)
{
$sl = "SELECT * FROM products where pid='$p_id'";
$res = $conn->query($sl);
$sl = $res->fetch_assoc();
$s= "SELECT * from buyer where uid='$u_id'";
$r = $conn->query($s);
$s = $r->fetch_assoc();
echo "<table>";
echo "<tr>";
echo "<th>       </th>";
//echo "<th>    PRODUCT ID    </th>";
echo "<th><center>        PRODUCT NAME    </center></th>";
//echo "<th>    CATEGORY    </th>";
echo "<th><center>    BUYER NAME    </center></th>";
echo "<th><center>    BUYER ADDRESS<center></th>";
echo "<th>    QUANTITY</th>";
echo "<th>    PRICE</th>";
echo "<th>    TOTAL</th>";
echo "<th>    DATE</th>";
echo "<th>    CHANGE STATUS    </th>";
echo "</tr>";
echo "<tr>";
echo "<td>  " . "<img src='".$sl['image']."'alt='IMAGE' width=100 height=100>" . "</td>";
// echo "<td>   " . $sql['pid'] . "</td>";
echo "<td>   " . $sl['p_name'] . "</td>";
//echo "<td>   " . $sl['category'] . "</td>";
echo "<td>   " . $s['name'] . "</td>";
echo "<td>   " . $s['address'] . "</td>";
echo "<td>   " . $sql['qty'] . "</td>";
echo "<td>   " . $sl['price'] . "</td>";
$total=($sl['price'])*($sql['qty']);
echo "<td>   " . $total . "</td>";
echo "<td>   " . $sql['orderdate'] . "</td>";
$str1=strval($sql['uid']);
$str2=strval($sql['pid']);
$str3=$str1.".".$str2;
if($sql['stat']==1)
{
echo "<td><form action='cart_backend.php' method='POST'><button class = 'btn btn-outline-info' type = 'submit' value='".$str3."' name= 'Dispatch' >" . 'Dispatch' . "</button></form></td>";
}
else if($sql['stat']==2)
{
echo "<td><form action='cart_backend.php' method='POST'><button class = 'btn btn-outline-info' type = 'submit' value='".$str3."' name= 'Completed' >" . 'Delivered' . "</button></form></td>";
}
echo "</tr>";
while($sql = $result->fetch_assoc()){
$p_id=$sql['pid'];
$u_id=$sql['uid'];
$sl = "SELECT * FROM products where pid='$p_id'";
$res = $conn->query($sl);
$sl = $res->fetch_assoc();
$s= "SELECT * from buyer where uid='$u_id'";
$r = $conn->query($s);
$s = $r->fetch_assoc();
echo "<tr>";
echo "<td>  " . "<img src='".$sl['image']."'alt='IMAGE' width=100 height=100>" . "</td>";
//echo "<td>   " . $sql['pid'] . "</td>";
echo "<td>   " . $sl['p_name'] . "</td>";
//echo "<td>   " . $sl['category'] . "</td>";
echo "<td>   " . $s['name'] . "</td>";
echo "<td>   " . $s['address'] . "</td>";
echo "<td>   " . $sql['qty'] . "</td>";
echo "<td>   " . $sl['price'] . "</td>";
$total=($sl['price'])*($sql['qty']);
echo "<td>   " . $total . "</td>";
echo "<td>   " . $sql['orderdate'] . "</td>";
$str1=strval($sql['uid']);
$str2=strval($sql['pid']);
$str3=$str1.".".$str2;
if($sql['stat']==1)
{
echo "<td><form action='cart_backend.php' method='POST'><button class = 'btn btn-outline-info' type = 'submit' value='".$str3."' name= 'Dispatch' >" . 'Dispatch' . "</button></form></td>";
}
else if($sql['stat']==2)
{
echo "<td><form action='cart_backend.php' method='POST'><button class = 'btn btn-outline-info' type = 'submit' value='".$str3."' name= 'Completed' >" . 'Delivered' . "</button></form></td>";
}
echo "</tr>";
}
echo "</table>";
}
else{
echo "<h3>You Have No Pending Orders!!</h3>";
}
?>