IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/36ff46bbabfb32638aa78b20ff07c9be3167f992.php

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-lg-12 col-md-12 col-sm-12">
        <!--<div class="card">-->
        <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>Generate Salary</strong></h2>
                                </div>
                                <div class="body">
                                    <?php echo Form::open(['method' => 'GET',  'action' => ['School\EmpPaymentController@salaryGeneration'], 'class' => 'form-horizontal']); ?>

                                    <div class="row clearfix">
                                        <div class="col-sm-2 form-control-label required">
                                            <label for="classname">Department</label>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">
                                                <?php echo Form::select('idDepartment',$departments,null,['class' => 'form-control show-tick ms select2']); ?>

                                                <?php if($errors->has('idDepartment')): ?>
                                                <label id="minmaxlength-error" class="error" for="minmaxlength">
                                                    <strong><?php echo e($errors->first('idDepartment')); ?></strong>
                                                </label>
                                                <?php endif; ?>
                                                <span id='depterror'></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-2 form-control-label">
                                            <label for="classname">Designation</label>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">
                                                <div id="idDesignation" style="border:1px solid #ccc; width:200px; height: 110px; overflow-y: scroll;">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row clearfix">
                                        <div class="col-sm-2 form-control-label">
                                            <label for="classname">EC No.</label>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">
                                                <div id="idEmployee" style="border:1px solid #ccc; width:250px; height: 140px; overflow-y: scroll;">

                                                </div>
                                                
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row clearfix">
                                        <div class="col-sm-8 offset-sm-2">
                                            <?php echo Form::submit('Search',['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-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Generate Salary</strong></h2>
            </div>
            <div class="body table-responsive">
                <?php echo Form::open(['method' => 'GET',  'action' => ['School\EmpPaymentController@salaryGeneration'], 'class' => 'form-horizontal']); ?>

                <div class="row clearfix" style="margin-bottom:30px;">
                    <div class="col-sm-12">
                        <div class="row clearfix">
                            <?php if($errors->has('employee')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('employee')); ?></strong>
                            </label>
                            <?php endif; ?>
                            <div class="col-sm-2">
                                <label><strong>Select a FY (Financial Year)</strong></label>
                            </div>
                            <div class="col-sm-3">
                                <?php echo Form::select('fy',fys(),Session::get('idFinancialYear'),['class' => 'form-control show-tick ms','required'=>'required']); ?>

                                <?php if($errors->has('fy')): ?>
                                 <label id="minmaxlength-error" class="error" for="minmaxlength">
                                     <strong><?php echo e($errors->first('fy')); ?></strong>
                                 </label>
                                 <?php endif; ?>
                            </div>
                            <div class="col-sm-2">
                                <label><strong>Select a Month &amp; Year</strong></label>
                            </div>
                            <div class="col-sm-3">
                                <?php echo Form::select('idMonth',getMonths(),null,['class' => 'form-control show-tick ms','required'=>'required']); ?>

                                <?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']); ?>

                                <?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 class="col-sm-2">
                                <input type="submit" value="GENERATE" class="btn btn-raised btn-success btn-round waves-effect">
                            </div>
                        </div>
                    </div>
                </div>
                <?php echo Form::close(); ?>

                <?php $employeeId = array(); ?>

                <?php if(isset($financialYear) && isset($month)): ?>
                    <button class="btn btn-raised btn-success btn-round waves-effect" id="print_data" onclick="printData()"> Print Salary Data</button>
                <?php endif; ?>
                <?php if(isset($financialYear) && isset($month)): ?>
                    <?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $ifSalaryExists = \App\EmpPayment::where('idMonth',$month)->where('idFinancialYear',$financialYear)->where('idSchool',Auth::guard('school')->user()->idSchool)->where('idEmployee', $value->idEmployee)->first();
                        if($ifSalaryExists == null){
                            $emp_shift = \App\AssignShift::where('idEmployee', '=', $value->idEmployee)->first(); 
                            if( $emp_shift != null){
                                $shift = \App\Shift::where('idShift', '=', $emp_shift->idShift)->first();
                            }
                            $emp_salstr = \App\SalaryStructure::where('idEmployee', '=', $value->idEmployee)->where('idFinancialYear', '=', $financialYear)->first();
                            if($emp_salstr != null){
                                $deductions = \App\SalaryStrDeduction::where('idSalaryStr', '=', $emp_salstr->idSalaryStr)->get();
                                $earnings = \App\SalaryStrAllowances::where('idSalaryStr', '=', $emp_salstr->idSalaryStr)->get();
                                if($emp_shift != null)
                                array_push($employeeId,$value->idEmployee);
                            }
                        }
                    ?>
                    <?php if($ifSalaryExists == null): ?>
                    <div class="row clearfix" <?php if($emp_shift == null || $emp_salstr  == null): ?> style="opacity: 0.5;" <?php endif; ?> >
                        <div class="col-md-12">
                            <div class="card project_widget" style="border: solid #c1c1c1 1px;">
                                    <div class="pw_content">
                                        <div class="pw_header row">
                                            <div class="col-md-6">    
                                                <h6><?php echo e($value->firstName); ?> <?php echo e($value->middleName); ?>  <?php echo e($value->lastName); ?></h6>
                                                <span style="color:black;">Enrollment No : <?php echo e($value->enrollmentNo); ?></span><br>
                                                <span style="color:black;">Department :  <?php echo e(isset($value->department->departmentName) ? $value->department->departmentName : ''); ?></span> | 
                                                <span style="color:black;">Designation :  <?php echo e(isset($value->designation->designationName) ? $value->designation->designationName : ''); ?></span><br>
                                                <span style="color:black;">Mobile :  <?php echo e($value->mobile); ?></span><br>
                                                
                                                <?php if(isset($emp_shift)): ?>
                                                    <?php if(isset($shift)): ?>
                                                    <span style="color:black;">Allocates Shift Name :  <b><?php echo e($shift->shiftName); ?></b></span>
                                                    <?php endif; ?>
                                                <?php else: ?>
                                                    <span style="color:red;">No shift allocated</span><br>
                                                <?php endif; ?>
                                            </div>
                                            <div class="col-md-6">    
                                                <h6>Earnings</h6>
                                                <?php if(isset($emp_salstr)): ?>
                                                <?php $__currentLoopData = $earnings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $earning): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php $allowance = \App\Allowance::where('idAllowance', '=', $earning->idAllowance)->first(); ?>
                                                    <?php if($allowance != null): ?>
                                                    <span style="color:black;"><?php echo e($allowance->allowanceName); ?> :  <?php echo e($earning->amount); ?></span><br>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                
                                                <?php else: ?>
                                                <span style="color:red;">No salary structure found</span><br>
                                                <?php endif; ?>
                                                
                                            </div>
                                        </div>
                                        <div class="pw_meta row">
                                            <div class="col-md-6"> 
                                                <h6>Attendance Summary</h6>  
                                                <span id="<?php echo e($value->idEmployee); ?>_p">Full Present (Including All Holidays) : <?php if($emp_shift != null && $emp_salstr  != null): ?> <small class="text-muted">Generating please wait..</small> <?php else: ?> NA <?php endif; ?></span>
                                                <span id="<?php echo e($value->idEmployee); ?>_ab">Total Absent : <?php if($emp_shift != null && $emp_salstr  != null): ?> <small class="text-muted">Generating please wait..</small> <?php else: ?> NA <?php endif; ?></span>
                                                <span id="<?php echo e($value->idEmployee); ?>_hf">Half Day : <?php if($emp_shift != null && $emp_salstr  != null): ?> <small class="text-muted">Generating please wait..</small> <?php else: ?> NA <?php endif; ?></span>
                                                <span id="<?php echo e($value->idEmployee); ?>_ia">Incomplete Attendance : <?php if($emp_shift != null && $emp_salstr  != null): ?> <small class="text-muted">Generating please wait..</small> <?php else: ?> NA <?php endif; ?></span>
                                                <span id="<?php echo e($value->idEmployee); ?>_pl">Paid Leave : <?php if($emp_shift != null && $emp_salstr  != null): ?> <small class="text-muted">Generating please wait..</small> <?php else: ?> NA <?php endif; ?></span>
                                                <span id="<?php echo e($value->idEmployee); ?>_leave">Leave :<?php if($emp_shift != null && $emp_salstr  != null): ?> <small class="text-muted">Generating please wait..</small> <?php else: ?> NA <?php endif; ?> </span>
                                                <?php if(isset($month)): ?>

                                                <a href="<?php echo e(url('school/empattendance-report')); ?>?employees[]=<?php echo e($value->idEmployee); ?>&year=<?php echo e($year); ?>&idMonth=<?php echo e($month); ?>" target="_blank">Click here to view attendance</a>
                                                <?php else: ?>
                                                <span style="color:red;">Select a month to view attendance</span>
                                                <?php endif; ?>
                                            </div>    
                                            <div class="col-md-6">   
                                                <h6>Deduction</h6>  
                                                <?php if(isset($emp_salstr)): ?>
                                                <?php $__currentLoopData = $deductions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $deduction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php $deductionName = \App\Deduction::where('idDeduction', '=', $deduction->idDeduction)->first(); ?>
                                                    <?php if($deductionName != null): ?>
                                                    <span style="color:black;"><?php echo e($deductionName->deductionName); ?> :  <?php echo e($deduction->amount); ?> (<?php echo e(isset($deduction->deduction_type) ? $deduction->deduction_type : ''); ?>) </span><br>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <?php else: ?>
                                                <span style="color:red;">No salary structure found</span><br>
                                                <?php endif; ?>
                                                <span id="<?php echo e($value->idEmployee); ?>_salary"><?php if($emp_shift != null && $emp_salstr  != null): ?> <small class="text-muted">Generating please wait..</small> <?php else: ?> NA <?php endif; ?></span>
                                                <small class="text-muted">Total Payable Amount</small>
                                                <div id="<?php echo e($value->idEmployee); ?>_gen"></div>
                                            </div>    
                                        </div>
                                    </div>
                            </div>
                        </div>
                    </div>
                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
<?php if(isset($financialYear) && isset($month)): ?>
function printData(){
    const url = window.location.href;
    window.location.href = url.replace("salgen", "salgen-print");;
}
<?php endif; ?>

function fetchEmployees(posi){
    var idEmployee = <?php echo json_encode($employeeId);?>;
    var createRequestObject = {};
    <?php if(isset($financialYear)): ?>
    createRequestObject["fy"] = "<?php echo e($financialYear); ?>";
    <?php endif; ?>
    <?php if(isset($month)): ?>
    createRequestObject["idMonth"] = "<?php echo e($month); ?>";
    createRequestObject['year'] ="<?php echo e($year); ?>";
    createRequestObject["idEmployee"] = idEmployee[posi];
    createRequestObject["pos"] = posi;
    if(idEmployee.length > posi){
        $.ajax({
            type: "POST",
            beforeSend: function(request) {
                request.setRequestHeader("X-CSRF-TOKEN", "<?php echo e(csrf_token()); ?>");
                request.setRequestHeader('Content-Type', 'application/json');
            },
            url: "<?php echo e(url('/school/salgen')); ?>",
            data: JSON.stringify({
                fy : createRequestObject["fy"],
                idMonth : createRequestObject["idMonth"],
                idEmployee : createRequestObject["idEmployee"],
                pos : createRequestObject["pos"],
                year :  createRequestObject['year']
            }),
            processData: false,
            success: function(msg) {
                $("#"+msg.data.idEmployee+"_p").html("Full Present (Including All Holidays) : "+msg.data.present);
                $("#"+msg.data.idEmployee+"_ab").html("Total Absent : "+msg.data.absent);
                $("#"+msg.data.idEmployee+"_hf").html("Half Day : "+msg.data.half_day);
                $("#"+msg.data.idEmployee+"_ia").html("Incomplete Attendance : "+msg.data.incomplete);
                $("#"+msg.data.idEmployee+"_pl").html("Paid Leave : "+msg.data.paid_leave);
                $("#"+msg.data.idEmployee+"_leave").html("Leave : "+msg.data.leave);
                $("#"+msg.data.idEmployee+"_salary").html("INR "+msg.data.salary);
                if(msg.data.btEnable == 1){
                    $("#"+msg.data.idEmployee+"_gen").html('<button class="btn btn-primary" id="'+msg.data.idEmployee+'_bt" onclick="generateSalary('+msg.data.idEmployee+','+createRequestObject["idMonth"]+','+createRequestObject["fy"]+','+createRequestObject["year"]+')">Confirm and Generate Salary</button>');
                }else $("#"+msg.data.idEmployee+"_gen").empty();                
                var currentPos = +msg.data.pos + 1;
                fetchEmployees(currentPos);
            }
        });
    }else{
        $('#print_data').show();
    }
    
    <?php endif; ?>
}

function generateSalary(idEmployee,month,fy,year){
    $("#"+idEmployee+"_bt").text('Generating please wait..');
    $("#"+idEmployee+"_bt").prop('disabled', true);
    $.ajax({
            type: "POST",
            beforeSend: function(request) {
                request.setRequestHeader("X-CSRF-TOKEN", "<?php echo e(csrf_token()); ?>");
                request.setRequestHeader('Content-Type', 'application/json');
            },
            url: "<?php echo e(url('/school/pay-salary')); ?>",
            data: JSON.stringify({
                fy : fy,
                idMonth : month,
                year : year,
                employees : idEmployee
            }),
            processData: false,
            success: function(msg) {
                $("#"+msg.data.idEmployee+"_gen").empty();
                $("#"+msg.data.idEmployee+"_gen").html('<a href="<?php echo e(url('school/emppayments')); ?>" target="_blank">Click to view generated salary</a>');
            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert("Failed to generate salary");
                $("#"+idEmployee+"_bt").text('Confirm and Generate Salary');
                $("#"+idEmployee+"_bt").prop('disabled', false);
            }
    });
}

$('.selectAll').on('click', function () {
       var checkAll = this.checked;
       if(checkAll === true){
            $('input[type=checkbox]').each(function () {
                 this.checked = checkAll;
            });
        }else{
           $('input[type=checkbox]').each(function () {
                this.checked = checkAll;
            });   
        }
});
$(document).ready(function() {
    $('#print_data').hide();
    $('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();
        }
    });
    fetchEmployees(0);
});
$(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;
            });
        }
});


</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7