IMMREX7
<?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>Salary Pay</strong></h2>
</div>
<div class="body">
<?php echo Form::open(['method' => 'GET', 'action' => ['School\EmpPaymentController@index'], '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 class="col-sm-2 form-control-label required">
<label for="classname">Month</label>
</div>
<div class="col-sm-3">
<?php echo Form::select('idMonth',getMonths(),null,['class' => 'form-control show-tick ms','required'=>'required']); ?>
<?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 class="row clearfix">
<div class="col-sm-2">
</div>
<div class="col-sm-3">
</div>
<div class="col-sm-2 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','2026'=>'2026','2021'=>'2021','2022'=>'2022','2023'=>'2023','2020'=>'2020','2019'=>'2019'],null,['class' => 'form-control show-tick ms']); ?>
</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>Salary Pay</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover dataTable js-basic-example">
<thead>
<tr>
<th>S. No.</th>
<th>Enrollment No</th>
<th>Payment Date</th>
<th>Name</th>
<th>Department</th>
<th>Designation</th>
<th>Month</th>
<th>Mobile</th>
<th>Payment Mode</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<!-- if salary generated-->
<?php $salgen = \App\EmpPayment::where('idEmployee','=',$value->idEmployee)
->where('idFinancialYear','=', getFinancialYear())
->where('idMonth','=',$month->idMonth)->first()?>
<th scope="row"><?php echo e($i); ?></th>
<td><?php echo e($value->enrollmentNo); ?></td>
<td id="<?php echo e($value->idEmployee); ?>_pay_date"><?php if($salgen!=null): ?> <?php echo e(Carbon\Carbon::parse($salgen->payDate)->format('d-m-Y') or ''); ?> <?php endif; ?></td>
<td><?php echo e($value->firstName); ?> <?php echo e($value->middleName); ?> <?php echo e($value->lastName); ?></td>
<td><?php echo e(isset($value->department->departmentName) ? $value->department->departmentName : ''); ?></td>
<td><?php echo e(isset($value->designation->designationName) ? $value->designation->designationName : ''); ?></td>
<td><?php echo e($month->monthName); ?></td>
<td><?php echo e($value->mobile); ?></td>
<td id="<?php echo e($value->idEmployee); ?>_pay_mode"><?php if($salgen!=null): ?> <?php echo e(isset($salgen->paymentMode) ? $salgen->paymentMode : ''); ?> <?php endif; ?></td>
<td id="<?php echo e($value->idEmployee); ?>">
<?php if($salgen!=null && $salgen->isPaid == 'Y'): ?>
<p style="color:green;">Salary Paid</p>
<a href="<?php echo e(url('/school/empsalary/'.$salgen->idEmpPayment.'/'.$month->idMonth.'/printslip')); ?>" class="btn btn-sm btn-success" target="_blank">Print Salary Slip</a>
<button onClick="removeSlip(<?php echo e($value->idEmployee); ?>,<?php echo e($month->idMonth); ?>,<?php echo e(getFinancialYear()); ?>)" id="<?php echo e($value->idEmployee); ?>_bt" class="btn btn-sm btn-danger">Cancel Salary Slip</button>
<?php elseif($salgen!=null): ?>
<a href="<?php echo e(url('/school/empsalary/'.$salgen->idEmpPayment.'/'.$month->idMonth.'/pay')); ?>" class="btn btn-sm btn-warning">Pay Salary</a>
<button onClick="removeSal(<?php echo e($value->idEmployee); ?>,<?php echo e($month->idMonth); ?>,<?php echo e(getFinancialYear()); ?>)" id="<?php echo e($value->idEmployee); ?>_bt" class="btn btn-sm btn-danger">Delete</button>
<?php else: ?>
<span></span>
<?php endif; ?>
</td>
</tr>
<?php $i++; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
function removeSal(idEmployee,month,fy){
$("#"+idEmployee+"_bt").text('Deleting..');
$("#"+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/reset-pay')); ?>",
data: JSON.stringify({
fy : fy,
idMonth : month,
idEmployee : idEmployee
}),
processData: false,
success: function(msg) {
$("#"+msg.data.idEmployee).empty();
},
error: function (xhr, ajaxOptions, thrownError) {
alert("Failed to delete salary");
$("#"+idEmployee+"_bt").text('Delete');
$("#"+idEmployee+"_bt").prop('disabled', false);
}
});
}
function removeSlip(idEmployee,month,fy){
$("#"+idEmployee+"_bt").text('Cancelling..');
$("#"+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/reset-pay-slip')); ?>",
data: JSON.stringify({
fy : fy,
idMonth : month,
idEmployee : idEmployee
}),
processData: false,
success: function(msg) {
$("#"+msg.data.idEmployee).empty();
$("#"+msg.data.idEmployee+"_pay_date").empty();
$("#"+msg.data.idEmployee+"_pay_mode").empty();
$("#"+msg.data.idEmployee).html('<a href="'+msg.data.link+'" class="btn btn-sm btn-warning">Pay Salary</a>'+
'<button onClick="removeSal('+msg.data.idEmployee+','+msg.data.month+','+msg.data.fy+')" id="'+msg.data.idEmployee+'_bt" class="btn btn-sm btn-danger">Delete</button>');
},
error: function (xhr, ajaxOptions, thrownError) {
alert("Failed to delete salary slip");
$("#"+idEmployee+"_bt").text('Cancel Salary Slip');
$("#"+idEmployee+"_bt").prop('disabled', false);
}
});
}
$(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;
});
}
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -