Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.223.159.143
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/home_employees.php |
<?php
include("sys_connect.php");
include("sys_mainphp.php");
include("sys_session.php");
?>
<div style="margin-bottom: 5px;" class="head_blue">Attendance Statistics</div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#menu1">This Month</a></li>
<li><a data-toggle="tab" href="#menu2">This Year</a></li>
<li><a data-toggle="tab" href="#menu3">All Time</a></li>
</ul>
<div class="tab-content" id="home-content-note">
<div id="menu1" class="tab-pane fade in active">
<?php
$curr_date = date('Y-m-d');
$prin_date = date('d/m/Y', strtotime($curr_date));
$mysql = "select masdept_user.fdeptcode,count(attendance.fdeptcode) as ltotalat,";
$mysql .= "sum(case when fattnstat in ('pr','p1','p2','p3','po','d1','d2','d3','cd') then 1 else 0 end) as ltotalpr,";
$mysql .= "sum(case when fattnstat='ab' then 1 else 0 end) as ltotalab,";
$mysql .= "sum(case when fattnstat='cl' then 1 else 0 end) as ltotalcl, ";
$mysql .= "sum(case when fattnstat='hd' then 1 else 0 end) as ltotalhd ";
$mysql .= "from masdept_user ";
$mysql .= "left join attendance on attendance.fdeptcode = masdept_user.fdeptcode and attendance.fattndate='$curr_date' ";
$mysql .= "inner join masdept on masdept_user.fdeptcode = masdept.fdeptcode and fdeptstat='T' and fattnenbl='T' ";
if ($type_id != 'ADMIN') {
$mysql .= "where fusercode='$user_id' ";
}
$mysql .= "group by masdept_user.fdeptcode order by masdept.fdeptname";
$myres = mysqli_query($mycon, $mysql) or die(mysqli_error($mycon));
echo "<table class='table table-striped table-condensed'>";
echo "<tr>";
echo "<th class='text-left'> $prin_date</th>";
echo "<th class='text-center'>Present</th>";
echo "<th class='text-center'>Absent</th>";
echo "<th class='text-center'>C.L.</th>";
echo "<th class='text-center'>Holiday</th>";
echo "<th class='text-center'>Total</th>";
echo "<th class='text-center'>Remarks</th>";
echo "</tr>";
while ($myrow = mysqli_fetch_assoc($myres)) {
$dept_name = get_dept_name($myrow['fdeptcode']);
$lxstatus = "";
$ltotalpr = $myrow['ltotalpr'];
$ltotalab = $myrow['ltotalab'];
$ltotalcl = $myrow['ltotalcl'];
$ltotalhd = $myrow['ltotalhd'];
$ltotalat = $myrow['ltotalat'];
if ($ltotalat == 0) {
$lxstatus = "Pending";
}
echo "<tr>";
echo "<td class='text-left'> $dept_name</td>";
echo "<td class='text-center'> $ltotalpr</td>";
echo "<td class='text-center'> $ltotalab</td>";
echo "<td class='text-center'> $ltotalcl</td>";
echo "<td class='text-center'> $ltotalhd</td>";
echo "<td class='text-center'> $ltotalat</td>";
echo "<td class='text-center'> $lxstatus</td>";
echo "</tr>";
}
echo "</table>";
?>
</div>
<div id="menu2" class="tab-pane fade">
<?php
echo "<table class='table table-striped table-condensed'>";
$strt_date = date('Y-m-01');
$curr_tday = date('d');
for ($i = 0; $i < $curr_tday; $i++) {
$attn_date = date('Y-m-d', strtotime("+$i day", strtotime($strt_date)));
$mysql = "select masdept_user.fdeptcode,count(attendance.fdeptcode) as ltotalat,";
$mysql .= "sum(case when fattnstat in ('pr','p1','p2','p3','po','d1','d2','d3','cd') then 1 else 0 end) as ltotalpr,";
$mysql .= "sum(case when fattnstat='ab' then 1 else 0 end) as ltotalab,";
$mysql .= "sum(case when fattnstat='cl' then 1 else 0 end) as ltotalcl, ";
$mysql .= "sum(case when fattnstat='hd' then 1 else 0 end) as ltotalhd ";
$mysql .= "from masdept_user ";
$mysql .= "left join attendance on attendance.fdeptcode = masdept_user.fdeptcode and attendance.fattndate='$attn_date' ";
$mysql .= "inner join masdept on masdept_user.fdeptcode = masdept.fdeptcode and fdeptstat='T' and fattnenbl='T' ";
$mysql .= "where fusercode='$user_id' group by masdept_user.fdeptcode order by masdept.fdeptname";
$myres = mysqli_query($mycon, $mysql) or die(mysqli_error($mycon));
$mycnt = mysqli_num_rows($myres);
if ($mycnt != 0) {
$prin_date = date('d/m/Y', strtotime($attn_date));
echo "<tr>";
echo "<th class='text-left'> $prin_date</th>";
echo "<th class='text-center'>Present</th>";
echo "<th class='text-center'>Absent</th>";
echo "<th class='text-center'>C.L.</th>";
echo "<th class='text-center'>Holiday</th>";
echo "<th class='text-center'>Total</th>";
echo "<th class='text-center'>Remarks</th>";
echo "</tr>";
}
while ($myrow = mysqli_fetch_assoc($myres)) {
$dept_name = get_dept_name($myrow['fdeptcode']);
$lxstatus = "";
$ltotalpr = $myrow['ltotalpr'];
$ltotalab = $myrow['ltotalab'];
$ltotalcl = $myrow['ltotalcl'];
$ltotalhd = $myrow['ltotalhd'];
$ltotalat = $myrow['ltotalat'];
if ($ltotalat == 0) {
$lxstatus = "Pending";
}
echo "<tr>";
echo "<td class='text-left'> $dept_name</td>";
echo "<td class='text-center'> $ltotalpr</td>";
echo "<td class='text-center'> $ltotalab</td>";
echo "<td class='text-center'> $ltotalcl</td>";
echo "<td class='text-center'> $ltotalhd</td>";
echo "<td class='text-center'> $ltotalat</td>";
echo "<td class='text-center'> $lxstatus</td>";
echo "</tr>";
}
if ($mycnt != 0) {
echo "<tr>";
echo "<td colspan=99 class='bg-info'></td>";
echo "</tr>";
}
}
echo "</table>";
?>
</div>
<div id="menu3" class="tab-pane fade">
<?php
echo "<table class='table table-striped table-condensed'>";
$strt_date = date('Y-m-01');
$curr_tday = date('d');
for ($i = 0; $i < $curr_tday; $i++) {
$attn_date = date('Y-m-d', strtotime("+$i day", strtotime($strt_date)));
$mysql = "select masdept_user.fdeptcode,count(attendance.fdeptcode) as ltotalat,";
$mysql .= "sum(case when fattnstat in ('pr','p1','p2','p3','po','d1','d2','d3','cd') then 1 else 0 end) as ltotalpr,";
$mysql .= "sum(case when fattnstat='ab' then 1 else 0 end) as ltotalab,";
$mysql .= "sum(case when fattnstat='cl' then 1 else 0 end) as ltotalcl, ";
$mysql .= "sum(case when fattnstat='hd' then 1 else 0 end) as ltotalhd ";
$mysql .= "from masdept_user ";
$mysql .= "left join attendance on attendance.fdeptcode = masdept_user.fdeptcode and attendance.fattndate='$attn_date' ";
$mysql .= "inner join masdept on masdept_user.fdeptcode = masdept.fdeptcode and fdeptstat='T' and fattnenbl='T' ";
$mysql .= "where fusercode='$user_id' group by masdept_user.fdeptcode having ltotalat=0 order by masdept.fdeptname ";
$myres = mysqli_query($mycon, $mysql) or die(mysqli_error($mycon));
$mycnt = mysqli_num_rows($myres);
if ($mycnt != 0) {
$prin_date = date('d/m/Y', strtotime($attn_date));
echo "<tr>";
echo "<th class='text-left'> $prin_date</th>";
echo "<th class='text-center'>Present</th>";
echo "<th class='text-center'>Absent</th>";
echo "<th class='text-center'>C.L.</th>";
echo "<th class='text-center'>Holiday</th>";
echo "<th class='text-center'>Total</th>";
echo "<th class='text-center'>Remarks</th>";
echo "</tr>";
}
while ($myrow = mysqli_fetch_assoc($myres)) {
$dept_name = get_dept_name($myrow['fdeptcode']);
$lxstatus = "";
$ltotalpr = $myrow['ltotalpr'];
$ltotalab = $myrow['ltotalab'];
$ltotalcl = $myrow['ltotalcl'];
$ltotalhd = $myrow['ltotalhd'];
$ltotalat = $myrow['ltotalat'];
if ($ltotalat == 0) {
$lxstatus = "Pending";
}
echo "<tr>";
echo "<td class='text-left'> $dept_name</td>";
echo "<td class='text-center'> $ltotalpr</td>";
echo "<td class='text-center'> $ltotalab</td>";
echo "<td class='text-center'> $ltotalcl</td>";
echo "<td class='text-center'> $ltotalhd</td>";
echo "<td class='text-center'> $ltotalat</td>";
echo "<td class='text-center'> $lxstatus</td>";
echo "</tr>";
}
if ($mycnt != 0) {
echo "<tr>";
echo "<td colspan=99 class='bg-info'></td>";
echo "</tr>";
}
}
echo "</table>";
?>
</div>
</div>
|