823 lines
21 KiB
PHP
Executable File
823 lines
21 KiB
PHP
Executable File
<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 src="<?php echo base_url()?>assets/js/jquery.CongelarFilaColumna.js"></script>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
|
||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
|
||
|
||
<?php
|
||
// print_r($attendance);
|
||
// echo "<br>";
|
||
// echo count($attendance);
|
||
// echo "<br>";
|
||
// print_r($emppay);
|
||
// echo "<br>";
|
||
// echo count($emppay);
|
||
//print_r($datefordropdown);
|
||
//print_r($noofpublicholidays);print_r($publicholidaysarray);
|
||
$datefordropdown = date_create($datefordropdown);
|
||
$datefordropdown = date_format($datefordropdown,'M-Y');
|
||
//echo $datefordropdown;
|
||
$attendance = array_merge($attendance,$emppay);
|
||
date_default_timezone_set('Asia/Kolkata');
|
||
$currentday = date('d');
|
||
// print_r($attendance);
|
||
// echo "<br>------------------------------<br>";
|
||
|
||
?>
|
||
<style type="text/css">
|
||
.num {
|
||
text-align:right;
|
||
}
|
||
|
||
|
||
|
||
.fht-table,
|
||
.fht-table thead,
|
||
.fht-table tfoot,
|
||
.fht-table tbody,
|
||
.fht-table tr,
|
||
.fht-table th,
|
||
.fht-table td {
|
||
margin: 0;
|
||
}
|
||
|
||
.fht-table td {
|
||
text-align:center;
|
||
}
|
||
|
||
.fht-table td:hover {
|
||
background-color: #3c8dbc;
|
||
color:#ffffff;
|
||
}
|
||
|
||
.fht-table{
|
||
border: 0 none;
|
||
height: auto;
|
||
width: auto;
|
||
border-collapse: collapse;
|
||
border-spacing: 0;
|
||
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
||
/*white-space:nowrap; Impide los saltos de l<>nea autom<6F>ticos */
|
||
}
|
||
|
||
.fht-table th,.fht-table td {
|
||
overflow: hidden;
|
||
}
|
||
|
||
.fht-table-wrapper,
|
||
.fht-table-wrapper .fht-thead,
|
||
.fht-table-wrapper .fht-tfoot,
|
||
.fht-table-wrapper .fht-fixed-column .fht-tbody,
|
||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||
.fht-table-wrapper .fht-tbody {
|
||
overflow: hidden;
|
||
position: relative;
|
||
}
|
||
|
||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||
.fht-table-wrapper .fht-tbody {
|
||
overflow: auto;
|
||
}
|
||
|
||
.fht-table-wrapper .fht-table .fht-cell {
|
||
overflow: hidden;
|
||
height: 1px;
|
||
}
|
||
|
||
.fht-table-wrapper .fht-fixed-column,
|
||
.fht-table-wrapper .fht-fixed-body {
|
||
top: 0;
|
||
left: 0;
|
||
position: absolute;
|
||
}
|
||
|
||
.fht-table-wrapper .fht-fixed-column {
|
||
z-index: 1;
|
||
}
|
||
|
||
.fht-fixed-body .fht-thead table {
|
||
margin-right: 20px;
|
||
border: 0 none;
|
||
}
|
||
|
||
/*For Examples*/
|
||
|
||
.ContenedorTabla {
|
||
height: 500px;
|
||
margin: 0 auto;
|
||
overflow: auto;
|
||
width: auto;
|
||
position: relative;
|
||
}
|
||
|
||
.header, .main {
|
||
display: inline-block;
|
||
height: auto;
|
||
width: 100%;
|
||
}
|
||
.titulosHeader {
|
||
border-bottom: 1px solid #e8bb25;
|
||
height: auto;
|
||
margin-bottom: 10px;
|
||
padding-bottom: 8px;
|
||
padding-top: 8px;
|
||
width: 100%;
|
||
}
|
||
|
||
|
||
.celda_encabezado_general {
|
||
background-color: #3c8dbc;
|
||
border: 1px solid #ccc;
|
||
color: #ffffff;
|
||
font-weight: bold;
|
||
padding: 2px 4px;
|
||
text-align: center;
|
||
}
|
||
._Separador{
|
||
background-color: #fff;
|
||
height: 12px;
|
||
border-left: 1px solid #ccc;
|
||
border-right: 1px solid #ccc;
|
||
width: 7px;
|
||
}
|
||
._Separador div{
|
||
width: 4px;
|
||
}
|
||
.celda_normal {
|
||
/*background-color: #fff;*/
|
||
border: 1px solid #ccc;
|
||
padding: 2px 4px;
|
||
}
|
||
|
||
/*style excel*/
|
||
.excel_cell{
|
||
border: 1px solid #CCC;
|
||
color: #222;
|
||
text-align: center;
|
||
font-size: 13px
|
||
font-weight: normal;
|
||
padding: 4px;
|
||
white-space: pre-line;
|
||
empty-cells: show;
|
||
}
|
||
._cell_header{
|
||
background-color: #EEE;
|
||
}
|
||
._cell_Default{
|
||
background-color: #FFF;
|
||
text-align: left;
|
||
}
|
||
|
||
.excel_cell div{
|
||
width: 30px;
|
||
height: 20px;
|
||
}
|
||
|
||
.modal
|
||
{
|
||
padding-right:30% ! important;
|
||
}
|
||
|
||
</style>
|
||
<div class="content-wrapper">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
<h1>
|
||
<center>Employee Monthly Attendance View/Edit</center>
|
||
</h1>
|
||
</section>
|
||
<section class="content">
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-xs-12">
|
||
<div class="box">
|
||
<div class="box-header">
|
||
<div class="row">
|
||
<div class="col-md-2">
|
||
<?php
|
||
|
||
$attributes = array('id' => 'atten');
|
||
echo form_open('attendance', $attributes);
|
||
$today = date('M-Y');
|
||
$data = array('type' => 'text','name' => 'month','id' => 'month','value' => $datefordropdown,'class' => 'form-control select2');
|
||
echo form_input($data);?>
|
||
</div>
|
||
<div class="col-md-2">
|
||
<input type="submit" value="Change Month" class="btn btn-primary" title='click here for load attendance for specified month'>
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
</div><!-- /.box-header -->
|
||
|
||
|
||
<div class="box-body">
|
||
<?php
|
||
|
||
|
||
|
||
$testarray=array();
|
||
$finalarray = array();
|
||
if(!empty($attendance))
|
||
{
|
||
|
||
foreach($attendance as $record)
|
||
{
|
||
|
||
//$index++;
|
||
|
||
if(in_array($record->EmpID,$testarray))
|
||
{
|
||
//$index--;
|
||
|
||
|
||
}
|
||
else{
|
||
|
||
|
||
array_push($testarray,$record->EmpID);
|
||
array_push($finalarray,$record);
|
||
}
|
||
}
|
||
}
|
||
|
||
?>
|
||
|
||
|
||
|
||
<main class="main">
|
||
<div class="ContenedorTabla">
|
||
|
||
<table id="attendance" class="fht-table">
|
||
<thead>
|
||
|
||
<tr>
|
||
|
||
<th class="celda_encabezado_general" rowspan="2">S.NO</th>
|
||
<th class="celda_encabezado_general" rowspan="2">Employee ID</th>
|
||
<th style="background-color:#3c8dbc;color:#fff;border:5px" rowspan="2">Employee Name</th>
|
||
|
||
|
||
<?php
|
||
|
||
for ($col =1; $col <= $monthdays;$col++){
|
||
|
||
$flag =0;
|
||
$flag2 = 0;
|
||
$todayflag = 0;
|
||
|
||
if($col == $currentday)
|
||
{
|
||
$todayflag = 1;
|
||
|
||
}
|
||
foreach($sundayarray as $in) //For Find out Sundays($ind) from $monthdays array
|
||
{
|
||
if($in == $col)
|
||
{
|
||
$flag = 1;
|
||
}
|
||
}
|
||
$title = '';
|
||
foreach($publicholidaysarray as $h) //For Find out public holidays from $monthdays array
|
||
{
|
||
|
||
$temp = $h->H_Date;
|
||
$temp = substr($temp,8);
|
||
|
||
if($temp == $col)
|
||
{
|
||
$flag2 = 1;
|
||
//$title ="Public Holiday-" . str_replace(" ","_",$h->H_Name);
|
||
$title = str_replace(" ","_",$h->H_Name);
|
||
//echo $title;
|
||
}
|
||
}
|
||
|
||
?>
|
||
|
||
|
||
<th <?php if($flag2 == 1){ ?>
|
||
title = " <?php echo $title; ?> "
|
||
<?php } else if($flag == 1 ){ ?>
|
||
title = "sunday" <?php }?>
|
||
class="celda_encabezado_general"
|
||
<?php if($flag == 1 or $flag2 == 1)
|
||
{
|
||
echo "style='background: #f39c12 ;'";
|
||
}
|
||
else if($todayflag == 1)
|
||
{ echo "style='background: #dd99ff ;'"; } ?> >
|
||
<?php if($flag == 1 or $flag2 == 1)
|
||
{ echo "<font style='color:#ff0000;'>".$col."W<font>";}
|
||
else { echo $col."W"; } ?></th>
|
||
|
||
|
||
|
||
|
||
<th <?php if($flag2 == 1){ ?> title = " <?php echo $title; ?> " <?php } else if($flag == 1 ){ ?> title = "sunday" <?php }?> class="celda_encabezado_general" <?php if($flag == 1 or $flag2 == 1) { echo "style='background: #f39c12 ;'"; } else if($todayflag == 1){ echo "style='background: #dd99ff ;'"; }?> > <?php if($flag == 1 or $flag2 == 1){ echo "<font style='color:#ff0000;'>".$col."OT<font>";} else { echo $col."OT"; }?></th>
|
||
<?php
|
||
//echo $flag2;
|
||
$flag =0;
|
||
$flag2 =0;
|
||
$todayflag = 0;
|
||
}?>
|
||
<th class="celda_encabezado_general" >Total Hrs</th>
|
||
<th class="celda_encabezado_general" >OT Hrs</th>
|
||
<th class="celda_encabezado_general" >Paid Leave</th>
|
||
<th class="celda_encabezado_general" >Days Worked</th>
|
||
<th class="celda_encabezado_general" >Absent</th>
|
||
|
||
</tr>
|
||
|
||
</thead>
|
||
<tbody>
|
||
<?php $index = 0;
|
||
$row=0;
|
||
foreach($finalarray as $a){ $row++;$index++;?>
|
||
|
||
<tr id="<?php echo $row;?>">
|
||
<td width="45" height="45" class="celda_normal" ><?php echo $index;?></td>
|
||
<td width="79" height="45" class="celda_normal"><?php echo $a->EmpID;?></td>
|
||
<td width="80" height="45" class="celda_normal"><?php echo $a->FirstName.'-'.$a->LastName;?></td>
|
||
|
||
<?php for ($col =1; $col <= $monthdays;$col++){
|
||
$flag =0;
|
||
$flag2 = 0;
|
||
|
||
if($col == $currentday)
|
||
{
|
||
$todayflag = 1;
|
||
|
||
}
|
||
foreach($sundayarray as $in)
|
||
{
|
||
if($in == $col)
|
||
{
|
||
$flag = 1;
|
||
}
|
||
}
|
||
|
||
foreach($publicholidaysarray as $h) //For Find out public holidays from $monthdays array
|
||
{
|
||
|
||
$temp = $h->H_Date;
|
||
$temp = substr($temp,8);
|
||
$title = '';
|
||
//echo $temp.'-'.$col.'/';
|
||
if($temp == $col)
|
||
{
|
||
$flag2 = 1;
|
||
//$title ="Public_Holiday-" . str_replace(" ","_",$h->H_Name);
|
||
$title = str_replace(" ","_",$h->H_Name);
|
||
//echo $title;
|
||
}
|
||
}
|
||
$WH='WH'.$col;
|
||
$OT = 'OT'.$col;
|
||
|
||
?>
|
||
<td <?php if($flag2 == 1){ ?> title = " <?php echo $title; ?> " <?php } else if($flag == 1 ){ ?> title = "sunday" <?php }?> class="celda_normal" onkeyup="myFunction(this.parentNode.id,this.id,this.textContent);" id = "<?php echo $row.'row'.$col.'W';?>" <?php if($flag == 1 or $flag2 == 1){ echo "style='background: #f9cd86 ;'";} else if($todayflag == 1){ echo "style='background: #f7e6ff ;'"; }?> contenteditable = "true" tabindex="<?php echo $col;?>"> <?php if(!empty($a->$WH)){echo $a->$WH;} else { echo '0';}?></td>
|
||
<td <?php if($flag2 == 1){ ?> title = " <?php echo $title; ?> " <?php } else if($flag == 1 ){ ?> title = "sunday" <?php }?> class="celda_normal" onkeyup="myFunction(this.parentNode.id,this.id,this.textContent);" id = "<?php echo $row.'row'.$col.'OT';?>" <?php if($flag == 1 or $flag2 == 1){ echo "style='background: #f9cd86 ;'";} else if($todayflag == 1){ echo "style='background: #f7e6ff ;'"; }?> contenteditable = "true" tabindex="<?php echo $col;?>"> <?php if(!empty($a->$OT)){echo $a->$OT;} else { echo '0';}?></td>
|
||
|
||
<?php $flag =0;
|
||
$flag2 =0;
|
||
$todayflag = 0;
|
||
}?>
|
||
<td class="celda_normal" id="<?php echo $row.'TH';?>"><?php if(!empty($a->Total_WHrs)){echo $a->Total_WHrs;}else{echo "0.00";}?></td>
|
||
<td class="celda_normal" id="<?php echo $row.'OTH';?>"><?php if(!empty($a->Total_OTHrs)){echo $a->Total_OTHrs;}else{echo "0.00";}?></td>
|
||
<td class="celda_normal" id="<?php echo $row.'PL';?>"><?php if(!empty($a->Paid_Leave)){echo number_format($a->Paid_Leave,2,'.','.');}else{echo "0.00";}?></td>
|
||
<td class="celda_normal" id="<?php echo $row.'DW';?>"><?php if(!empty($a->Days_Worked)){echo $a->Days_Worked;}else{echo "0.00";}?></td>
|
||
<td class="celda_normal"id="<?php echo $row.'AB';?>"><?php if(!empty($a->Absent)){echo $a->Absent;}else{echo "0.00";}?></td>
|
||
</tr>
|
||
<?php }?>
|
||
|
||
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div><!-- /.box-body -->
|
||
<div class="box-footer ">
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<input type="button" class="btn btn-primary" id="c" value="save" onClick="getAllData();">
|
||
</div>
|
||
</div>
|
||
</div> <!-- /.box footer -->
|
||
</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">
|
||
|
||
$("#month").datepicker({
|
||
minViewMode: 1,
|
||
format: 'M-yyyy'
|
||
});
|
||
|
||
|
||
function getAllData()
|
||
{
|
||
|
||
var s = findInvalidData();
|
||
|
||
//alert(s);
|
||
if(s == 0){
|
||
resetFinalValues();
|
||
var Totalnoofdays = <?php echo $monthdays?>;
|
||
var alldata = $("#attendance").tableToJSON();
|
||
// alert(JSON.stringify(alldata));
|
||
alldata=JSON.stringify(alldata);
|
||
// alert(alldata);
|
||
|
||
|
||
var month = $('#month').val();
|
||
var currentmonth = month.substr(0,3);
|
||
var currentyear = month.substr(4,4);
|
||
// alert(currentyear);
|
||
var montharray = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
|
||
var currentmonth = jQuery.inArray(currentmonth,montharray);//!== -1
|
||
currentmonth++;
|
||
|
||
//alert(currentmonth);
|
||
var currentdate = '01-'+currentmonth+'-'+currentyear;
|
||
|
||
var totaldata = 0;
|
||
$('.content').loader('show');
|
||
$.ajax({
|
||
data:{param1:alldata,param2:currentdate,param3:Totalnoofdays},
|
||
//dataType:"json",
|
||
type:"POST",
|
||
url:"<?php echo base_url() ?>monthlypay/saveAttendance",
|
||
|
||
success:function(data) {
|
||
if(data)
|
||
{
|
||
$('.content').loader('hide');
|
||
alert(data);
|
||
//totaldata = totaldata + parseFloat(data);
|
||
//console.log(data);
|
||
|
||
|
||
}
|
||
|
||
}
|
||
});
|
||
//alert(totaldata+"-Employees attendance saved sucessfully..!");
|
||
}
|
||
else
|
||
{
|
||
alert('Plesae Provide Working Hrs and OT Hrs Correctly..!');
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
</script>
|
||
|
||
|
||
<script type="text/javascript">
|
||
$(document).ready(function(){
|
||
|
||
|
||
$("#attendance").CongelarFilaColumna({lboHoverTr:true});
|
||
$('html').bind('keypress', function(e)
|
||
{
|
||
|
||
|
||
if(((e.which || e.keyCode) == 8) || ((e.which || e.keyCode) == 9) || ((e.which || e.keyCode) == 46) || ((e.which || e.keyCode) == 37) || ((e.which || e.keyCode) == 39))
|
||
{
|
||
|
||
return true;
|
||
|
||
}
|
||
if(e.keyCode == 13)
|
||
{
|
||
|
||
return false;
|
||
}
|
||
if(((e.which || e.keyCode) < 48) || ((e.which || e.keyCode) > 57))
|
||
{
|
||
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
});
|
||
|
||
$('td').focus(function(e){
|
||
|
||
var id = e.target.id;
|
||
var val = document.getElementById(id).textContent
|
||
//console.log(val);
|
||
if(val == 0)
|
||
{
|
||
window.setTimeout(function(){ document.getElementById(id).textContent = ''; }, 0);
|
||
}
|
||
});
|
||
|
||
$('td').focusout(function(e){
|
||
|
||
var id = e.target.id;
|
||
var val = document.getElementById(id).textContent
|
||
if(val == '')
|
||
{
|
||
window.setTimeout(function(){ document.getElementById(id).textContent = '0'; }, 0);
|
||
}
|
||
//console.log(val);
|
||
});
|
||
|
||
var d = new Date().getFullYear()+''+(new Date().getMonth()+1)+''+new Date().getDate();
|
||
//alert(d);
|
||
var str = $('#month').val();
|
||
var monthname = str.substr(0,3);
|
||
var monthyear = str.substr(4);
|
||
|
||
monthno = new Date(Date.parse(monthname +" 1, 2012")).getMonth()+1;
|
||
var n = monthyear+''+monthno+'01';
|
||
|
||
|
||
if(d < n)
|
||
{
|
||
$('#c').hide();
|
||
}
|
||
else{ $('#c').show();}
|
||
|
||
});
|
||
|
||
|
||
</script>
|
||
|
||
<script>
|
||
|
||
function myFunction(p,i,v)
|
||
{
|
||
//alert(p+"-"+i+"-"+v);
|
||
//alert(v);
|
||
// alert(k.keyCode);
|
||
var v = v;
|
||
var i =i;
|
||
var id = i.substr(-1);
|
||
//alert(id);
|
||
var len = i.length;
|
||
var nxtid =0;
|
||
var nxtvalue = 0;
|
||
var curvalue = 0;
|
||
var curid =0;
|
||
|
||
|
||
if(v > 24)
|
||
{
|
||
alert('Working Hrs Do Not Exceed 24 HRs');
|
||
|
||
$(i).focus();
|
||
document.getElementById(i).textContent = '';
|
||
return false;
|
||
}
|
||
if(id == 'W' && v > 8){ // checking working hrs vallue is more than 8, if it is set as OT Hrs more than 8
|
||
|
||
var j='#'+i;
|
||
var nextid = $(j).closest('td').next('td');
|
||
//alert(nextid);
|
||
nxtid = nextid[0].attributes[2].value;
|
||
|
||
|
||
|
||
|
||
|
||
//alert(nxtid);
|
||
//console.log(nextid[0].attributes[2].value);
|
||
//console.log(nextid);
|
||
|
||
nxtvalue = v-8;
|
||
curvalue = 8;
|
||
|
||
curid = i;
|
||
|
||
document.getElementById(i).innerHTML = parseFloat(curvalue)
|
||
if(document.getElementById(nxtid)){
|
||
document.getElementById(nxtid).innerHTML = parseFloat(nxtvalue)
|
||
}
|
||
else{
|
||
nxtid = nextid[0].attributes[3].value;
|
||
document.getElementById(nxtid).innerHTML = parseFloat(nxtvalue)
|
||
}
|
||
|
||
}
|
||
else if(id == 'T' && v > 16){
|
||
|
||
alert("OT Should not exceed 16 Hrs");
|
||
$(i).focus();
|
||
document.getElementById(i).innerHTML = '';
|
||
}
|
||
else if(id == 'S' && v > 16)
|
||
{
|
||
var j='#'+i;
|
||
//console.log(i);
|
||
//console.log('********************************************');
|
||
var nextid = $(j).closest('td').next('td');
|
||
//console.log(nextid);
|
||
//console.log('********************************************');
|
||
nxtid = nextid[0].attributes[3].value;
|
||
//console.log('********************************************');
|
||
//console.log(nxtid);
|
||
//console.log(nextid[0].attributes[2].value);
|
||
|
||
nxtvalue = v-16;
|
||
curvalue = 16;
|
||
|
||
curid = i;
|
||
|
||
document.getElementById(i).innerHTML = parseFloat(curvalue)
|
||
document.getElementById(nxtid).innerHTML = parseFloat(nxtvalue)
|
||
|
||
}
|
||
|
||
|
||
|
||
var totalworkingHrs=0;
|
||
var totalOTHrs = 0;
|
||
var paidleave = 0;
|
||
var totalDaysWorked=0;
|
||
var absent = 0;
|
||
var sundays = <?php echo $noofsundays?>;
|
||
var publicholidays = <?php echo $noofpublicholidays?>;
|
||
|
||
var totaldays = <?php echo $monthdays?>;
|
||
totaldays = (totaldays * 2)+3;
|
||
//console.log(totaldays);
|
||
|
||
|
||
var totalhrsid=p+'TH';
|
||
var totalothrsid=p+'OTH';
|
||
var paidleaveid=p+'PL';
|
||
var daysworkedid=p+'DW';
|
||
var absentid=p+'AB';
|
||
|
||
//document.getElementById(i).textContent = v;
|
||
//alert('Total Hrs-'+document.getElementById(i).textContent);
|
||
|
||
var Row = $('#attendance').find('tr').eq(p).find('td');
|
||
// console.log(Row);
|
||
$.each(Row,function(index,value){
|
||
cal:
|
||
{
|
||
if(index >= totaldays )
|
||
{
|
||
break cal;
|
||
}
|
||
if((index != 0) && (index !=1) && (index != 2))// && (index > totaldays))
|
||
{
|
||
|
||
var str = value.id;
|
||
|
||
var str1 = str.substr(-1);
|
||
var str2 = str.substr(-2);
|
||
var str3 = str.substr(-3);
|
||
|
||
if(str1 == 'W')
|
||
{
|
||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||
totalworkingHrs += current;
|
||
if(current == 0){paidleave++;}
|
||
}
|
||
else
|
||
{
|
||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||
totalOTHrs = totalOTHrs+current;
|
||
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
// break;
|
||
});
|
||
|
||
|
||
|
||
if(paidleave == 1 )
|
||
{
|
||
absent = 0;
|
||
}else if(paidleave == 0)
|
||
{
|
||
absent = 0;
|
||
}
|
||
else
|
||
{
|
||
absent = paidleave-2;
|
||
paidleave = 2;
|
||
}
|
||
document.getElementById(totalhrsid).textContent = parseFloat(totalworkingHrs).toFixed(2);// == ''?0:parseFloat(totalworkingHrs));
|
||
document.getElementById(totalothrsid).textContent = parseFloat(totalOTHrs).toFixed(2);// == ''?0:parseFloat(totalOTHrs));
|
||
document.getElementById(paidleaveid).textContent = parseFloat(paidleave).toFixed(2);
|
||
document.getElementById(daysworkedid).textContent = parseFloat((totalworkingHrs/8)).toFixed(2);
|
||
document.getElementById(absentid).textContent = parseFloat(absent).toFixed(2);
|
||
}
|
||
|
||
function findInvalidData()
|
||
{
|
||
var flag = 0;
|
||
|
||
//totaldays = (totaldays * 2);
|
||
|
||
var Row = $('#attendance').find('tr');
|
||
|
||
$.each(Row,function(index,value){
|
||
//console.log(index+'-'+value);
|
||
var td = $(value).find('td');
|
||
|
||
$.each(td,function(iter,val){
|
||
//console.log(iter+'-'+val.id+'-'+val.textContent);
|
||
if((val.id).substr(-1) == 'W' && (val.id).substr(-2) != 'DW')
|
||
{
|
||
if(parseFloat(val.textContent) > 8)
|
||
{
|
||
//alert('more than 8');
|
||
var ide = '#'+(val.id);
|
||
var p = $(ide).css("background-color", "red");
|
||
p.hide(1000).show(1000);
|
||
p.queue(function() {
|
||
p.css({"background-color":"white"});
|
||
$(ide).mouseover(function() {
|
||
$(this).css({"background-color":"#3c8dbc"})
|
||
}).mouseout(function(){ $(this).css({"background-color":"white"});});
|
||
});
|
||
flag++;
|
||
return false;
|
||
}
|
||
}
|
||
else if((val.id).substr(-1) == 'T')
|
||
{
|
||
if(parseFloat(val.textContent) > 16)
|
||
{
|
||
var ide = '#'+(val.id);
|
||
var p = $(ide).css("background-color", "red");
|
||
p.hide(1000).show(1000);
|
||
p.queue(function() {
|
||
p.css({"background-color":"white"});
|
||
$(ide).mouseover(function() {
|
||
$(this).css({"background-color":"#3c8dbc"})
|
||
}).mouseout(function(){ $(this).css({"background-color":"white"});});
|
||
});
|
||
flag++;
|
||
return false;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
});
|
||
|
||
});
|
||
//for Reset WH, OT, PL, AB to zero if all days entries are zero
|
||
//alert('before for');
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
return flag;
|
||
|
||
|
||
}
|
||
|
||
function resetFinalValues()
|
||
{
|
||
var Row = $('#attendance').find('tr');
|
||
var totalrowcount = Row.length;
|
||
totalrowcount = totalrowcount - 1;
|
||
var totaldays = <?php echo $monthdays?>;
|
||
console.log(totalrowcount);
|
||
for(i=1;i<=totalrowcount;i++)
|
||
{
|
||
|
||
//alert('inside for');
|
||
var a = parseFloat(document.getElementById(i+'PL').textContent);
|
||
var b = parseFloat(document.getElementById(i+'AB').textContent);
|
||
//alert(a+'-'+b+'-'+totaldays);
|
||
if(totaldays == (a+b))
|
||
{
|
||
document.getElementById(i+'PL').textContent = '0.00';
|
||
document.getElementById(i+'AB').textContent = '0.00';
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
}
|
||
|
||
</script>
|