-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrecord.php
166 lines (152 loc) · 5.91 KB
/
record.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
<?php
session_start('pay');
?>
<?php include("connection.php"); ?>
<?php
if (!isset($_SESSION['username'])) {
echo("<script>location.href = 'login.php';</script>");
// header ('Location: login.php');
}
date_default_timezone_get();
//Check if the user is admin
$username = $_SESSION['username'];
$sql2 = "SELECT * FROM admin where username = '$username'";
$result = mysql_query($sql2) or die("Couldn't execute sql2");
$count = mysql_num_rows($result);
if ($count == 0) {
echo("<script>location.href = 'profile.php';</script>");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>Crawford</title>
<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="starter-template.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="assets/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">Crawford</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li><a href="pay.php">Staff Payment</a></li>
<li class="active"><a href="record.php">Records</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="logout.php">Logout</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<div class="starter-template">
<h3>Payment History</h3>
<div class="row">
<div class="col-md-6 employee responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Dept</th>
<th>Role</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$sql4 = "SELECT * FROM employee";
$res = mysql_query($sql4) or die("couldn't execute sql4");
while ($row4 = mysql_fetch_assoc($res)) {
?>
<tr>
<td><?= $row4['surname']." ".$row4['lastname'] ?></td>
<td><?= $row4['dept'] ?></td>
<td><?= $row4['position'] ?></td>
<td><button class="btn btn-info loadRecords" nd="<?= $row4['title'] ?> <?= $row4['surname'] ?> <?= $row4['lastname'] ?>" did="<?= $row4['employee_no'] ?>">View Employee Records</button></td>
<td><a href="printrecord.php?record=<?php echo $row4['employee_no']; ?>&name=<?= $row4['surname']." ".$row4['lastname'] ?>" target="_new" class="btn btn-info"> Print Records</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="col-md-6 recordTab" style="display:none;">
<h4><span id="changeText"></span> <em style="font-size:14px;">Payment Records</em></h4>
<table class="table table-striped">
<thead>
<tr>
<th>Worked Days</th>
<th>Absent Days</th>
<th>Allowance Fees</th>
<th>Overtime Fees</th>
<th>Tax Rate</th>
<th>Salary Fees</th>
<th>Recorded By</th>
<th>Date</th>
</tr>
</thead>
<tbody class="viewRecords">
</tbody>
</table>
</div>
</div>
</div>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="dist/js/bootstrap.min.js"></script>
<script src="dist/js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Load Records
$('.loadRecords').click(function(){
var eid = $(this).attr("did");
var nd = $(this).attr("nd");
var Data = {'eid':eid};
$.ajax({
url: "loadrecords.php",
method: "get",
data: Data,
dataType: "html",
success: function(res){
$('.recordTab').css("display","block");
$('.viewRecords').html(res);
$('#changeText').text(nd);
}
})
})
});
</script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>