-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview-stock.html
84 lines (75 loc) · 2.52 KB
/
view-stock.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View Stock Records</title>
<!-- Add your CSS styles for better presentation -->
<style>
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h1>Stock Records</h1>
<?php
// Establish a connection to your MySQL database
$servername = "your_server_name";
$username = "your_username";
$password = "your_password";
$dbname = "your_database_name";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check the connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Retrieve stock information from the database
$sql = "SELECT * FROM product_stock";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Display stock information in a table
echo "<table>";
echo "<tr><th>ID</th><th>Product Name</th><th>Stock Quantity</th><th>Sales Price</th><th>Cost Price</th><th>Date and Time</th><th>Staff Name</th><th>Contact</th><th>Category</th></tr>";
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['product_name'] . "</td>";
echo "<td>" . $row['stock_qty'] . "</td>";
echo "<td>" . $row['sales_price'] . "</td>";
echo "<td>" . $row['cost_price'] . "</td>";
echo "<td>" . $row['datetime'] . "</td>";
echo "<td>" . $row['staff_name'] . "</td>";
echo "<td>" . $row['contact'] . "</td>";
echo "<td>" . $row['category'] . "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "No records found";
}
// Close the database connection
$conn->close();
?>
<!-- Add page links or navigation as needed -->
<div>
<a href="index.html">Back to Home</a> |
<a href="sales.php">Sales</a> |
<a href="products.php">Products</a> |
<a href="inventory.php">Inventory</a> |
<a href="reports.php">Reports</a> |
<a href="analytics.php">Analytics</a> |
<a href="profile.php">Profile</a>
</div>
</body>
</html>