ATTENDANCE ISSSUE FIXED

This commit is contained in:
velz2020 2018-01-12 18:25:03 +05:30
parent a93051c8f2
commit 39274212e1

View File

@ -389,7 +389,7 @@ $currentday = date('d');
}?>
<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 $a->Paid_Leave;}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>
@ -429,6 +429,7 @@ $currentday = date('d');
//alert(s);
if(s == 0){
resetFinalValues();
var Totalnoofdays = <?php echo $monthdays?>;
var alldata = $("#attendance").tableToJSON();
// alert(JSON.stringify(alldata));
@ -726,11 +727,11 @@ function myFunction(p,i,v)
function findInvalidData()
{
var flag = 0;
var totaldays = <?php echo $monthdays?>;
totaldays = (totaldays * 2);
//totaldays = (totaldays * 2);
var Row = $('#attendance').find('tr');
var totalrowcount = Row.length;
$.each(Row,function(index,value){
//console.log(index+'-'+value);
var td = $(value).find('td');
@ -779,44 +780,9 @@ function findInvalidData()
});
//for Reset WH, OT, PL, AB to zero if all days entries are zero
for(i=1;i<=totalrowcount;i++)
{
//alert('insdie for');
var total = 0;
var Rows = $('#attendance').find('tr').eq(i).find('td');
$.each(Rows,function(index,value){
// alert(index);
cal:
{
if(index >= totaldays)
{
break cal;
}
if((index != 0) && (index !=1) && (index != 2))// && (index > totaldays))
{
total = total + parseFloat(value.textContent);
}
if(parseFloat(total) == 0)
{
var th = i+'TH';
var oth = i+'OTH';
var pl = i+'PL';
var dw = i+'DW';
var ab = i+'AB';
document.getElementById(th).textContent = '0.00';
document.getElementById(oth).textContent = '0.00';
document.getElementById(pl).textContent = '0.00';
document.getElementById(dw).textContent = '0.00';
document.getElementById(ab).textContent = '0.00';
}
}
});
//exit();
}
//alert('before for');
@ -827,6 +793,30 @@ function findInvalidData()
}
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>