IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="body">
<button class="btn btn-raised btn-warning btn-round waves-effect" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">Advance Search</button>
<div class="collapse" id="collapseExample">
<div class="well">
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="card">
<div class="header">
<h2><strong>Advance Search</strong></h2>
</div>
<div class="body">
<?php echo Form::open(['method' => 'GET', 'action' => ['School\EmpAttendanceController@reportAttendance'], 'class' => 'form-horizontal']); ?>
<div class="row clearfix">
<div class="col-sm-4">
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">Departments</label>
</div>
<div class="col-sm-7">
<div class="form-group">
<?php echo Form::select('idDepartment',$departments,null,['class' => 'form-control show-tick ms']); ?>
<?php if($errors->has('idDepartment')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idDepartment')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">Designation</label>
</div>
<div class="col-sm-7">
<div class="form-group">
<div id="idDesignation" style="border:1px solid #ccc; width:200px; height: 150px; overflow-y: scroll;">
<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-all" id="selectall"></div>
<?php $__currentLoopData = $designation; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key =>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:100px;"><?php echo e($value); ?></label><input type="checkbox" name="designations[]" value="<?php echo e($key); ?>" class="designationclass"></div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row clearfix">
<div class="col-sm-3 form-control-label">
<label for="classname">EC No.</label>
</div>
<div class="col-sm-7">
<div class="form-group">
<div id="idEmployee" style="border:1px solid #ccc; width:200px; height: 150px; overflow-y: scroll;">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-1 form-control-label required">
<label for="classname">Year</label>
</div>
<div class="col-sm-2">
<div class="form-group">
<?php echo Form::select('year',['2024'=>'2024','2025'=>'2025','2021'=>'2021',2022=>'2022','2023'=>'2023','2020'=>'2020','2019'=>'2019'],null,['class' => 'form-control show-tick ms']); ?>
</div>
</div>
<div class="col-sm-1 form-control-label required">
<label for="classname">Month</label>
</div>
<div class="col-sm-2">
<div class="form-group">
<?php echo Form::select('idMonth',getMonths(),$current_month->idMonth,['class' => 'form-control show-tick ms']); ?>
<?php if($errors->has('idMonth')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idMonth')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
<?php echo Form::submit('SHOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php echo Form::close(); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--</div>-->
</div>
</div>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="card">
<button class="btn btn-raised btn-info btn-round waves-effect" type="button" style="float:right;margin:20px;" onclick="location.href='<?php echo e(url('/school/print-empattendance-report?')); ?><?php echo e($query); ?>'">Print Advance Report</button>
<div class="body">
<div class="body">
<!-- Nav tabs -->
<!-- <ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#profile">Month</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#messages">All Time</a></li>
</ul> -->
<!-- Tab panes -->
<div>
<div class="header"><h2><strong>Employee Attandance Report (Late | Overtime)</strong></h2>
</div>
<div class="body table-responsive">
<?php if(isset($month)): ?>
<?php if(count($employees)>0): ?>
<table class="table table-bordered table-striped table-hover dataTable tableexp">
<thead>
<tr>
<th>EC No.</th>
<th>Name</th>
<?php $__currentLoopData = $days; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<th>
<?php if($var[1] == 'SUNDAY'): ?>
<span style="color:green; font-weight: bold;"><?php echo e(Carbon\Carbon::parse($var[0])->format('d-m')); ?></span>
<?php elseif($var[1]!=null && $var[1]!='SUNDAY'): ?>
<span style="color:green; font-weight: bold;"><?php echo e(Carbon\Carbon::parse($var[0])->format('d-m')); ?></span>
<?php else: ?>
<?php echo e(Carbon\Carbon::parse($var[0])->format('d-m')); ?>
<?php endif; ?>
</th>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<th>TP</th>
<th>TA</th>
<th>TH</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<?php
$total_present = 0;
$total_absent = 0;
$total_holiday = 0;
$allowedLateMinutes = 0;
$allowedEarlyMinutes = 0;
$totalLateDays = 0;
$totalEarlyDays = 0;
$empDays = [];
$idFinancialYear = Session::get('idFinancialYear');
$leaveMaster = fetchLeaveMaster($emp,$idFinancialYear);
?>
<td><?php echo e($emp->enrollmentNo); ?></td>
<td><?php echo e($emp->firstName); ?> <?php echo e($emp->middleName); ?> <?php echo e($emp->lastName); ?></td>
<?php $__currentLoopData = $days; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<td>
<?php
$tdate = Carbon\Carbon::parse($var[0]);
$now = Carbon\Carbon::now();
$jdate = $tdate->format('Y-m-d');
$cdate = intval($tdate->format('d'));
$length = $tdate->diffInDays($now);
//check for holiday
$holiday = getHoliday($emp,$jdate);
$shifts = fetchShift($emp,$jdate);
$dayNight = "AM";
$nightDay = "AM";
$isLeaveMaster = "N";
$empDays[$cdate] = "A";
$isPaidLeaveMaster = "N";
if($shifts != null && $holiday == null){
$dayNight = strtoupper($shifts->shift_from);
$nightDay = strtoupper($shifts->shift_to);
$arrival = checkArrival($emp,$jdate,$shifts,$school,$dayNight,$idFinancialYear,$allowedLateMinutes,$totalLateDays);
$departure = checkDeparture($emp,$jdate,$shifts,$school,$nightDay,$idFinancialYear,$allowedEarlyMinutes,$totalEarlyDays);
$overtime = fetchOvertime($emp,$shifts,$dayNight,$nightDay,$school,$jdate,$idFinancialYear);
$totalEarlyDays = $departure['days'];
$totalLateDays = $arrival['days'];
$nonPaidLeave = DB::table('employee_leave')
->whereDate('leave_from', '<=', $jdate)
->whereDate('leave_to', '>=', $jdate)
->where('idEmployee', $emp->idEmployee)
->where('status' ,'!=', 'Approve with PL(Paid Leave)')
->first();
if($nonPaidLeave != null){
$isPaidLeaveMaster = "K";
}else
if(fetchPaidLeave($jdate,$emp) == 1){
$isPaidLeaveMaster = "Y";
}else if($leaveMaster != null){
if($leaveMaster->leave_allocation == "A"){
$month = \App\Month::where('monthName', '=', $tdate->format('F'))->first();
if($cdate > 1 && $cdate < $month->noOfDays){
if(isset($leaveMaster->exclude_month)){
$month = \App\Month::where('monthName',$tdate->format('F'))->whereIn('idMonth',json_decode($leaveMaster->exclude_month,true))->get();
if(count($month) == 0){
//check for sandwich leave
if($holiday != null){
if(checkForSandwich($emp,$leaveMaster->sandwich,$empDays,$tdate,$cdate,$school) == 1){
$isLeaveMaster = "Y";
}
}
if($shifts->weekOff == "Y"){
if(checkForSandwich($emp,$leaveMaster->sandwich,$empDays,$tdate,$cdate,$school) == 1){
$isLeaveMaster = "Y";
}
}
}
}else{
//check for sandwich leave
}
}
}
}
}
else {
$arrival = [];
$departure = [];
}
?>
<?php if($isPaidLeaveMaster == "Y" || $isPaidLeaveMaster == "K"): ?>
<?php if($isPaidLeaveMaster == "K"): ?>
<?php $total_absent = $total_absent + 1;
$empDays[$cdate] = "A";
?>
<span style="color:red;font-weight:bold">A (Leave)</span><br>
<?php else: ?>
<?php $total_present = $total_present + 1; $empDays[$cdate] = "H";?>
<span style="color:green;font-weight:bold">P (Leave)</span><br>
<?php endif; ?>
<?php else: ?>
<?php if($isLeaveMaster == "Y" && $shifts != null): ?>
<?php $total_absent = $total_absent + 1;
$empDays[$cdate] = "A";
?>
<span style="color:red;font-weight:bold">A (Leave Rule)</span>
<?php else: ?>
<?php if($holiday != null): ?>
<?php $total_holiday = $total_holiday + 1;
$empDays[$cdate] = "H";
?>
<span style="color:#6572b8;font-weight:bold"><?php echo e($holiday->holidayName); ?></span>
<?php else: ?>
<?php if($shifts != null): ?>
<?php if($shifts->weekOff == "Y"): ?>
<?php $total_holiday = $total_holiday + 1;
$empDays[$cdate] = "H";?>
<span style="color:#007bff;font-weight:bold">Week Off</span>
<?php else: ?>
<?php if(isset($shifts->fromTime) && isset($shifts->toTime)): ?>
<?php if($arrival['status'] == "I" && $departure['status'] == "I"): ?>
<?php $total_absent = $total_absent + 1;
$empDays[$cdate] = "A";
?>
<span style="color:red;font-weight:bold">A</span>
<?php else: ?>
<?php $empDays[$cdate] = "P";?>
<br><span style="color:black;font-weight:bold">Shift : <?php echo e(Carbon\Carbon::parse($shifts->fromTime.' '.$dayNight)->format('H:i').'-'.Carbon\Carbon::parse($shifts->toTime.' '.$nightDay)->format('H:i')); ?></span><br>
<!-- Late Master and IN Time -->
<?php if($arrival['status'] == "I"): ?>
<?php echo $arrival['html']; ?>
<?php elseif($arrival['status'] == "HF"): ?>
<?php echo $arrival['html']; ?>
<?php echo $arrival['late_html']; ?>
<?php elseif($arrival['status'] == "LT"): ?>
<?php echo $arrival['html']; ?>
<?php echo $arrival['late_html']; ?>
<?php elseif($arrival['status'] == "P"): ?>
<?php echo $arrival['html']; ?>
<?php endif; ?>
<?php if($arrival['status'] == "A"): ?>
<?php $total_absent = $total_absent + 1;
$empDays[$cdate] = "AB";?>
<?php echo $arrival['html']; ?>
<?php echo $arrival['late_html']; ?>
<?php elseif($departure['status'] == "A"): ?>
<?php $total_absent = $total_absent + 1;
$empDays[$cdate] = "AB";?>
<?php echo $departure['html']; ?>
<?php echo $departure['late_html']; ?>
<?php elseif($departure['status'] == "P" && $arrival['status'] == "P"): ?>
<?php $total_present = $total_present + 1; ?>
<?php elseif( ( $departure['status'] == "LT" || $departure['status'] == "P") && ( $arrival['status'] == "LT" || $arrival['status'] == "P")): ?>
<?php $total_present = $total_present + 1; ?>
<?php elseif($departure['status'] == "HF" || $arrival['status'] == "HF"): ?>
<?php $total_present = $total_present + 0.5; ?>
<?php endif; ?>
<!-- Early Going and OUT Time -->
<?php if($departure['status'] == "I"): ?>
<?php echo $departure['html']; ?>
<?php elseif($departure['status'] == "HF"): ?>
<?php echo $departure['html']; ?>
<?php echo $departure['late_html']; ?>
<?php elseif($departure['status'] == "LT"): ?>
<?php echo $departure['html']; ?>
<?php echo $departure['late_html']; ?>
<?php elseif($departure['status'] == "P"): ?>
<?php echo $departure['html']; ?>
<?php endif; ?>
<!-- Overtime and OUT Time -->
<?php if($overtime['status'] == "Y"): ?>
<?php echo $overtime['html']; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php else: ?>
<span style="color:#dc3545;font-weight:bold">No Shift</span>
<?php endif; ?>
<?php endif; ?>
<!-- Leave master -->
<?php endif; ?>
<?php endif; ?>
</td>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<td><?php echo e($total_present); ?></td>
<td><?php echo e($total_absent); ?></td>
<td><?php echo e($total_holiday); ?></td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
<?php else: ?>
<p style="color:red;"><strong>To get Attendance Report please go to 'Advance Search' and select Month.</strong></p>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
$('select[name="idDepartment"]').on('change', function() {
var departmentID = $(this).val();
if(departmentID) {
$.ajax({
url: "<?php echo e(url('/school/departments')); ?>"+'/' +departmentID + "/designations",
type: "GET",
dataType: "json",
success:function(data) {
$('#idDesignation').empty();
$('#idDesignation').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-all" id="selectall"></div>');
$.each(data, function(key, value) {
$('#idDesignation').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:100px;">'+value+'</label><input type="checkbox" name="designations[]" value="'+key+'" class="designationclass"></div>');
});
}
});
}else{
$('select[name="idDesignation"]').empty();
}
});
});
$(document).on('click', '.select-all', function(){
var checkAll = this.checked;
if(checkAll === true){
$('input[type=checkbox]').each(function () {
this.checked = checkAll;
});
var designationIds = [];
$("input:checkbox[name='designations[]']:checked").each(function () {
designationIds.push($(this).val());
});
if (designationIds.length > 0) {
$.ajax({
url: "<?php echo e(url('/school/designations')); ?>"+'/' +designationIds + "/employees",
type: "GET",
dataType: "json",
success:function(data) {
$('#idEmployee').empty();
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-allstd" id="selectallstd"></div>');
$.each(data, function(key, value) {
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:50px;">'+value+'</label><input type="checkbox" name="employees[]" value="'+key+'" class="empallselect"></div>');
});
}
});
}
}else{
$('#idEmployee').empty();
$('input[type=checkbox]').each(function () {
this.checked = checkAll;
});
}
});
$(document).on('click', '.designationclass', function(){
var designationIds = [];
$("input:checkbox[name='designations[]']:checked").each(function () {
designationIds.push($(this).val());
});
if (designationIds.length > 0) {
$.ajax({
url: "<?php echo e(url('/school/designations')); ?>"+'/' +designationIds + "/employees",
type: "GET",
dataType: "json",
success:function(data) {
$('#idEmployee').empty();
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-allstd" id="selectallstd"></div>');
$.each(data, function(key, value) {
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:50px;">'+value+'</label><input type="checkbox" name="employees[]" value="'+key+'" class="empallselect"></div>');
});
}
});
}else{
$('#idEmployee').empty();
}
});
$(document).on('click', '.select-allstd', function(){
var checkAllstd = this.checked;
if(checkAllstd === true){
$("input:checkbox[name='employees[]']").each(function () {
this.checked = checkAllstd;
});
}else{
$('.empallselect').each(function () {
this.checked = checkAllstd;
});
}
});
$(function () {
$('.tableexp').DataTable({
'lengthMenu': [[25, 50, 100, - 1], [25, 50, 100, "All"]],
dom: 'Bfrtip',
scrollY: "500px",
scrollX: true,
scrollCollapse: true,
fixedColumns: {
left: 1
},
buttons: [
'csv', 'excel', 'pdf', 'print'
]
});
});
$('.dateselector').datepicker({
autoclose: true,
autoWidth: false,
format: 'dd-mm-yyyy',
endDate: '+0d',
orientation: 'auto'
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -