-
Notifications
You must be signed in to change notification settings - Fork 2
/
stock-out.php
160 lines (128 loc) · 4.67 KB
/
stock-out.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
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
<?php
include("includes/header.php");
if(!isset($_SESSION['admin_username']))
{
echo "<script>document.location='login.php'</script>";
}
else
{
?>
<!-- Main Content-->
<div class="main-content pt-0">
<div class="container">
<div class="inner-body">
<!-- Page Header -->
<div class="page-header">
<div>
<h2 class="main-content-title tx-24 mg-b-5">Stocks</h2>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Stock Out</li>
</ol>
</div>
</div>
<!-- End Page Header -->
<!-- Row -->
<div class="row sidemenu-height">
<div class="col-lg-12">
<div class="card custom-card">
<div class="card-body">
<div class="table-responsive">
<table class="table" id="example1">
<thead>
<tr>
<th class="wd-20p">Product Name</th>
<th class="wd-15p">Quantity Left</th>
<th class="wd-20p">Supplier</th>
<th class="wd-15p">Stock Status</th>
<!--<th class="wd-15p">Action</th> -->
</tr>
</thead>
<tbody>
<?php
$get_prod = "SELECT * FROM product_tbl WHERE prod_qty <= reorder";
$run_prod = mysqli_query($db, $get_prod);
while($row_prod = mysqli_fetch_array($run_prod))
{
$prod_id = $row_prod['prod_id'];
$prod_name = $row_prod['prod_name'];
$sup_id = $row_prod['supplier_id'];
$qty = $row_prod['prod_qty'];
$status = $row_prod['prod_status'];
$reorder = $row_prod['reorder'];
// Get Supplier
$get_sup = "SELECT * FROM tbl_suppliers WHERE sup_id = '$sup_id'";
$run_sup = mysqli_query($db, $get_sup);
$row_sup = mysqli_fetch_array($run_sup);
$sup_name = $row_sup['sup_name'];
$sup_email = $row_sup['sup_email'];
?>
<tr>
<td><?php echo $prod_name; ?></td>
<td><?php echo $qty; ?></td>
<td><?php echo $sup_name; ?></td>
<td>
<?php
if($qty == $reorder)
{
echo "<span class='badge badge-danger'>Low Stock</span>";
}
elseif($qty < 0)
{
echo "<span class='badge badge-danger'>Stock Out</span>";
}
else
{
echo "<span class='badge badge-success'>In Stock</span>";
}
?>
</td>
<!--<td>
<a class="btn ripple btn-primary" data-target="#delete<?php echo $prod_id; ?>" data-toggle="modal" href="#delete<?php echo $prod_id; ?>">Make A Request</a>
</td> -->
</tr>
<!-- Delete Modal -->
<div class="modal" id="delete<?php echo $prod_id;?>">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content modal-content-demo">
<div class="modal-header">
<h6 class="modal-title">Product Request</h6><button aria-label="Close" class="close" data-dismiss="modal" type="button"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<form action="request-mail.php" method="post">
<div class="form-group">
<label>Supplier Email</label>
<input type="email" class="form-control" name="sup_email" value="<?php echo $sup_email; ?>" required>
</div>
<div class="form-group">
<label>Product Name</label>
<input type="text" class="form-control" name="prod_name" value="<?php echo $prod_name; ?>" required>
</div>
<div class="form-group">
<label>Quantity Needed</label>
<input type="text" class="form-control" name="qty" required>
</div>
</div>
<div class="modal-footer">
<button class="btn ripple btn-primary" name="send-mail" type="submit">Submit</button>
</div>
</form>
</div>
</div>
</div>
<!--End Delete Modal -->
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- End Row -->
</div>
</div>
</div>
<!-- End Main Content-->
<?php include("includes/footer.php"); ?>
<?php } ?>