-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmanage_staff.php
More file actions
executable file
·157 lines (138 loc) · 4.78 KB
/
manage_staff.php
File metadata and controls
executable file
·157 lines (138 loc) · 4.78 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
<?php
session_start();
$main_page="Manage Staff";
require_once("dbconnect.php");
?>
<!DOCTYPE html>
<html><!-- InstanceBegin template="/Templates/template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Nancin Christ Standard School
<?php
if(isset($main_page))
{
echo" : $main_page";
}
if(isset($sub_page))
{
echo" : ($sub_page)";
}
?>
</title>
<!-- InstanceEndEditable -->
<link href="styles.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<div id="header">
<h1>Payroll</h1>
</div>
<div id="content">
<?php
if($main_page!="Login" && isset($_SESSION['current_user']))
{
?>
<p align="right" style="border-bottom:solid 1px #ccc;"><b>User:</b> <?php echo $_SESSION['current_user'];?></p>
<?php
}
?>
<h1 align="center"> <?php echo $main_page; ?> </h1>
<?php
if(isset($_SESSION['message']))
{
?>
<p class="<?php echo $_SESSION['messagetype']; ?>"><?php echo $_SESSION['message']; ?></p>
<?php
unset($_SESSION['message'],$_SESSION['messagetype']);
}
?>
<!-- InstanceBeginEditable name="mycontent" -->
<p align="center"><a href="home.php">Home</a> | <a href="add_staff.php">Add a New Staff</a></p>
<?php
$select_staff=mysql_query("select * from staff");
if($select_staff==FALSE)
{
?>
<p class="errormessage">Error encounter accesing staffs Information!! <?php echo mysql_error; ?> </p>
<?php
die();
}
$total_staff=mysql_num_rows($select_staff);
if($total_staff<=0)
{
?>
<p class="errormessage">No Staff Found!!!! </p>
<?php
}
else
{
?>
<table align="center" cellpadding="5" cellspacing="0" border="0">
<tr class="tableheading">
<td>First Name</td>
<td>Last Name</td>
<td>Position</td>
<td>Salary</td>
<td>Allowances</td>
<td>Deductions</td>
<td>Net Pay</td>
<td>Delete</td>
</tr>
<?php
$bgcolor="#cdcdcd";
$sum_sal=0;
$sum_all=0;
$sum_ded=0;
$sum_net=0;
for($count_staff=0; $count_staff<$total_staff; $count_staff++)
{
if($bgcolor=="#cdcdcd")
{
$bgcolor="#efefef";
}
else
{
$bgcolor="#cdcdcd";
}
mysql_data_seek($select_staff, $count_staff);
$row_select_staff=mysql_fetch_assoc($select_staff);
?>
<tr bgcolor="<?php echo $bgcolor; ?>">
<td><a href="view_profile.php?id=<?php echo $row_select_staff['id']; ?>"><?php echo $row_select_staff['firstname']; ?></a></td>
<td><a href="edit_profile.php?id=<?php echo $row_select_staff['id']; ?>"><?php echo $row_select_staff['lastname']; ?></a></td>
<td><?php echo $row_select_staff['position1']; ?></td>
<td><?php echo $row_select_staff['salary'];
$sum_sal += $row_select_staff['salary'];
?></td>
<td><?php echo $row_select_staff['allowances'];
$sum_all += $row_select_staff['allowances'];
?></td>
<td><?php echo $row_select_staff['deductions'];
$sum_ded += $row_select_staff['deductions'];
?></td>
<td><?php echo $row_select_staff['net_pay'];
$sum_net += $row_select_staff['net_pay'];
?></td>
<td><a href="delete_staff.php?firstname=<?php echo $row_select_staff['firstname'] ?>">Delete</a></td>
</tr>
<?php
}
?>
<tr>
<td>Total:</td>
<td> </td>
<td> </td>
<td align="right" bgcolor="#99FF66"><?php echo number_format($sum_sal,2); ?></td>
<td align="right" bgcolor="#003399"><?php echo number_format($sum_all,2); ?></td>
<td align="right" bgcolor="#99FF66"><?php echo number_format($sum_ded,2); ?></td>
<td align="right" bgcolor="#003399"><?php echo number_format($sum_net,2); ?></td>
</tr>
</table>
<?php
}
?>
<!-- InstanceEndEditable -->
</div>
</body>
<!-- InstanceEnd --></html>