-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapprove_order.php
105 lines (79 loc) · 2.75 KB
/
approve_order.php
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
<?php
include_once 'controller/product.php';
session_start();
$_Product = new Product();
if(!$_SESSION['email'])
{
header("Location: login.php");//redirect to login page to secure the welcome page without login access.
}
if(isset($_POST['approve']))
{
$order_id = $_POST['order_no'];
$g_amount = $_POST['g_amount'];
$c_amount = $_POST['c_amount'];
$product_id = $_POST['p_id'];
$Result = $_Product->approveOrder($order_id, $product_id,$g_amount,$c_amount);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Order Approval</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<header>
<?php include_once 'template/header.php'; ?>
</header>
<div class="panel panel-body">
<table class="table table-bordered table-striped" style="border: 1px solid;border-color: rgba(7,71,166,0.62)">
<?php
$Result = $_Product->getAllOrder();
//if DAO access is successful to load all the users then show them one by one
if(isset($Result)){
?>
<tr style="background-color: rgba(7,71,166,0.62)">
<th>Order No</th>
<th>Product Id</th>
<th>Product Name</th>
<th>Ordered Date</th>
<th>Order Status</th>
<th>Ordered Amount</th>
<th>Amount Available</th>
<th>Grant Amount</th>
<th>Ordered Grant Date</th>
<th>Approve</th>
</tr>
<?php
while($row=mysqli_fetch_array($Result,MYSQLI_ASSOC)){
?>
<form method="post" action="">
<tr>
<td><input type="text" name="order_no" size="5" value="<?php echo $row['order_no']; ?>" readonly></td>
<td><input type="text" name="p_id" size="5" value="<?php echo $row['p_id']; ?>" readonly></td>
<td><?php echo $row['pname']; ?></td>
<td><?php echo $row['o_date']; ?></td>
<td><?php echo $row['status']; ?></td>
<td><?php echo $row['o_amount']; ?></td>
<td><input type="text" name="c_amount" size="5" value="<?php echo $row['currentamount']; ?>" readonly></td>
<td><input type="text" name="g_amount" size="5" value="<?php echo $row['g_amount']; ?>" /></td>
</td>
<td><?php echo $row['g_date']; ?></td>
<td>
<button type="submit" name="approve" onclick="return confirm('sure to Approve !');">Approve</button>
</tr>
</form>
<?php
}
}
else{
echo 'Problem in Reading order list'; //giving failure message
}
?>
</table>
</div>
</div>
<?php include_once 'template/footer.php'; ?>
</body>
</html>