ATTEN ISSUES FIXED
This commit is contained in:
parent
9952e76d3b
commit
a93051c8f2
@ -58,21 +58,29 @@ class monthlypay_model extends CI_Model
|
||||
function getEmpPayDetailsforMonthInputs($current="")
|
||||
{
|
||||
|
||||
//echo $current;
|
||||
$current = '01-'.$current;
|
||||
//echo $current;
|
||||
$current = date_create($current);
|
||||
$current = date_format($current,'Y-m-d');
|
||||
//echo 'Final'.$current;
|
||||
$month_val = date('m',strtotime($current));
|
||||
$year_val = date('Y',strtotime($current));
|
||||
$date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val);
|
||||
//$monthyear_val = date('Y-m',strtotime($current));
|
||||
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
|
||||
echo $lastdate;
|
||||
$sql = "select T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays,T_Loan_Master.Loan_ID,T_Payroll.Key from T_Emp_Pay_Data
|
||||
left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID
|
||||
left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID
|
||||
left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?)
|
||||
left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.EmpID
|
||||
left join T_Loan_Master on T_Emp_Pay_Data.EmpID = T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1
|
||||
where T_Employee_Details.DateofJoining <= ?
|
||||
and month(T_Attendance.Month_Year) = month(?)
|
||||
where T_Employee_Details.DateofJoining <= ?
|
||||
and month(T_Attendance.Month_Year) = month(?) and year(T_Attendance.Month_Year) = year(?)
|
||||
order by T_Employee_Details.EmpID";
|
||||
|
||||
$query = $this->db->query($sql,array($current,$current));
|
||||
return $query->result();
|
||||
$query = $this->db->query($sql,array($current,$current,$lastdate,$current,$current));
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getPublicHoldays($current="")
|
||||
|
||||
@ -380,8 +380,8 @@ $currentday = date('d');
|
||||
$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 if($flag2 == 1) {echo $row.'row'.$col.'WS';} else { 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 if($flag2 == 1) {echo $row.'row'.$col.'OTS';} else { 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>
|
||||
<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;
|
||||
@ -425,46 +425,55 @@ $currentday = date('d');
|
||||
function getAllData()
|
||||
{
|
||||
|
||||
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",
|
||||
var s = findInvalidData();
|
||||
|
||||
//alert(s);
|
||||
if(s == 0){
|
||||
var Totalnoofdays = <?php echo $monthdays?>;
|
||||
var alldata = $("#attendance").tableToJSON();
|
||||
// alert(JSON.stringify(alldata));
|
||||
alldata=JSON.stringify(alldata);
|
||||
// alert(alldata);
|
||||
|
||||
success:function(data) {
|
||||
if(data)
|
||||
{
|
||||
$('.content').loader('hide');
|
||||
alert(data);
|
||||
//totaldata = totaldata + parseFloat(data);
|
||||
//console.log(data);
|
||||
|
||||
|
||||
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..!");
|
||||
}
|
||||
});
|
||||
//alert(totaldata+"-Employees attendance saved sucessfully..!");
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Plesae Provide Working Hrs and OT Hrs Correctly..!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -525,6 +534,21 @@ $currentday = date('d');
|
||||
//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();}
|
||||
|
||||
});
|
||||
|
||||
@ -533,7 +557,7 @@ $currentday = date('d');
|
||||
|
||||
<script>
|
||||
|
||||
function myFunction(p,i,v,k)
|
||||
function myFunction(p,i,v)
|
||||
{
|
||||
//alert(p+"-"+i+"-"+v);
|
||||
//alert(v);
|
||||
@ -561,7 +585,14 @@ function myFunction(p,i,v,k)
|
||||
|
||||
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);
|
||||
|
||||
@ -571,7 +602,13 @@ function myFunction(p,i,v,k)
|
||||
curid = i;
|
||||
|
||||
document.getElementById(i).innerHTML = parseFloat(curvalue)
|
||||
document.getElementById(nxtid).innerHTML = parseFloat(nxtvalue)
|
||||
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){
|
||||
@ -679,26 +716,113 @@ function myFunction(p,i,v,k)
|
||||
absent = paidleave-2;
|
||||
paidleave = 2;
|
||||
}
|
||||
document.getElementById(totalhrsid).innerHTML = parseFloat(totalworkingHrs).toFixed(2);// == ''?0:parseFloat(totalworkingHrs));
|
||||
document.getElementById(totalothrsid).innerHTML = parseFloat(totalOTHrs).toFixed(2);// == ''?0:parseFloat(totalOTHrs));
|
||||
document.getElementById(paidleaveid).innerHTML = parseFloat(paidleave).toFixed(2);
|
||||
document.getElementById(daysworkedid).innerHTML = parseFloat((totalworkingHrs/8)+publicholidays).toFixed(2);
|
||||
document.getElementById(absentid).innerHTML = parseFloat(absent).toFixed(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 FindInvalide()
|
||||
function findInvalidData()
|
||||
{
|
||||
var flag = 0;
|
||||
var totaldays = <?php echo $monthdays?>;
|
||||
totaldays = (totaldays * 2);
|
||||
|
||||
var Row = $('#attendance').find('tr');
|
||||
//console.log(Row);
|
||||
var totalrowcount = Row.length;
|
||||
$.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);
|
||||
|
||||
});
|
||||
});
|
||||
//console.log(iter+'-'+val.id+'-'+val.textContent);
|
||||
if((val.id).substr(-1) == 'W')
|
||||
{
|
||||
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
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return flag;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user