IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/hrms/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/hrms/empmonthly_attendance.blade.php

@extends('schools.school_layout')
@section('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">
                                    {!! Form::open(['method' => 'GET',  'action' => ['School\EmpAttendanceController@monthlyAttendance'], '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">
                                                        {!! Form::select('idDepartment',$departments,null,['class' => 'form-control show-tick ms']) !!}
                                                        @if ($errors->has('idDepartment'))
                                                        <label id="minmaxlength-error" class="error" for="minmaxlength">
                                                            <strong>{{ $errors->first('idDepartment') }}</strong>
                                                        </label>
                                                        @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>
                                                        @foreach ($designation as $key =>$value)
                                                        <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>
                                                        @endforeach
                                                        </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">
                                                {!! 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">
                                                {!! Form::select('idMonth',getMonths(),$current_month->idMonth,['class' => 'form-control show-tick ms']) !!}
                                                @if ($errors->has('idMonth'))
                                                <label id="minmaxlength-error" class="error" for="minmaxlength">
                                                    <strong>{{ $errors->first('idMonth') }}</strong>
                                                </label>
                                                @endif
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row clearfix">
                                        <div class="col-sm-8 offset-sm-2">
                                            {!! Form::submit('SHOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                                            {!! 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">

            <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 (MONTHLY)</strong></h2></div>
                        <div class="body table-responsive">
                            @if(isset($month))
                            @if(count($employees)>0)
                            <table class="table table-bordered table-striped table-hover dataTable tableexp">
                                <thead>
                                    <tr>
                                        <th>EC No.</th>
                                        <th>Name</th>
                                        @foreach($days as $key=>$var)
                                        <th>
                                            @if($var[1] == 'SUNDAY')
                                            <span style="color:green; font-weight: bold;">{{ Carbon\Carbon::parse($var[0])->format('d-m')}}</span>
                                            @elseif($var[1]!=null && $var[1]!='SUNDAY')
                                            <span style="color:green; font-weight: bold;">{{Carbon\Carbon::parse($var[0])->format('d-m')}}</span>
                                            @else
                                            {{Carbon\Carbon::parse($var[0])->format('d-m')}}
                                            @endif
                                        </th>
                                        @endforeach
                                       
                                        <th>TP</th>
                                        <th>TA</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach($employees as $emp)
                                    <tr>
                                          <?php 
                                                $total_present = 0; 
                                                $total_absent = 0; 
                                                ?>
                                        <td>{{$emp->enrollmentNo}}</td>
                                        <td>{{$emp->firstName}} {{$emp->middleName}} {{$emp->lastName}}</td>
                                        @foreach($days as $key=>$var)
                                            <td>
                                                 <?php
                                                   $tdate = Carbon\Carbon::parse($var[0]);
                                                   $now = Carbon\Carbon::now();
                                                   $jdate = $tdate->format('Y-m-d');
                                                   $length = $tdate->diffInDays($now);
                                                   $doSpecialShiftExisits = DB::table('special_shifts')->where('idEmployee', '=', $emp->idEmployee)->where('shift_date',$jdate)->where('type','S')->first();

                                                    $holiday = getHoliday($emp,$jdate);            

                                                    $pholiday = \App\HrmsHoliday::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
                                                                ->where('idEmployee',$emp->idEmployee)
                                                                ->whereDate('fromDate', '<=', $jdate)
                                                                ->whereDate('toDate', '>=', $jdate)
                                                                ->first();            
                                                   
                                                    $aintime = \App\EmpAttendance::where('Enrollment_Number', '=', $emp->enrollmentNo)
                                                            ->where('Device_ID', '=', $school->Device_ID)
                                                            ->whereDate('date', '=', $jdate)
                                                            ->where('status', '=', 'IN')
                                                            ->where('idType', '=', 'A')
                                                            ->first();
                                                    $aouttime = \App\EmpAttendance::where('Enrollment_Number', '=', $emp->enrollmentNo)
                                                            ->where('Device_ID', '=', $school->Device_ID)
                                                            ->whereDate('date', '=', $jdate)
                                                            ->where('status', '=', 'OUT')
                                                            ->where('idType', '=', 'A')
                                                            ->first();
                                                    $a_mat = \App\EmpAttendance::where('Enrollment_Number', '=', $emp->enrollmentNo)
                                                            ->where('idSchool', '=', $school->idSchool)
                                                            ->whereDate('date', '=', $jdate)
                                                            ->where('idType', '=', 'M')
                                                            ->first();

                                                    if($doSpecialShiftExisits != null){
                                                        $var[1] = null;
                                                    }        
 
                                                   ?>
                                                    @if($holiday != null || $pholiday != null)
                                                    <span style="color:#6572b8;font-weight:bold">@if($holiday != null) {{$holiday->holidayName}} @else {{$pholiday->holidayName}} @endif </span>
                                                    @elseif($var[1] == 'SUNDAY')
                                                    <span>{{$var[1]}}</span>
                                                    @elseif($var[1]!=null && $var[1]!='SUNDAY')
                                                    <span>{{$var[1]}}</span>
                                                    @elseif($aintime || $aouttime)
                                                    <span style="color:green;font-weight:bold">P</span><br>
                                                     <?php $total_present = $total_present + 1; ?>
                                                    @if($aintime)
                                                    <span style="color:green;font-weight: bold">IN: {{explode(" ",$aintime->TimeStamp)[1]}}</span><br>
                                                    @endif
                                                    @if($aouttime)
                                                    <span style="color:red;font-weight: bold">OUT: {{explode(" ",$aouttime->TimeStamp)[1]}}</span>
                                                    @endif
                                                    @elseif($a_mat)
                                                    <span style="color:green;font-weight:bold">P</span>
                                                     <?php $total_present = $total_present + 1; ?>
                                                    @elseif($jdate <= $todaydate)
                                                    <span style="color:red;font-weight:bold">A</span>
                                                     <?php $total_absent = $total_absent + 1; ?>
                                                    @else
                                                    <span style="color:red;font-weight:bold"></span>
                                                   @endif
                                            </td>
                                        @endforeach 
                                        <td>{{$total_present}}</td>
                                        <td>{{$total_absent}}</td>
                                    </tr>
                                    @endforeach
                                </tbody>

                            </table>
                            @else
                            <p style="color:red;"><strong>To get Attendance Report please go to 'Advance Search' and select Month.</strong></p>
                            @endif
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@stop
@section('script')
<script>
$(document).ready(function() {
    $('select[name="idDepartment"]').on('change', function() {
        var departmentID = $(this).val();
        if(departmentID) {
            $.ajax({
                url: "{{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: "{{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: "{{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>
@stop

Copyright © 2021 - 2025 IMMREX7