dashboard

This commit is contained in:
venbatechnologies 2018-01-17 11:17:42 +05:30
parent 8a2dabc546
commit 0b8d429c94

View File

@ -621,58 +621,24 @@ function dateFunctionChangeVales()
} }
/*this function used to speedometer month emp performances display*/
function monthattendance($empID ='')
/*this function used to speedometer month emp performances display*/
function monthattendance($empID ='')
{ {
$CUR_date = date('m'); $date = date('Y-m');
//echo $CUR_date; //echo $date;
$date = $this->input->post('datepick'); $dates = $date . '-01';
// echo $date;die; $EmpID = '';
$per_month = date('m',strtotime($date)); if(empty($empID)){
$EmpID = $this->input->post('id');
if($per_month > $CUR_date and empty($empID)) }
{
$noofdays=0;
$workdays=0;
$EmpID = $this->input->post('id');
$date = $this->input->post('datepick');
//echo $date;
$daydate = date('Y-m',strtotime($date));
$dates =$daydate . '-01';
$monthabs = $this->dahsboard_Model->attendance($EmpID, $dates);
// print_r($monthabs);
$TotalNoofDays = $monthabs[0]->NoofDays;
$TotalWorkingDays = $monthabs[0]->Days_Worked;
// print_r($TotalNoofDays);die;
$noofdays =$TotalNoofDays;
$workdays =$TotalWorkingDays;
$performances = round(($workdays / $noofdays) * 100);
$month['CUR_month']=$noofdays;
$month['values']=$workdays;
$month['present_percentage']= $performances;
}
else else
{ {
$date = date('Y-m'); $EmpID = $empID;
//echo $date; }
$dates = $date . '-01';
//$EmpID = '';
//if(empty($empID))
// {
$EmpID = $this->input->post('id');
//}
//else
// {
//$EmpID = $empID;
//}
// echo $EmpID;die; // echo $EmpID;die;
$monthabs = $this->dahsboard_Model->attendance($EmpID, $dates); $monthabs = $this->dahsboard_Model->attendance($EmpID, $dates);
$persent_month = date('t');//current month of days 31 $persent_month = date('t');//current month of days 31
@ -693,7 +659,6 @@ function monthattendance($empID ='')
$CURMONTH = date('m'); $CURMONTH = date('m');
$datejoin = $this->dahsboard_Model->joindate($EmpID); $datejoin = $this->dahsboard_Model->joindate($EmpID);
// print_r($datejoin);die;
$DateofJoiningInString = $datejoin[0]->DateofJoining; $DateofJoiningInString = $datejoin[0]->DateofJoining;
$DateofJoining = date_create($DateofJoiningInString); $DateofJoining = date_create($DateofJoiningInString);
$doj_month = date_format($DateofJoining, "n"); $doj_month = date_format($DateofJoining, "n");
@ -716,14 +681,11 @@ function monthattendance($empID ='')
{ {
if ($weeks == $key) if ($weeks == $key)
{ {
//print_r($key);
if ($value != 0) if ($value != 0)
{ {
// echo $value; //echo $value;
$values[] = $value; $values[] = $value;
// $totalwhhours=$values;
//echo $values;
} }
//echo $values; //echo $values;
@ -746,56 +708,54 @@ function monthattendance($empID ='')
} }
} }
$totalwhhours = array_sum($values);
//echo $totalwhhours;
$totalothour = array_sum($otvalues); $totalothour = array_sum($otvalues);
//$totalwhhour = sizeof($values); //$totalwhhour = sizeof($values);
$totalwhhours = array_sum($values);
$totalwhhour = $totalwhhours/8;
$totalwhhour = $totalwhhours/8;
//echo $totalwhhour; //echo $totalwhhour;
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year) if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
{ {
//echo $doj_day; //echo $doj_day;
$month['CUR_month'] = $CURDATE - $doj_day + 1; $data['CUR_month'] = $CURDATE - $doj_day + 1;
//print_r($month); //print_r($month);
} }
else else
{ {
$month['CUR_month'] = $date; $data['CUR_month'] = $date;
} }
if ($totalwhhour != 0) if ($totalwhhour != 0)
{ {
$year = date('Y'); $year = date('Y');
$current_month = date('m'); $current_month = date('m');
$month['values'] = $totalwhhour; $data['values'] = $totalwhhour;
//$data['salaryInCurrentday'] = round($salaryInCurrentday); //$data['salaryInCurrentday'] = round($salaryInCurrentday);
$month['present_percentage'] = round(($totalwhhour / $month['CUR_month']) * 100); $data['present_percentage'] = round(($totalwhhour / $month['CUR_month']) * 100);
} }
else { else {
$month['values'] = 0; $data['values'] = 0;
//$data['salaryInCurrentday'] = 0; //$data['salaryInCurrentday'] = 0;
$month['present_percentage'] = 0; $data['present_percentage'] = 0;
} }
}
if(empty($empID)){ if(empty($empID)){
echo json_encode($month); echo json_encode( $data);
} }
else{ else{
return $month; return $data;
} }
} }
/*this function used to speedometer year emp performances display*/ /*this function used to speedometer year emp performances display*/