-
Notifications
You must be signed in to change notification settings - Fork 2
/
add_staff.php
executable file
·220 lines (189 loc) · 6.82 KB
/
add_staff.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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
session_start();
$main_page="Add Staff";
?>
<!DOCTYPE html>
<html><!-- InstanceBegin template="/Templates/template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<?php
if($current_user==FALSE)
{
header("location: index.php");
}
?>
<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="manage_staff.php">Back to Staffs</a></p>
<?php
$firstname=isset($_POST['firstname']) ? $_POST['firstname'] : ( isset($_SESSION['firstname']) ? $_SESSION['firstname'] : "");
$my_pix=isset($_POST['my_pix']) ? $_POST['my_pix'] : (isset($_SESSION['my_pix']) ? $_SESSION['my_pix'] : "");
$lastname=isset($_POST['lastname']) ? $_POST['lastname'] : (isset($_SESSION['lastname']) ? $_SESSION['lastname'] : "");
$lastname=isset($_POST['position1']) ? $_POST['position1'] : (isset($_SESSION['position1']) ? $_SESSION['position1'] : "");
$salary=isset($_POST['salary']) ? $_POST['salary'] : (isset($_SESSION['salary']) ? $_SESSION['salary'] : "");
$allowances=isset($_POST['allowances']) ? $_POST['allowances'] : (isset($_SESSION['allowances']) ? $_SESSION['allowances'] : "");
$deductions=isset($_POST['deductions']) ? $_POST['deductions'] : (isset($_SESSION['deductions']) ? $_SESSION['deductions'] : "");
$net_pay=isset($_POST['net_pay']) ? $_POST['net_pay'] : (isset($_SESSION['net_pay']) ? $_SESSION['net_pay'] : "");
?>
<form action="add_staff_process.php" method="post" id="myform">
<table align="center" cellpadding="5" cellspacing="1">
<tr bgcolor="#cdcdcd">
<td>Firstname</td>
<td><input name="firstname" type="text" id="firstname" />
<td>Upload Passport</td>
<td><input name="my_pix" type="file" id="my_pix"/></td>
</tr>
<tr bgcolor="#efefef">
<td>Lastname</td>
<td><input name="lastname" type="text" id="lastname"/></td>
<td>Position</td>
<td>
<select name="position1" id="position1">
<option value=""></option>
<option value="principal">Principal</option>
<option value="Teacher">Teacher</option>
<option value="cso">Cso</option>
<option value="normal_staff">Normal Staff</option>
</select>
</td>
</tr>
<tr bgcolor="#cdcdcd">
<td>Basic Salary</td>
<td><input name="salary" type="text" id="salary" /></td>
<td>Allowances</td>
<td><input name="allowances" id="allowances" /></td>
</tr>
<tr bgcolor="#efefef">
<td>Deductions</td>
<td><input name="deductions" type="text" id="deductions" /></td>
<td>Net Pay</td>
<td><input name="net_pay" type="text" id="net_pay" /></td>
</tr>
<tr bgcolor="#cdcdcd">
<td colspan="4" align="center"><input type="button" value="Add Staff" onclick="add_staff_bttn()" /></td>
</tr>
</table>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
</form>
<script type="text/javascript">
document.getElementById("firstname").focus()
function add_staff_bttn()
{
if(document.getElementById("firstname").value=="")
{
alert("Please Input Your First Name");
document.getElementById("firstname").focus()
return null;
}
var i=document.getElementById("my_pix").value;
if(i=="")
{
alert("Please select your picture file");
return nul;
}
if(document.getElementById("lastname").value=="")
{
alert("Please Input your lastname");
document.getElementById("lastname").focus();
return null;
}
if(document.getElementById("position1").value=="")
{
alert("Please select your position");
document.getElementById("position1").focus();
return null;
}
if(document.getElementById("salary").value=="")
{
alert("Please input the Amount For Salary & Plss It has to be a Number");
document.getElementById("salary").focus();
return null;
}
if(isNaN(document.getElementById("salary").value)==true)
{
alert("Please input the Amount For Salary & Plss It has to be a Number");
document.getElementById("salary").focus();
return null;
}
if(document.getElementById("allowances").value=="")
{
alert("Please input the Amount For allowances & Plss It has to be a Number");
document.getElementById("allowances").focus();
return null;
}
if(isNaN(document.getElementById("allowances").value)==true)
{
alert("Please input the Amount For allowances & Plss It has to be a Number");
document.getElementById("allowances").focus();
return null;
}
if(document.getElementById("deductions").value=="")
{
alert("Please input the Amount For deductions & Plss It has to be a Number");
document.getElementById("deductions").focus();
return null;
}
if(isNaN(document.getElementById("deductions").value)==true)
{
alert("Please input the Amount For deductions & Plss It has to be a Number");
document.getElementById("deductions").focus();
return null;
}
if(document.getElementById("net_pay").value=="")
{
alert("Please input the Amount For net_pay & Plss It has to be a Number");
document.getElementById("net_pay").focus();
return null;
}
if(isNaN(document.getElementById("net_pay").value)==true)
{
alert("Please input the Amount For net_pay & Plss It has to be a Number");
document.getElementById("net_pay").focus();
return null;
}
document.getElementById("myform").submit()
}
</script>
<!-- InstanceEndEditable -->
</div>
</body>
<!-- InstanceEnd --></html>