From 39274212e1095a20d09d116e395a8a3a56bafc50 Mon Sep 17 00:00:00 2001 From: velz2020 Date: Fri, 12 Jan 2018 18:25:03 +0530 Subject: [PATCH] ATTENDANCE ISSSUE FIXED --- application/views/attendance.php | 76 ++++++++++++++------------------ 1 file changed, 33 insertions(+), 43 deletions(-) diff --git a/application/views/attendance.php b/application/views/attendance.php index 715756b3..3578ef99 100755 --- a/application/views/attendance.php +++ b/application/views/attendance.php @@ -389,7 +389,7 @@ $currentday = date('d'); }?> Total_WHrs)){echo $a->Total_WHrs;}else{echo "0.00";}?> Total_OTHrs)){echo $a->Total_OTHrs;}else{echo "0.00";}?> - Paid_Leave)){echo $a->Paid_Leave;}else{echo "0.00";}?> + Paid_Leave)){echo number_format($a->Paid_Leave,2,'.','.');}else{echo "0.00";}?> Days_Worked)){echo $a->Days_Worked;}else{echo "0.00";}?> Absent)){echo $a->Absent;}else{echo "0.00";}?> @@ -429,6 +429,7 @@ $currentday = date('d'); //alert(s); if(s == 0){ + resetFinalValues(); var Totalnoofdays = ; var alldata = $("#attendance").tableToJSON(); // alert(JSON.stringify(alldata)); @@ -726,11 +727,11 @@ function myFunction(p,i,v) function findInvalidData() { var flag = 0; - var totaldays = ; - 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 = ; + 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'; + } + + + + + } +}