384 lines
12 KiB
PHP
Executable File
384 lines
12 KiB
PHP
Executable File
<?php
|
|
$sample = array_merge($month,$fresh);
|
|
$ex = explode('-',$dropdownvalue);
|
|
|
|
if(strlen($ex[0])== '2')
|
|
{
|
|
if($ex[0] < 10)
|
|
{
|
|
$ex1 = substr($ex[0],1);
|
|
}
|
|
else{
|
|
$ex1 = $ex[0];
|
|
}
|
|
}
|
|
else{
|
|
$ex1 = $ex[0];
|
|
}
|
|
|
|
$drop = $ex1.'-'.$ex[1];
|
|
?>
|
|
|
|
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
|
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
|
|
|
<script>
|
|
|
|
$('html').bind('keypress', function(e)
|
|
{
|
|
//alert('Key Pressed');
|
|
if(e.keyCode == 13)
|
|
{
|
|
return false;
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
<style type="text/css">
|
|
.num {
|
|
text-align:right;
|
|
}
|
|
</style>
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Employee Monthly Payment Listing</center>
|
|
</h1>
|
|
</section>
|
|
<section class="content">
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<!--<center><h3 class="box-title">-->
|
|
<div class="box-tools">
|
|
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
|
|
<p><b>The <span style="background-color:#ff4d4d;">Red</span> highlighted Employee have loan to pay. Put <span style="background-color:#66ff33;">'NA'</span> for Skip Current Month Loan Due.</b></p>
|
|
<form action="<?php echo base_url() ?>monthlypay/monthlyListing" method="POST" id="searchList">
|
|
|
|
</form>
|
|
</div><!--</h3></center>-->
|
|
|
|
</div><!-- /.box-header -->
|
|
<?php
|
|
|
|
$year = date("Y");
|
|
$current = date("m-Y");
|
|
$month = date("m");
|
|
if($month < 10)
|
|
{
|
|
$month = substr($month,1);
|
|
}
|
|
$currentselection = $month . "-" . $year;
|
|
$options = array();
|
|
$monthsoptions = array("1" => "Jan", "2" => "Feb","3" => "Mar","4" => "Apr","5" => "May","6" => "June","7"=> "July","8"=> "Aug","9" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec");
|
|
|
|
$currentmontharray = array(array($month."-".$year => $monthsoptions[$month]."-".$year));
|
|
// For find out Next and previous month and year from current year
|
|
$aftersix = array();
|
|
for ($i = 0; $i <3;$i++){
|
|
|
|
$month++;
|
|
if($month > 12)
|
|
{
|
|
$month = 1;
|
|
$year = $year +1;
|
|
}
|
|
|
|
$aftersix[]=array($month."-".$year => $monthsoptions[$month]."-".$year);
|
|
|
|
}
|
|
|
|
$year = date("Y");
|
|
$month = date("m");
|
|
|
|
$beforesix = array();
|
|
for ($i = 3; $i >0;$i--){
|
|
|
|
$month--;
|
|
if($month < 1 )
|
|
{
|
|
$month = 12;
|
|
$year = $year - 1;
|
|
}
|
|
|
|
$beforesix[]=array($month."-".$year => $monthsoptions[$month]."-".$year);
|
|
|
|
}
|
|
|
|
$beforesix = array_reverse($beforesix);
|
|
|
|
|
|
$options = array_merge($options,$beforesix);
|
|
//echo count($options);
|
|
|
|
$options = array_merge($options,$currentmontharray);
|
|
$options = array_merge($options,$aftersix);
|
|
|
|
$ot = array();
|
|
foreach($options as $o)
|
|
{
|
|
|
|
foreach($o as $key => $value)
|
|
{
|
|
|
|
$ot[$key] = $value;
|
|
|
|
}
|
|
|
|
}
|
|
?>
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<form id="formid">
|
|
<?php echo form_dropdown('monthyear',$ot,set_value('monthyear',$currentselection),'id="monthyear"' ,'class="form-control select2');?>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="box-body">
|
|
<table id="monthlylistings" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color:#ddf">
|
|
<tr>
|
|
|
|
<th>S.No</th>
|
|
<th>Employee Id</th>
|
|
<th>Employee Name</th>
|
|
<th>Days Worked</th>
|
|
<th>LOP Days</th>
|
|
<th>Paid Leave</th>
|
|
<th>OT Hours Worked in Hrs</th>
|
|
<th>Loan Recovered in ₹</th>
|
|
|
|
<th>Incentives in ₹</th>
|
|
<th>Other Deductions in ₹</th>
|
|
<th>Festival Bonus in ₹</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
|
|
$index=0;
|
|
$testarray=array();
|
|
|
|
|
|
|
|
if(!empty($sample))
|
|
{
|
|
|
|
foreach($sample as $record)
|
|
{
|
|
|
|
$index++;
|
|
|
|
if(in_array($record->EmpID,$testarray))
|
|
{
|
|
$index--;
|
|
|
|
|
|
}
|
|
else{
|
|
|
|
|
|
array_push($testarray,$record->EmpID);
|
|
|
|
|
|
|
|
?>
|
|
|
|
<tr>
|
|
<td style="text-align:right;" style="background-color:blue;"><?php echo $index; ?></td>
|
|
<td style="text-align:right;"><?php echo $record->EmpID ?></td>
|
|
<td><?php echo $record->FirstName ." ". $record->LastName ?></td>
|
|
<td <?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Days_worked)){echo $record->Days_worked;}else{echo "0.00";}?></td>
|
|
<td <?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?></td>
|
|
<td <?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Paid_leave)){echo number_format($record->Paid_leave,2,'.','');}else { echo number_format(0.00,2,'.','');} ?></td>
|
|
<td <?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?></td>
|
|
<td <?php if(empty($record->Key) && !empty($record->Loan_ID)){ echo "contenteditable='true'; style='background-color:#ffcccc;text-align:right' title='Loan Pending'"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Loan_Recovered)){if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?></td>
|
|
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Incentives)){echo $record->Incentives;}else{ echo number_format(0.00,2,'.','');;} ?></td>
|
|
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?></td>
|
|
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Festival_Bonus)){echo $record->Festival_Bonus; }else{ echo number_format(0.00,2,'.','');;} ?></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<p> </p>
|
|
<div class="row">
|
|
<div class="col-md-3" id="savebutton">
|
|
<input type="button" id="submit" value = "Save" class="btn btn-primary" onclick="getAllData();">
|
|
</div>
|
|
</div>
|
|
</div><!-- /.box-body -->
|
|
<!-- <div class="box-footer clearfix">
|
|
|
|
</div> -->
|
|
</div><!-- /.box -->
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
|
|
|
|
/* $('#monthlylisting').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"aaSorting": [[ 0, "asc" ]],
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
}); */
|
|
|
|
var t = $('#monthlylistings').DataTable( {
|
|
"columnDefs": [ {
|
|
"searchable": false,
|
|
"orderable": false,
|
|
"targets": 0
|
|
} ],
|
|
"searching": true,
|
|
"lengthChange": true,
|
|
"info": true,
|
|
"paging": false,
|
|
"autoWidth": true,
|
|
"order": [[ 1, 'asc' ]]
|
|
} );
|
|
|
|
t.on( 'order.dt search.dt', function () {
|
|
t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
|
|
cell.innerHTML = i+1;
|
|
} );
|
|
} ).draw();
|
|
|
|
var s = "<?php echo $drop; ?>";
|
|
$('#monthyear').val(s);
|
|
|
|
savebuttonvalidation();
|
|
|
|
});
|
|
|
|
|
|
|
|
function getAllData()
|
|
{
|
|
|
|
var alldata = $("#monthlylistings").tableToJSON();
|
|
//alert(JSON.stringify(alldata));
|
|
alldata=JSON.stringify(alldata)
|
|
var month = $('#monthyear').val();
|
|
$('.content').loader('show');
|
|
$.ajax({
|
|
data:{param1:alldata,param2:month},
|
|
//dataType:"json",
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>payslip/saveMonthlyData",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('.content').loader('hide');
|
|
alert(data);
|
|
//console.log(data);
|
|
|
|
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
$("#monthyear").change(function(){
|
|
|
|
$s = $('#monthyear').val();
|
|
//echo $dropdownvalue;
|
|
//$('#monthyear').attr('selected',true);
|
|
//alert($s);
|
|
|
|
$("#formid").attr("method", "post");
|
|
//alert($s);
|
|
$("#formid").attr("action", "<?php echo base_url() ?>payslip/changeMonth");
|
|
|
|
$('#formid').submit();
|
|
|
|
|
|
});
|
|
function savebuttonvalidation()
|
|
{
|
|
var curselection = $("#monthyear").val();
|
|
//alert('current selection'+curselection);
|
|
var currentdate = new Date();
|
|
var currentmonth = currentdate.getMonth();
|
|
var currentyear = currentdate.getFullYear();
|
|
currentmonth++;
|
|
//alert('currentmonth'+currentmonth);
|
|
var res = curselection.split("-");
|
|
var selmonth = res[0];
|
|
var selyear = res[1];
|
|
//alert('current selec month '+ selmonth + 'current selec year '+ selyear);
|
|
var savebuttonstatus = currentmonth - selmonth;
|
|
var year = currentyear - selyear ;
|
|
//alert(selyear + currentyear);
|
|
if(savebuttonstatus >= 2)
|
|
{
|
|
if(year == 1)
|
|
{
|
|
$("#savebutton").hide();
|
|
}
|
|
else
|
|
{
|
|
$("#savebutton").hide();
|
|
}
|
|
}
|
|
else if(savebuttonstatus < 0 )
|
|
{
|
|
|
|
if(year == 1)
|
|
{
|
|
$("#savebutton").show();
|
|
}
|
|
else if(year == 0)
|
|
{
|
|
$("#savebutton").hide();
|
|
}
|
|
else
|
|
{
|
|
$("#savebutton").hide();
|
|
}
|
|
}
|
|
else if(savebuttonstatus == 0 && year == 0)
|
|
{
|
|
$("#savebutton").hide();
|
|
}
|
|
else if(savebuttonstatus == 1)
|
|
{
|
|
if(year == 0 || year == 1)
|
|
{
|
|
$("#savebutton").show();
|
|
}
|
|
else
|
|
{
|
|
$("#savebutton").show();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
</script>
|