-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathviewemployee.php
263 lines (255 loc) · 10.1 KB
/
viewemployee.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?php
include_once('header.php');
$emp_id = $_REQUEST['id'];
/* FETCHING DATA FROM DATABASE */
$empData = $obj->SelectByID('employee', $emp_id);
$awardsGiven = R::getAll("SELECT * FROM awardsgiven WHERE emp_id = $emp_id ORDER BY id DESC");
$payslipsData = R::getAll("SELECT * FROM payslips WHERE emp_id = $emp_id ORDER BY id DESC");
$deptData = $obj->SelectByID('department', $empData['dept_id']);
$awardsCount = $obj->CountByArgs('awardsgiven', "emp_id = $emp_id");
//Calculating total amount of awards given
$awardsTotAmount = 0;
if ($awardsGiven) {
foreach ($awardsGiven as $CalTotalAmount) {
$awardsTotAmount += $CalTotalAmount['amount'];
}
}
//Calculating total amount of salary/payslips given
$salTotAmount = 0;
if ($payslipsData) {
foreach ($payslipsData as $CalpayslipsData) {
$salTotAmount += $CalpayslipsData['amount'];
}
}
?>
<style>
.viewdataHeading {
text-align: center;
background: #2196f3;
color: white;
padding: 10px;
border-radius: 16px;
}
.subHeading {
font-size: 20px;
color: grey;
font-weight: bold;
margin-bottom: 5px;
}
</style>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h2 class="h2">View employee: <?= $empData['name'] . ' - ' . $empData['emp_id'] ?></h2>
</div>
<div class="container">
<div class="row">
<table style="width:100%" class="center">
<tr>
<th>
<h1><?= $awardsCount ?></h1>
</th>
<th>
<h1><?= Format::NumFormat($awardsTotAmount) ?></h1>
</th>
<th>
<h1><?= Format::NumFormat($salTotAmount) ?></h1>
</th>
</tr>
<tr>
<td style="font-size: 12px;color: #9e9e9e;">
Awards given
</td>
<td style="font-size: 12px;color: #9e9e9e;">
Total amount from awards
</td>
<td style="font-size: 12px;color: #9e9e9e;">
Total salary given
</td>
</tr>
</table>
</div>
<div class="row">
<div class="col-12">
<h4 class="viewdataHeading">General data</h4>
<div class="row">
<div class="col" style="padding: 0px 37px;">
<div class="subHeading">General details</div>
<table style="width:100%">
<tr>
<th>
Department
</th>
<td>:</td>
<td>
<?= $deptData['name'] . ', ' . $deptData['designation'] . ' (' . $deptData['dep_id'] . ')' ?>
</td>
</tr>
<tr>
<th>
Email
</th>
<td>:</td>
<td>
<?= $empData['email'] ?>
</td>
</tr>
<tr>
<th>
Mobile number
</th>
<td>:</td>
<td>
<?= $empData['mobile'] ?>
</td>
</tr>
<tr>
<th>
Qualification
</th>
<td>:</td>
<td>
<?= $empData['qualification'] ?>
</td>
</tr>
<tr>
<th>
Gender
</th>
<td>:</td>
<td>
<?= $empData['gender'] ?>
</td>
</tr>
</table>
</div>
<div class="col" style="padding: 0px 37px;">
<div class="subHeading">Address details</div>
<table style="width:100%">
<tr>
<th>
Address
</th>
<td>:</td>
<td>
<?= $empData['address'] ?>
</td>
</tr>
<tr>
<th>
Country
</th>
<td>:</td>
<td>
<?= $empData['country'] ?>
</td>
</tr>
<tr>
<th>
City
</th>
<td>:</td>
<td>
<?= $empData['city'] ?>
</td>
</tr>
<tr>
<th>
State
</th>
<td>:</td>
<td>
<?= $empData['state'] ?>
</td>
</tr>
<tr>
<th>
Pincode
</th>
<td>:</td>
<td>
<?= $empData['pincode'] ?>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<h4 class="viewdataHeading">Awards data</h4>
<table class="table">
<thead class="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">Awarded on</th>
<th scope="col">Award name</th>
<th scope="col">Amount</th>
</tr>
</thead>
<tbody>
<?php
if ($awardsGiven) {
$i = 1;
foreach ($awardsGiven as $RowawardsGiven) { ?>
<tr>
<th scope="row"><?= $i ?></th>
<td><?= Format::DateTimeformat($RowawardsGiven['date']) ?></td>
<td>
<?php
$awardName = $obj->SelectByID('awards', $RowawardsGiven['award_id']);
echo $awardName['title'];
?>
</td>
<td><?= Format::NumFormat($RowawardsGiven['amount']) ?></td>
</tr>
<?php
$i++;
}
} else echo '<tr><td colspan="4" class="noData">NO DATA AVAILABLE</td></tr>';
?>
</tbody>
</table>
</div>
<div class="col-6">
<h4 class="viewdataHeading">Payslips data</h4>
<table class="table">
<thead class="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">Slip ID</th>
<th scope="col">Date</th>
<th scope="col">Amount</th>
</tr>
</thead>
<tbody>
<?php
if ($payslipsData) {
$i = 1;
foreach ($payslipsData as $RowpayslipsData) { ?>
<tr>
<th scope="row"><?= $i ?></th>
<td><?= $RowpayslipsData['slip_id'] ?></td>
<td><?= Format::DateTimeformat($RowpayslipsData['date']) ?></td>
<td><?= Format::NumFormat($RowpayslipsData['amount']) ?></td>
</tr>
<?php
$i++;
}
} else echo '<tr><td colspan="3" class="noData">NO DATA AVAILABLE</td></tr>';
?>
</tbody>
</table>
</div>
</div>
</div>
</main>
<?php
include_once('footer.php');
?>
<script>
$(document).ready(function() {
$(document).attr("title", "HRMS | EMPLOYEES");
$('#employees').addClass('active');
});
</script>