-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemployee.php
More file actions
198 lines (182 loc) · 7.28 KB
/
Copy pathemployee.php
File metadata and controls
198 lines (182 loc) · 7.28 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<html lang="en">
<?php
include "head.php";
?>
<?php
session_start(); //starts the session
if($_SESSION['user']){ // checks if the user is logged in
}
else{
header("location: index.php"); // redirects if user is not logged in
}
$user = $_SESSION['user']; //assigns user value
?>
<body>
<div class="container">
<header>
<div class="logo" >Indus Shop Database Management</div>
<nav class="float-right">
<div class="pure-menu pure-menu-open pure-menu-horizontal">
<ul>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
</nav>
</header>
<div class="pure-menu pure-menu-open pure-menu-horizontal">
<ul>
<h2> <li ><a href="home.php">Items</a></li>
<li class="pure-menu-selected"><a href="employee.php">Employees</a></li>
<li><a href="client.php">Clients</a></li>
<li ><a href="customer.php">Customers</a></li>
<li><a href="sale.php">Sales</a></li>
</h2>
</ul>
</div>
<h1 align="center">Employees</h1>
<nav class="float-right">
<div class="pure-menu pure-menu-open pure-menu-horizontal">
<ul>
<li><a href="add_employee.php">Add Employee</a></li>
</ul>
</div>
</nav>
</br>
<h2 align="center">Regural Worker</h2>
<table class="pure-table pure-table-bordered">
<thead>
<tr>
<th>Worker Id</th>
<th>Name</th>
<th>Salary</th>
<th>Date of Joining</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
include "connect.inc.php";
$queryworker = mysql_query("Select * from regular_worker");
$queryperson = mysql_query("Select * from person");
$queryemployee=mysql_query("Select * from employee");
while($roww = mysql_fetch_array($queryworker))
{
echo "<tr>";
echo '<td align="center"><a href="person.php?id='. $roww['emp_id'] .'">'. $roww['emp_id'] . "</a></td>";
$worker_id = $roww['emp_id'];
$sql1 = "SELECT f_name,l_name FROM `person` WHERE `person_id` = '$worker_id'";
$name=mysql_query($sql1);
$row = mysql_fetch_array($name);
echo '<td align="center">'. $row['f_name'] . " " . $row['l_name'] . "</td>";
$sql2 = "SELECT salary,doj FROM `employee` WHERE `emp_id` = '$worker_id'";
$sal=mysql_query($sql2);
$rows = mysql_fetch_array($sal);
echo '<td align="center">'. $rows['salary']. "</td>";
echo '<td align="center">'. $rows['doj']. "</td>";
echo '<td align="center"> <a href="edit_employee.php?id='. $roww['emp_id'] .'"> edit </a> </td>';
echo '<td align="center"> <a href="delete_employee.php?id='. $roww['emp_id'] .'"> delete </a></td>';
echo "</tr>";
}
?>
</tbody>
</table>
<br><br><br>
<h2 align="center">Specialists</h2>
<table class="pure-table pure-table-bordered">
<thead>
<tr>
<th>Specialist Id</th>
<th>Name</th>
<th>Salary</th>
<th>Date of Joining</th>
<th>Item_id</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
include "connect.inc.php";
$queryspecialist = mysql_query("Select * from specialist");
$queryperson = mysql_query("Select * from person");
while($rows = mysql_fetch_array($queryspecialist))
{
echo "<tr>";
echo '<td align="center"><a href="person.php?id='. $rows['emp_id'] .'">'. $rows['emp_id'] . "</a></td>";
$specialist_id = $rows['emp_id'];
$sql1 = "SELECT f_name,l_name FROM `person` WHERE `person_id` = '$specialist_id'";
// echo $sql;
$name=mysql_query($sql1);
$row = mysql_fetch_array($name);
echo '<td align="center">'. $row['f_name'] . " " . $row['l_name'] . "</td>";/*
$sql2 = "SELECT item_id FROM `item` WHERE client_id='$_id'";
$item_id=mysql_query($sql2);
echo '<td align="center">';
while($rowi = mysql_fetch_array($item_id))
{echo ','. $rowi['item_id'] . "";}
echo '</td>'; */
$sql2 = "SELECT salary,doj FROM `employee` WHERE `emp_id` = '$specialist_id'";
$sal=mysql_query($sql2);
$rowd = mysql_fetch_array($sal);
echo '<td align="center">'. $rowd['salary']. "</td>";
echo '<td align="center">'. $rowd['doj']. "</td>";
echo '<td align="center"><a href="item.php?id='. $rows['item_id'] .'">'. $rows['item_id'] . "</a></td>";
echo '<td align="center"> <a href="edit_employee.php?id='. $rows['emp_id'] .'"> edit </a> </td>';
echo '<td align="center"> <a href="delete_employee.php?id='. $rows['emp_id'] .'"> delete </a></td>';
echo "</tr>";
}
?>
</tbody>
</table>
<br><br><br>
<h2 align="center">Collectors</h2>
<table class="pure-table pure-table-bordered">
<thead>
<tr>
<th>Collector Id</th>
<th>Name</th>
<th>Salary</th>
<th>Date of Joining</th>
<th>Item_id</th>
<th>Client id</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
include "connect.inc.php";
$querycollector = mysql_query("Select * from collector");
$queryperson = mysql_query("Select * from person");
while($rowc = mysql_fetch_array($querycollector))
{
echo "<tr>";
echo '<td align="center"><a href="person.php?id='. $rowc['collector_id'] .'">'. $rowc['collector_id'] . "</a></td>";
$collector_id = $rowc['collector_id'];
$sql1 = "SELECT f_name,l_name FROM `person` WHERE `person_id` = '$collector_id'";
// echo $sql;
$name=mysql_query($sql1);
$row = mysql_fetch_array($name);
echo '<td align="center">'. $row['f_name'] . " " . $row['l_name'] . "</td>";
$sql2 = "SELECT salary,doj FROM `employee` WHERE `emp_id` = '$collector_id'";
$sal=mysql_query($sql2);
$rowd = mysql_fetch_array($sal);
echo '<td align="center">'. $rowd['salary']. "</td>";
echo '<td align="center">'. $rowd['doj']. "</td>";
// echo ''
echo '<td align="center"><a href="item.php?id='. $rowc['item_id'] .'">'. $rowc['item_id'] . "</a></td>";
echo '<td align="center"><a href="person.php?id='. $rowc['client_id'] .'">'. $rowc['client_id'] . "</a></td>";
echo '<td align="center"> <a href="edit_employee.php?id='. $rowc['collector_id'] .'"> edit </a> </td>';
echo '<td align="center"> <a href="delete_employee.php?id='. $rowc['collector_id'] .'"> delete </a></td>';
echo "</tr>";
}
?>
</tbody>
</table>
<?php
include "footer.php";
?>
</div>
</body>
</html>