-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha-accepted.php
More file actions
48 lines (33 loc) · 1.32 KB
/
Copy patha-accepted.php
File metadata and controls
48 lines (33 loc) · 1.32 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
<?php
include('connection.php');
$orderid = $_POST['order_id'];
$stock_quan = $_POST['stock_quan'];
$order_quan = $_POST['order_quan'];
$remarks = "accepted";
if(isset($_POST['accept'])){
$check_s = mysqli_query($conn, "select *from `orders` where orderid='$orderid'");
$checkered = mysqli_num_rows($check_s);
if($checkered > 0)
{
mysqli_query($conn, "UPDATE `orders` SET `remarks` = '$remarks' WHERE `orderid` = '$orderid'") or die(mysqli_error());
header("location:a-orders.php");
}
}
//if button decline is pressed return order quantity to stock
if(isset($_POST['decline'])){
$orderid = $_POST['order_id'];
$stock_quan = $_POST['stock_quan'];
$order_quan = $_POST['order_quan'];
$stock_id = $_POST['stock_id'];
$status = "declined";
$update = mysqli_query($conn, "select *from `orders` where orderid='$orderid'");
$returnquan = mysqli_num_rows($update);
if($returnquan > 0)
{
$stock_quan = $stock_quan + $order_quan;
mysqli_query($conn, "UPDATE `stocks` SET `quantity` = '$stock_quan' WHERE `s_id` = '$stock_id'") or die(mysqli_error());
mysqli_query($conn, "UPDATE `orders` SET `remarks` = '$status' WHERE `orderid` = '$orderid'") or die(mysqli_error());
header("location:a-orders.php");
}
}
?>