-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathViewStock.php
103 lines (70 loc) · 2.6 KB
/
ViewStock.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
<?php require_once('includes/connection.php'); ?>
<?php
session_start();
$officerID = $_SESSION['userID'];
$query = "SELECT OfficerID, CenterID, FName, LName FROM AGRICULTURAL_OFFICER WHERE OfficerID = '{$officerID}' LIMIT 1";
$result = mysqli_query($conn, $query);
if ($recordRow = mysqli_fetch_assoc($result)) {
$userOfficerID = $recordRow['OfficerID'];
$userCenterID = $recordRow['CenterID'];
$userFName = $recordRow['FName'];
$userLName = $recordRow['LName'];
$msgViewUser = "Login as {$userOfficerID} - {$userFName} {$userLName} under Center - {$userCenterID}";
}
?>
<?php include('includes/header.php'); ?>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
<h1>Store Info</h1>
<h4><?php echo $msgViewUser ?></h4><hr>
<form action="ViewStock.php" method = "post">
</form>
<table>
<thead>
<tr>
<th>FertilizerID</th>
<th>Description</th>
<th>QtyOnHand</th>
<th>StoredDate</th>
<th>ExpireDate</th>
</tr>
</thead>
<tbody>
<?php
$officerid = $_SESSION['userID'] ;
$query = "SELECT FertilizerID , Description, QtyOnHand , StoredDate , ExpireDate FROM fertilizer_management.stores fm join fertilizer f USING(FertilizerID) where CenterID = (SELECT CenterID FROM fertilizer_management.agricultural_officer where OfficerID = '{$officerid}')";
$result = $conn -> query($query);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
<tr>
<td><?php echo $row["FertilizerID"]; ?></td>
<td><?php echo $row["Description"]; ?></td>
<td><?php echo $row["QtyOnHand"]; ?></td>
<td><?php echo $row["StoredDate"]; ?></td>
<td><?php echo $row["ExpireDate"]; ?></td>
</tr>
<?php
}
} else {
echo "0 results";
}
?>
</tbody>
</table>
<?php include('includes/footer.php'); ?>
<?php mysqli_close($conn); ?>