-
Notifications
You must be signed in to change notification settings - Fork 0
/
FilterForTransferPage.php
107 lines (88 loc) · 2.41 KB
/
FilterForTransferPage.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
<!DOCTYPE html>
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 5px;
}
th {text-align: left;}
</style>
</head>
<body>
<?php
session_start();
include 'Connect.php';
include 'Alert.php';
$assetname = $_GET['assetname'];
$staffemail = $_GET['staffemail'];
$conn = connectDB("assetsDB");
if (!$conn) {
die('Could not connect: ' . mysqli_error($conn));
}
$sql = NULL;
echo "<br></br>";
$d=NULL;
$assettypeid = "%";
if($assetname === "All" || $assetname === "By Items")
{
$assetname = "%";
}
else
{
$assetname = rtrim($assetname,"\0");
}
if($staffemail === "All" || $staffemail === "")
{
$staffemail = "%";
}
$t= $_SESSION['Email'];
$deptid = "Select DepartmentID from userinfo where Email = '$t'";
$deptstringidsql = "Select DepartmentStringID from departmentidinfo where DepartmentID in ($deptid)";
$result = mysqli_query($conn,$deptstringidsql);
$row = mysqli_fetch_row($result);
$deptstringid = $row[0];
$assetname = str_replace(" ","",$assetname);
$sql = "SELECT * FROM assetcurrentinfo WHERE replace(replace(AssetName,'\t',''),' ','') like '$assetname' AND Email like '$staffemail' AND Status = 'Available' and AssetID like '$deptstringid%' order by AssetName"; // if only available things needs to be transferred give the condition as available
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0)
{
?>
<div id="TableCodePreview" class="PreviewTable" >
<table>
<thead>
<tr>
<td><label>#</label></td>
<td><label>Asset Id</label></td>
<td><label>Asset Name</label></td>
<td><label>Email</label></td>
<td><label>Status</label></td>
</tr>
</thead>
<tbody>
<?php
foreach ($result as $row) : ?>
<tr>
<td><input class = "myCheckBox" name="checkbox1[]" type="checkbox" id="checkbox1[]" value="<?php echo $row['AssetID']; ?>"></td>
<td><?php echo $row["AssetID"] ?></td>
<td><?php echo $row["AssetName"] ?></td>
<td><?php echo $row["Email"] ?></td>
<td><?php echo $row["Status"] ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
<?php
}
else
{
echo "Sorry no assets found for your selection. Please try different combination!";
}
mysqli_close($conn);?>
</body>
</html>