-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
100 lines (86 loc) · 3.81 KB
/
index.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<div class="topnav">
<a href="images/logo.png">
<img src="images/logo.png" alt="NTPC logo" class="logopic">
</a>
<a class="nav-item nav-link" href="index.php">Home</a>
<a class="nav-item nav-link " href="addemployee.php">Add Employee</a>
<a class="nav-item nav-link" href="adddevice.php">Add Device</a>
<a class="nav-item nav-link" href="issue.php">Issue</a>
<a class="nav-item nav-link" href="return.php">Return</a>
<a class="nav-item nav-link" href="report.php">Report</a>
</div>
<head>
<meta charset="utf-8">
<title>Index</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link href="dashboard.css" rel="stylesheet" type="text/css" >
</head>
<body style = "padding:10px;">
<!-- <br>
<nav class="nav nav-pills nav-justified">
<a class="nav-item nav-link active" href="index.php">Home</a>
<a class="nav-item nav-link" href="addemployee.php">Add Employee</a>
<a class="nav-item nav-link" href="adddevice.php">Add Device</a>
<a class="nav-item nav-link" href="issue.php">Issue</a>
<a class="nav-item nav-link" href="return.php">Return</a>
</nav>
<br> -->
<br>
<br>
<div style='padding:20px'>
<?php
$servername = 'localhost';
$username = 'root';
$password = '';
$dbname = 'test';
$conn = mysqli_connect($servername, $username, $password, $dbname);
if($conn){
//In Stock
$res = mysqli_query($conn, "SELECT COUNT(Device.DeviceNo), Device.Type, Device.Company
FROM Device
WHERE Device.Available='Yes'
GROUP BY Device.Type, Device.Company");
//Issued Devices
$res1 = mysqli_query($conn, "SELECT COUNT(Device.DeviceNo), Device.Type, Device.Company
FROM Device
WHERE Device.Available='No'
GROUP BY Device.Type, Device.Company");
//Total Devices
$res2 = mysqli_query($conn, "SELECT COUNT(DeviceNo), Type, Company
FROM Device
GROUP BY Type, Company;");
if(mysqli_num_rows($res)){
if(mysqli_num_rows($res2)){
$stock = mysqli_fetch_all($res);
$issued = mysqli_fetch_all($res1);
$total = mysqli_fetch_all($res2);
// echo "<h2>In Stock</h2>";
echo "<div class='card'> <div class='container'> <h2>In Stock</h2>
<table class='table table-hover' > <thread> <tr> <th>Count</th> <th>Type</th> <th>Company</th> </tr> </thread>";
for($i = 0; $i < sizeof($stock); $i++){
print_r('<tr>'.'<td>'.$stock[$i][0].'</td>'.'<td>'.$stock[$i][1].'</td>'.'<td>'.$stock[$i][2].'</td>'.'</tr>');
}
echo "</table> </div> </div> <br>";
// echo "<h2>Issued Devices</h2>";
echo "<div class='card'> <div class='container'> <h2>Issued Devices</h2>
<table class='table table-hover' > <thread> <tr><th>Count</th> <th>Type</th> <th>Company</th> </tr> </thread>";
for($i = 0; $i < sizeof($issued); $i++){
print_r('<tr>'.'<td>'.$issued[$i][0].'</td>'.'<td>'.$issued[$i][1].'</td>'.'<td>'.$issued[$i][2].'</td>'.'</tr>');
}
echo "</table> </div> </div>";
// echo "<h2>Total Devices</h2>";
// echo "<div class='card'> <div class='container'> <h2>Total Devices</h2>
// <table class='table table-hover' > <thread> <tr><th>Count</th> <th>Type</th> <th>Company</th> </tr> </thread>";
// for($i = 0; $i < sizeof($total); $i++){
// print_r('<tr>'.'<td>'.$total[$i][0].'</td>'.'<td>'.$total[$i][1].'</td>'.'<td>'.$total[$i][2 ].'</td>'.'</tr>');
// }
// echo "</table> </div> </div>";
}
}
}
echo "</div>";
echo "</body>";
echo "</html>";
?>