-
Notifications
You must be signed in to change notification settings - Fork 0
/
notification_stock.php
76 lines (75 loc) · 2.25 KB
/
notification_stock.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
<?php
if (!isset($_SESSION))
{
session_start();
}
if(isset($_SESSION["login_usertype"]))
{//some one is logon
$system_usertype=$_SESSION["login_usertype"];
$system_username=$_SESSION["login_username"];
$system_userid=$_SESSION["login_userid"];
}
else
{//guest
$system_usertype="Guest";
}
include "config.php";
?>
<div class="card">
<div class="card-body">
<center><h5 class="card-title">Stock View</h5></center>
<div class="table-responsive">
<table id="zero_config" class="table table-striped table-bordered">
<thead>
<tr>
<th>product ID</th>
<th>quantity</th>
</tr>
</thead>
<tbody>
<?php
$sqlview="SELECT product_id,name,minimum_alert FROM product";
$resultview = mysqli_query($con,$sqlview) or die ("Error in sqlview ".mysqli_error($con));
while($rowview=mysqli_fetch_assoc($resultview))
{
$sqlcheckprice="SELECT product_id FROM product_price WHERE product_id='$rowview[product_id]' AND end_date IS NULL";
$resultcheckprice=mysqli_query($con,$sqlcheckprice) or die ("Error in sqlcheckprice" . mysqli_error($con));
$m=mysqli_num_rows($resultcheckprice);
if($m==0)//not sale
{
$pricemessage='<font color="orange">Currently not Sale</font>';
}
else
{
$pricemessage="";
}
$sqlstockcheck="SELECT quantity FROM stock WHERE product_id='$rowview[product_id]'";
$resultstockcheck=mysqli_query($con,$sqlstockcheck) or die ("Error in sqlstockcheck" . mysqli_error($con));
$n=mysqli_num_rows($resultstockcheck);
if($n==0)
{
$quantity='<font color="red"> Still not Purchase</font>';
echo'<tr>';
echo '<td>'.$rowview["name"].' '.$pricemessage.'</td>';
echo '<td>'.$quantity.'</td>';
echo'</tr>';
}
else
{
$rowstockcheck=mysqli_fetch_assoc($resultstockcheck);
if($rowview["minimum_alert"]>$rowstockcheck["quantity"])
{
$quantity=$rowstockcheck["quantity"].'<font color="red"> Want to Purchase</font>';
echo'<tr>';
echo '<td>'.$rowview["name"].' '.$pricemessage.'</td>';
echo '<td>'.$quantity.'</td>';
echo'</tr>';
}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>