-
Notifications
You must be signed in to change notification settings - Fork 1
/
godown.php
89 lines (61 loc) · 3.11 KB
/
godown.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
<?php
session_start();
if(!isset($_SESSION['Eid']))
header('location:login.php');
$Gid = $_GET['Gid'];
?>
<?php include "head.php"; ?>
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "supermarket";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "<h1><center>Items in Godown</center></h1>";
$sql = "SELECT * FROM godown_item_details natural join item where Godown_ID = $Gid";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table class = 'table table-hover table-striped'><tr><th>Item ID</th><th>Item Name</th><th>Quantity</th><th>Price per unit</th><th>Total price</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["Item_ID"]. "</td><td>" . $row["Item_Name"]. "</td><td>" . $row["Quantity"] . "</td><td>Rs." . $row["Item_Unit_Price"] . " per " . $row["Item_Units"] ."</td><td>" . $row["Item_Unit_Price"] * $row["Quantity"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
echo "<br><br><h1><center>Purchase history</center></h1>";
$sql = "SELECT * FROM purchase natural join purchase_item_details natural join godown natural join item natural join supplier where Godown_ID = $Gid order by DOP";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table class = 'table table-hover table-striped'><tr><th>Date</th><th>Item ID</th><th>Item Name</th><th>Supplier ID</th><th>Supplier Name</th><th>Quantity</th><th>Price per unit</th><th>Total price</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["DOP"]. "</td><td>" . $row["Item_ID"]. "</td><td>" . $row["Item_Name"]. "</td><td>" . $row["Supplier_ID"]. "</td><td>" . $row["Supplier_Name"]. "</td><td>" . $row["Quantity"] . "</td><td>Rs." . $row["Item_Unit_Price"] . " per " . $row["Item_Units"] ."</td><td>" . $row["Item_Unit_Price"] * $row["Quantity"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
echo "<br><br><h1><center>Restock history</center></h1>";
$sql = "SELECT * FROM restock natural join restock_item_details natural join item natural join showroom where Godown_ID = $Gid order by DOR";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table class = 'table table-hover table-striped'><tr><th>Date</th><th>Item ID</th><th>Item Name</th><th>Showroom ID</th><th>Showroom Name</th><th>Quantity</th><th>Price per unit</th><th>Total price</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["DOR"]. "</td><td>" . $row["Item_ID"]. "</td><td>" . $row["Item_Name"]. "</td><td>" . $row["Showroom_ID"]. "</td><td>" . $row["Showroom_Name"]. "</td><td>" . $row["Quantity"] . "</td><td>Rs." . $row["Item_Unit_Price"] . " per " . $row["Item_Units"] ."</td><td>" . $row["Item_Unit_Price"] * $row["Quantity"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>