dashboard datepicker

This commit is contained in:
venbatechnologies 2018-01-05 16:30:36 +05:30
parent 6ea54c09bf
commit 9648e33a20
3 changed files with 544 additions and 296 deletions

View File

@ -85,179 +85,6 @@ class user extends BaseController
$data['totrec'] = $this->dahsboard_Model->totrec(); $data['totrec'] = $this->dahsboard_Model->totrec();
$data['emplist'] = $this->dahsboard_Model->emplist(); $data['emplist'] = $this->dahsboard_Model->emplist();
/* yesterday absent list count in employee*/
$dates = date('Y-m');
$date = $dates . '-01';
// echo $date;
$dat = date('d', strtotime("-1 days"));
//echo $date;
$WH = 'WH' . date('j', strtotime("-1 days"));
//echo($WH);
$yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
//print_r($yesterday);die;
$values = 0;
foreach ($yesterday as $weekda => $value) {
if ($value[$WH] == 0) {
$values++;
}
}
// echo $values;
$data['values'] = $values;
/*Today absent list count in employee*/
$dates = date('Y-m');
//echo $date;
$date = $dates . '-01';
$dat = date('d');
//echo $date;
$WH = 'WH' . date('j');
//echo $WH;die;
$yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
//print_r($yesterday);die;
//$absEmp =array($absEmp);
$values = 0;
$absEmp = array();
//echo $value; die;
foreach ($yesterday as $weekda => $value) {
if ($value[$WH] == 0) {
$values++;
$absendId = $value['EmpID'];
$absendName = $value['FirstName'];
$absEmp [] = $absendId . "-" . $absendName; //absend empid and name list
// foreach($absEmp as $value => $absentEmpName){
// echo $absentEmpName; die;
// }
}
}
//print_r($absentName);die;
$data['today'] = $values;
$data['absname'] = $absEmp;
// function todayEmployeeSalaylist()
//{
$date = date('Y-m');
//echo $date; die;
$date = $date . '-01';
$dat = date('d');
//echo $dat; die;
$WH = 'WH' . date('j');
$OT = 'OT' . date('j');
$CUR_month = date('t');
// echo $CUR_month; die;
$toDayEmployee = $this->dahsboard_Model->dayAllPersentEmpSalary($WH, $OT, $date);
//$EmpID = $toDayEmployee[0]->EmpID;
// print_r($toDayEmployee); die;
$EmpID = 0;
$employeeSalary = 0;
foreach ($toDayEmployee as $value) {
$values = 0;
$totalothour = 0;
if ($value[$WH] != 0) {
$totalothour = $value[$OT];
//echo $totalothour;die;
$values = 1;
//print_r($values); die;
$Empid = $value['EmpID'];
//echo $Empid; die;
$totalEmployeePersent = $this->dahsboard_Model->persentEmployeeDetails($Empid);
//print_r($totalEmployeePersent);die;
$HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
$Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
$totalsalary = $totalEmployeePersent[0]->TotalSalary;
$dayFoodAmt = $totalEmployeePersent[0]->Food_Allowances;
//$allowances =$totalEmployeePersent[0]->Allowances;
//$Allowances = $allowances * $values;
$Food_Allowances = $dayFoodAmt * $values;
$daySalary = $Basic_Pay / $CUR_month;
/**per day salary working hour**/
//echo $daySalary.'<br/>';
$dayHra = $HRA_Amount / $CUR_month;
/** per day hra amount **/
//echo $dayHra.'<br/>';
$onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
if ($totalothour != 0) /** if ot not equal zero **/ {
$totSalayOT = $totalothour * $onehoursSalary;
} else {
$totSalayOT = 0;
}
$currentDaySalary = $daySalary * $values;
/** current day salary working days calculation**/
$currentDayHra = $dayHra * $values;
/** total working days hra calculations**/
// echo $currentDayHra.'<br/>';
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
/** current date pf calculation**/
if ($totalsalary <= 20000) {
$esiAmount = $currentDatePF * 1.75 / 100;
/** esiamount not elgiable for 20000 **/
} else {
$esiAmount = 0;
}
$pfAmount = $currentDaySalary * 12 / 100;
/** pf amount per day**/
//echo $totalothour;die;
$salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances;
$salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount);
$employeeSalary += round($salaryInCurrentday);
}
}
//$salaryInCurrentday++;
$data['employeeSalary'] = $employeeSalary;
// }
// function monthTodayEmployeeSalaylist()
// {
$date = date('Y-m'); $date = date('Y-m');
//echo $date; die; //echo $date; die;
@ -365,13 +192,7 @@ class user extends BaseController
// $salarycurrentdate[] = $salaryInCurrentday;; // $salarycurrentdate[] = $salaryInCurrentday;;
} }
// } //
//print_r($salarycurrentdate);
// $currentmonthsalary = array_sum($salarycurrentdate);
// $totalSalary = $totalSalary + $salarycurrentdate;
// $salaryInCurrentday++;
// echo $totalSalary;
//print_r($currentmonthsalary);
} }
} }
@ -382,12 +203,183 @@ class user extends BaseController
$this->loadViews("dashboard", $this->global, $data, NULL); $this->loadViews("dashboard", $this->global, $data, NULL);
} }
/*date click on day salary,absent name, total absent display*/
function dateFunctionChangeVales()
{
$date = $this->input->post("id");
$dates = date('Y-m');
$date = $dates . '-01';
// // echo $date;
// $dat = date('d', strtotime("-1 days"));
//echo $date;
$WH = 'WH' . date('j', strtotime("-1 days"));
//echo($WH);
$yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
//print_r($yesterday);die;
$values = 0;
foreach ($yesterday as $weekda => $value) {
if ($value[$WH] == 0) {
$values++;
}
}
// echo $values;
$data['values'] = $values;
$date = $this->input->post("id");
// echo $date;
$daydate = date('Y-m',strtotime($date));
//echo $date; die;
$daydate = $daydate . '-01';
//$dat = date('d');
// echo $daydate; echo "";
$WH = 'WH' . date('j',strtotime($date));
//echo $WH;
$yesterday = $this->dahsboard_Model->attyesterday($WH, $daydate);
// print_r($yesterday);die;
//$absEmp =array($absEmp);
$values = 0;
$absEmp = array();
//echo $value; die;
foreach ($yesterday as $weekda => $value) {
if ($value[$WH] == 0) {
$values++;
$absendId = $value['EmpID'];
$absendName = $value['FirstName'];
$absEmp [] = $absendId . "-" . $absendName; //absend empid and name list
}
}
//print_r($absentName);die;
$data['today'] = $values;
$data['absname'] = $absEmp;
$OT = 'OT' . date('j',strtotime($date));
$CUR_month = date('t');
//echo $CUR_month;
//echo $daydate;
$toDayEmployee = $this->dahsboard_Model->dayAllPersentEmpSalary($WH, $OT, $daydate);
//$EmpID = $toDayEmployee[0]->EmpID;
//print_r($toDayEmployee); die;
$EmpID = 0;
$employeeSalary = 0;
foreach ($toDayEmployee as $value) {
$values = 0;
$totalothour = 0;
if ($value[$WH] != 0) {
$totalothour = $value[$OT];
//echo $totalothour;die;
$values = 1;
//print_r($values); die;
$Empid = $value['EmpID'];
//print_r($value['EmpID']);
$totalEmployeePersent = $this->dahsboard_Model->persentEmployeeDetails($Empid);
$HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
$Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
$totalsalary = $totalEmployeePersent[0]->TotalSalary;
$dayFoodAmt = $totalEmployeePersent[0]->Food_Allowances;
//$allowances =$totalEmployeePersent[0]->Allowances;
//echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
//$Allowances = $allowances * $values;
$Food_Allowances = $dayFoodAmt * $values;
$daySalary = $Basic_Pay / $CUR_month;
/**per day salary working hour**/
//echo $daySalary.'<br/>';
$dayHra = $HRA_Amount / $CUR_month;
/** per day hra amount **/
//echo $dayHra.'<br/>';
$onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
if ($totalothour != 0) /** if ot not equal zero **/ {
$totSalayOT = $totalothour * $onehoursSalary;
} else {
$totSalayOT = 0;
}
$currentDaySalary = $daySalary * $values;
/** current day salary working days calculation**/
$currentDayHra = $dayHra * $values;
/** total working days hra calculations**/
// echo $currentDayHra.'<br/>';
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
/** current date pf calculation**/
if ($totalsalary <= 20000) {
$esiAmount = $currentDatePF * 1.75 / 100;
/** esiamount not elgiable for 20000 **/
} else {
$esiAmount = 0;
}
$pfAmount = $currentDaySalary * 12 / 100;
/** pf amount per day**/
//echo $totalothour;die;
$salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances;
$salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount);
$employeeSalary += round($salaryInCurrentday);
// echo $employeeSalary;
}
}
//$salaryInCurrentday++;
$data['employeeSalary'] = $employeeSalary;
// }
echo json_encode($data);
}
/*this function uesd to finance startdate */
public function getFinancialStartDate() public function getFinancialStartDate()
{ {
$CURMONTH = date('n'); $CURMONTH = date('n');
$CURYEAR = date('Y'); $CURYEAR = date('Y');
$FINYEAR = 0; $FINYEAR = 0;
@ -400,12 +392,17 @@ class user extends BaseController
} }
$dateInString = $FINYEAR . '-4-1'; $dateInString = $FINYEAR . '-4-1';
$result = date_create($dateInString); $result = date_create($dateInString);
// print_r($result);
return $result; return $result;
}
}
/*this function uesd to finance EndDate */
public function getFinancialEndDate() public function getFinancialEndDate()
{ {
$CURMONTH = date('n'); $CURMONTH = date('n');
$CURYEAR = date('Y'); $CURYEAR = date('Y');
$FINYEAR = 0; $FINYEAR = 0;
@ -419,10 +416,184 @@ class user extends BaseController
$dateInString = $FINYEAR . '-3-31'; $dateInString = $FINYEAR . '-3-31';
$result = date_create($dateInString); $result = date_create($dateInString);
return $result;
// print_r($result);
return $result;
} }
/*this function used to speedometer month emp performances display*/
function monthattendance($empID ='') function monthattendance($empID ='')
{
$CUR_date = date('m');
//echo $CUR_date;
$date = $this->input->post('datepick');
// echo $date;die;
$per_month = date('m',strtotime($date));
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
{
$date = date('Y-m');
//echo $date;
$dates = $date . '-01';
//$EmpID = '';
//if(empty($empID))
// {
$EmpID = $this->input->post('id');
//}
//else
// {
//$EmpID = $empID;
//}
// echo $EmpID;die;
$monthabs = $this->dahsboard_Model->attendance($EmpID, $dates);
$persent_month = date('t');//current month of days 31
$values = array();
$otvalues = array();
$weekdays = array();
$otHours = array();
$date = date('j');//current month current date
$CURDATE =date('d');//current month current date
$CUR_month = date('t'); //current month of days 31
$CURYEAR = date('Y');
$CURMONTH = date('m');
$datejoin = $this->dahsboard_Model->joindate($EmpID);
// print_r($datejoin);die;
$DateofJoiningInString = $datejoin[0]->DateofJoining;
$DateofJoining = date_create($DateofJoiningInString);
$doj_month = date_format($DateofJoining, "n");
$doj_year = date_format($DateofJoining, "Y");
$doj_day = date_format($DateofJoining, "j");
//echo $doj_day;
for ($i = 1; $i <= $persent_month; $i++)
{
$weekdays[] = 'WH' . $i;
$otHours[] = 'OT' . $i;
}
foreach ($monthabs as $weekda)
{
//print_r($weekda);
foreach ($weekda as $key => $value)
{
//print_r($key);
foreach ($weekdays as $weeks)
{
if ($weeks == $key)
{
//print_r($key);
if ($value != 0)
{
//echo $value;
$values[] = $value;
}
//echo $values;
}
}
foreach ($otHours as $ot)
{
if ($ot == $key)
{
if ($value != 0)
{
$otvalues [] = $value;
}
}
}
}
}
$totalothour = array_sum($otvalues);
$totalwhhour = sizeof($values);
//echo $totalwhhour;
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
{
//echo $doj_day;
$month['CUR_month'] = $CURDATE - $doj_day + 1;
//print_r($month);
}
else
{
$month['CUR_month'] = $date;
}
if ($totalwhhour != 0)
{
$year = date('Y');
$current_month = date('m');
$month['values'] = $totalwhhour;
//$data['salaryInCurrentday'] = round($salaryInCurrentday);
$month['present_percentage'] = round(($totalwhhour / $month['CUR_month']) * 100);
}
else {
$month['values'] = 0;
//$data['salaryInCurrentday'] = 0;
$month['present_percentage'] = 0;
}
}
if(empty($empID)){
echo json_encode($month);
}
else{
return $month;
}
}
/*Permission Month Reports*/
function monthattendance1($empID ='')
{ {
$date = date('Y-m'); $date = date('Y-m');
@ -522,47 +693,6 @@ function monthattendance($empID ='')
if ($totalwhhour != 0) if ($totalwhhour != 0)
{ {
// //echo $values;
// $currentDateSalary = $this->dahsboard_Model->daysalary($EmpID, $dates);
// $HRA_Amount = $currentDateSalary[0]->HRA_Amount;
// $Basic_Pay = $currentDateSalary[0]->Basic_Pay;
// $totalsalary = $currentDateSalary[0]->TotalSalary;
// $dayFoodAmt = $currentDateSalary[0]->Food_Allowances;
// $Food_Allowances = $dayFoodAmt * $values;
// $daySalary = $Basic_Pay / $CUR_month;
// $onehoursSalary = $daySalary / 8;
// if ($totalothour != 0)
// {
// $totSalayOT = $totalothour * $onehoursSalary;
// }
// else
// {
// $totSalayOT = 0;
// }
// $currentDaySalary = $daySalary * $values;
// $dayHra = $HRA_Amount / $CUR_month;
// $currentDayHra = $dayHra * $values;
// $currentDatePF = $currentDaySalary + $currentDayHra;
// if ($totalsalary <= 20000)
// {
// $esiAmount = $currentDatePF * 1.75 / 100;
// }
// else
// {
// $esiAmount = 0;
// }
// $pfAmount = $currentDaySalary * 12 / 100;
// $salaryInCurrentday = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances;
$year = date('Y'); $year = date('Y');
$current_month = date('m'); $current_month = date('m');
@ -589,9 +719,11 @@ function monthattendance($empID ='')
} }
/*this function used to speedometer year emp performances display*/
function attendanceyear($empID ='') function attendanceyear($empID ='')
{ {
//echo "hai";die;
$CURMONTH = date('m'); $CURMONTH = date('m');
$CURDATE = date('d'); $CURDATE = date('d');
$CURYEAR = date('Y'); $CURYEAR = date('Y');
@ -607,14 +739,18 @@ function attendanceyear($empID ='')
$datejoin = $this->dahsboard_Model->joindate($EmpID); $datejoin = $this->dahsboard_Model->joindate($EmpID);
$DateofJoiningInString = $datejoin[0]->DateofJoining; $DateofJoiningInString = $datejoin[0]->DateofJoining;
$DateofJoining = date_create($DateofJoiningInString); $DateofJoining = date_create($DateofJoiningInString);
// print_r($DateofJoining);
$doj_month = date_format($DateofJoining, "n"); $doj_month = date_format($DateofJoining, "n");
$doj_year = date_format($DateofJoining, "Y"); $doj_year = date_format($DateofJoining, "Y");
$doj_day = date_format($DateofJoining, "j"); $doj_day = date_format($DateofJoining, "j");
$finStart = $this->getFinancialStartDate(); $finStart = $this->getFinancialStartDate();
$finEnd = $this->getFinancialEndDate(); $finEnd = $this->getFinancialEndDate();
$JoinedMonth = date_format($DateofJoining, "n"); $JoinedMonth = date_format($DateofJoining, "n");
// echo $JoinedMonth; die;
// print_r($finStart);print_r($finEnd);
// print $JoinedMonth;
if ($DateofJoining >= $finStart && $DateofJoining <= $finEnd) if ($DateofJoining >= $finStart && $DateofJoining <= $finEnd)
{ {
@ -658,12 +794,14 @@ function attendanceyear($empID ='')
// echo $joinedMonthWorkingDayCount;die; // echo $joinedMonthWorkingDayCount;die;
$result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1); $result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1);
// print_r($result); die;
$yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH); $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
$TotalNoofDays = $result[0]->TotalWorkingDays; $TotalNoofDays = $result[0]->TotalWorkingDays;
$DaysWorked = $result[0]->DaysWorked; $DaysWorked = $result[0]->DaysWorked;
// echo $DaysWorked; die; //echo $TotalNoofDays;
// print_r($DaysWorked);die; // echo $DaysWorked;die;
$values = 0; $values = 0;
$weekdays = array(); $weekdays = array();
$date = date('d'); $date = date('d');
@ -705,8 +843,7 @@ function attendanceyear($empID ='')
$DaysWorked = $DaysWorked + $joinedMonthDays + $values; $DaysWorked = $DaysWorked + $joinedMonthDays + $values;
} }
// $DaysWorked = $DaysWorked + $joinedMonthDays + $values;
//echo $TotalNoofDays.'-'.$DaysWorked;
$final_res = round(($DaysWorked / $TotalNoofDays) * 100); $final_res = round(($DaysWorked / $TotalNoofDays) * 100);
@ -765,13 +902,6 @@ function attendanceyear($empID ='')
$data['yeardata'] = $final_res; $data['yeardata'] = $final_res;
$data['totaldays'] = $TotalNoofDays; $data['totaldays'] = $TotalNoofDays;
// $month = $this->monthattendance();
// $data['values'] = $values;
// $data['salaryInCurrentday'] = round($salaryInCurrentday);
// $data['present_percentage'] = round(($values / $data['CUR_month']) * 100);
//print_r($data);die;
} }
@ -784,7 +914,7 @@ function attendanceyear($empID ='')
} }
} }
/*in this function used to report perfomance*/
function empPerFormation() function empPerFormation()
{ {
@ -803,7 +933,7 @@ function empPerFormation()
$IsActive =$Emp->IsActive; $IsActive =$Emp->IsActive;
//echo $EmpID; //echo $EmpID;
$currentmonthemp = $this-> monthattendance($EmpID); $currentmonthemp = $this-> monthattendance1($EmpID);
$fineyearemp = $this->attendanceyear($EmpID); $fineyearemp = $this->attendanceyear($EmpID);
$a = array($EmpID,$FirstName,$LastName,$IsActive,$currentmonthemp,$fineyearemp); $a = array($EmpID,$FirstName,$LastName,$IsActive,$currentmonthemp,$fineyearemp);
$data['emp_performence_details'][$index]= $a; $data['emp_performence_details'][$index]= $a;
@ -819,6 +949,50 @@ $this->loadViews("empperform", $this->global, $data, NULL);
} }
/*this function used dashboard to month and year of the date wise cilck on emp perform in speedometer */
function empPerFormancesDateWise()
{
$date = $this->input->post("id");
// echo $date; die;
$daydate = date('Y-m',strtotime($date));// function month and year display(select)
//echo $daydate; die;
// $daydate = $daydate . '-01';
$EmpLists =$this->dahsboard_Model->getEmployee(); //employee details display
//print_r($EmpLists);die;
$index = 0;
$data['emp_performence_details'] = array();
foreach ($EmpLists as $Emp) {
$EmpID = $Emp->EmpID;
$FirstName =$Emp->FirstName;
$LastName =$Emp->LastName;
$IsActive =$Emp->IsActive;
//echo $EmpID;
$currentmonthemp = $this-> monthattendance($EmpID);
//print_r($currentmonthemp);die;
$fineyearemp = $this->attendanceyear($EmpID);
$a = array($EmpID,$FirstName,$LastName,$IsActive,$currentmonthemp,$fineyearemp);
$data['emp_performence_details'][$index]= $a;
//pre($data[$EmpID]['month']);die;
$index++;
}
//print_r($data['emp_performence_details']);die;
echo json_encode($data);
}
/****************HR DASHBOART Controller END **************************************/ /****************HR DASHBOART Controller END **************************************/
/** /**

View File

@ -73,7 +73,7 @@ where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
function dayAllPersentEmpSalary($WH,$OT,$date) function dayAllPersentEmpSalary($WH,$OT,$date)
{ {
//echo $EmpID.'-'.$dates; // echo $date;
$sql="select EmpID,".$WH.",".$OT." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)"; $sql="select EmpID,".$WH.",".$OT." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)";
$query = $this->db->query($sql,array($date)); $query = $this->db->query($sql,array($date));
//return //return
@ -157,18 +157,26 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
function attendanceyear($EmpID,$MONTH) function attendanceyear($EmpID,$MONTH)
{ {
// $sql="select Att.EmpID,Att.Month_Year,Att.*,NoofDays,Days_Worked,emp.DateofJoining from T_Attendance Att // //print_r($MONTH);
// join T_Employee_Details as emp on emp.EmpID = Att.EmpID // $sql="select Att.EmpID,Att.Month_Year,Att.*,NoofDays,Days_Worked,emp.DateofJoining from T_Attendance Att
// where Att.Month_Year between ? and ? and Att.EmpID = ?"; // join T_Employee_Details as emp on emp.EmpID = Att.EmpID
// where Att.Month_Year between ? and Att.EmpID = ?";
// else // else
// (YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 ) // (YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 )
$sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where // $sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where
case // case
when (month(Month_Year) >=4) then // when (month(Month_Year) >=4) then
(YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 ) // (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 )end and EmpID = ? and month(Month_Year) != month(current_date())';
end and EmpID = ? and month(Month_Year) != month(current_date());';
$query= $this->db->query($sql,array($MONTH, $EmpID)); $sql='select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance
where EmpID= ? and (MONTH(Month_Year) >=4) or (MONTH(Month_Year) <3)
and (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? )or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 )
and MONTH(Month_Year) != MONTH(current_date())';
$query= $this->db->query($sql,array($EmpID,$MONTH));
return $query->result(); return $query->result();

View File

@ -55,11 +55,35 @@ if(!empty($EmpCount))
?> ?>
<!-- HR Start part to--> <!-- HR Start part to-->
<script>
$( function()
{
$( "#datepick" ).datepicker({maxDate: 'Date-1', dateFormat: 'dd-mm-yy' }).val();
$( "#datepic" ).datepicker({maxDate: 'Date-1', dateFormat: 'dd-mm-yy' }).val();
// $("#datepic").datepicker({ defaultDate: '-2m'});
} );
</script>
<script type="text/javascript">
$(document).ready(function()
{
//$("#employee").select2();
//$("#employeeAttan").select2();
$("#emp").select2();
});
</script>
<style> <style>
.small-box .icon { .small-box .icon
top: 0px !important; {
} top: 0px !important;
</style> }
</style>
<?php <?php
if($DEPCode == HR) if($DEPCode == HR)
{ {
@ -152,13 +176,14 @@ if(!empty($EmpCount))
<div class="col-lg-3 col-xs-6"> <div class="col-lg-3 col-xs-6">
<!-- small box --> <!-- small box -->
<div class="small-box bg-yellow"> <div class="small-box bg-yellow" >
<a class="small-box-footer"> <p> <strong>SALARY COST</strong> </p> </a> <a class="small-box-footer"> <p><strong>SALARY COST</strong></p></a>
<div class="inner"> <div class="inner" style="padding: 14px;">
<h3 id=""><i class="fa fa-rupee"></i><?php echo $employeeSalary;?></h3> <h3 ><div class="fa fa-rupee" id="today_salary"><!-- <b><?php echo $employeeSalary;?></b> -->
<p>TODAY</p> </div></h3>
<input type="text" id="datepick" placeholder="Select Date" style="color:#000;width:30%" />
</div> </div>
@ -166,7 +191,7 @@ if(!empty($EmpCount))
<i class="ion ion-calculator"></i> <i class="ion ion-calculator"></i>
</div> </div>
<a class="small-box-footer"> THIS MONTH : <i class="fa fa-rupee"></i> <?php echo $totalSalary;?> <a class="small-box-footer" style="z-index:0;"> THIS MONTH : <i class="fa fa-rupee"></i> <?php echo $totalSalary;?>
</a> </a>
</div> </div>
@ -181,18 +206,18 @@ if(!empty($EmpCount))
<div class="small-box bg-green"> <div class="small-box bg-green">
<a href="#" class="small-box-footer"> <p> <strong>TOTAL EMPLOYEES ABSENT</strong> </p></a> <a href="#" class="small-box-footer"> <p> <strong>TOTAL EMPLOYEES ABSENT</strong> </p></a>
<h3>
<div class="inner"> <div class="inner" id="today_abs">
<h3> <?php echo $today;?></h3> <!-- <h3> <?php echo $today_abs;?></h3> -->
<p>TODAY</p>
</div> 00
</div></h3>
<p>ABSENT</p><br>
<div class="icon"> <div class="icon">
<i class="ion ion-android-calendar"></i> <i class="ion ion-android-calendar"></i>
</div> </div> <a href="#" class="small-box-footer"><br> </a>
<a href="#" class="small-box-footer">YESTERDAY :<?php echo $values;?> </a>
</div> </div>
</div> </div>
<!-- ./col --> <!-- ./col -->
@ -232,9 +257,15 @@ if(!empty($EmpCount))
</h3> </h3>
<!-- <a target="_blank" href="<?php echo base_url(); ?>employeeperform" class="btn btn-info">
View All </a> --> <input type="text" id="datepic" name="datepic" placeholder="Select Date" style="color:#000;width:15%" />
<!-- <input type="button" id="but" value="ok" style="color:blue; width:15%" /> -->
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
@ -289,11 +320,12 @@ if(!empty($EmpCount))
chart.draw(data, options); chart.draw(data, options);
$('#emp').change(function() { $('#emp').change(function() {
var datepick = $('#datepic').val();
var id = $('#emp').val(); var id = $('#emp').val();
$("#yearabs").val(''); $("#yearabs").val('');
if(id != '-1') if(id != '-1' && datepick !='')
{ {
$('#content').loader('show'); $('#content').loader('show');
@ -314,16 +346,16 @@ if(!empty($EmpCount))
chart.draw(data, options); chart.draw(data, options);
}, },
error:function(){ // error:function(){
alert('error'); // alert('error');
} // }
}); });
//$('#content').loader('hide'); //$('#content').loader('hide');
} }
else else
{ {
alert('Please select the Employee'); alert('Please select the Date');
return false; return false;
} }
@ -332,14 +364,6 @@ if(!empty($EmpCount))
</script> </script>
<script type="text/javascript">
$(document).ready(function(){
$("#employee").select2();
$("#employeeAttan").select2();
$("#emp").select2();
});
</script>
<!------ Month------> <!------ Month------>
<div class="col-md-6 col-sm-6" style="padding:0px;"> <div class="col-md-6 col-sm-6" style="padding:0px;">
@ -401,17 +425,25 @@ if(!empty($EmpCount))
<!-- /.box-header --> <!-- /.box-header -->
<div class="box-body"> <div class="box-body">
<!-- Conversations are loaded here --> <!-- Conversations are loaded here -->
<div class="direct-chat-messages"> <div class="direct-chat-messages" >
<!-- Message. Default to the left --> <!-- Message. Default to the left -->
<?php
if(!empty($absname)){ <div class="inner" id ="abs_name">
foreach ($absname as $abs) {
echo $abs.'<br/>'; <!-- <h3> <?php echo $today_abs;?></h3> -->
</div>
<!-- <?php
// if(!empty($absname)){
// foreach ($absname as $abs) {
// echo $abs.'<br/>';
?> ?>
<?php } <?php// }
}?> // }?> -->
@ -475,16 +507,17 @@ if(!empty($EmpCount))
$('#emp').change(function() { $('#emp').change(function() {
// alert(); // alert('Please select Employee Name' );
var id = $('#emp').val(); var id = $('#emp').val();
var datepick = $("#datepic").val();
$("#monthabs").val(''); $("#monthabs").val('');
if(id != '-1') if(id != '-1' && datepick !='')
{ {
$('#content').loader('show'); $('#content').loader('show');
$.ajax({ $.ajax({
data:{id:id}, data:{id:id,datepick:datepick},
dataType: 'json', dataType: 'json',
type:"POST", type:"POST",
url:"<?php echo base_url();?>user/monthattendance", url:"<?php echo base_url();?>user/monthattendance",
@ -495,7 +528,7 @@ $("#monthabs").val('');
//alert(json.MatDetail); //alert(json.MatDetail);
$("#present").text(json.values); $("#present").text(json.values);
$("#total_days").text(json.CUR_month); $("#total_days").text(json.CUR_month);
$("#salaryInCurrentday").text(json.salaryInCurrentday); //$("#salaryInCurrentday").text(json.salaryInCurrentday);
@ -513,7 +546,7 @@ $("#monthabs").val('');
} }
else else
{ {
alert('Please select the Employee'); alert('Please select the Date');
return false; return false;
} }
@ -526,7 +559,40 @@ $("#monthabs").val('');
</script> </script>
<script>
$('#datepick').change(function() {
var datepick = $('#emp').val();
//alert();
$('#abs_name').empty();
var id = $(this).val();
//alert(id);
$.ajax({
data:{id:id},
dataType: 'json',
type:"POST",
url:"<?php echo base_url();?>user/dateFunctionChangeVales",
success:function(json) {
// console.log(json.employeeSalary);
var abs_name = json.absname;
$.each(abs_name,function(i,obj){
//alert(obj);
$("#abs_name").append(obj+'<br/>');
//$("#abs_name").html("<br/>");
});
$("#today_abs").text(json.today);
$("#values").text(json.values);
$("#today_salary").text(json.employeeSalary);
//$("#totalSalary").text(json.totalSalary);
}
});
});
</script>
<!-- \\\\\\\\\\\\\\\ HR END of the part ////////////////////////--> <!-- \\\\\\\\\\\\\\\ HR END of the part ////////////////////////-->