diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php
index bf1ab4f7..431470ae 100755
--- a/application/controllers/payslip.php
+++ b/application/controllers/payslip.php
@@ -786,6 +786,8 @@ function getEmployee()
*/
public function PrintPdf()
{
+
+ $filename=" ";
$html="";
$All = $this->input->post('All');
if($All == '')
@@ -802,11 +804,16 @@ function getEmployee()
else
{
$Payon = $this->input->post('PayOn');
+
+ $m =date("M", mktime(0, 0, 0, $Payon, 10));
+ //$y =date("Y",mktime(0, 0, 0, $Payon, 10));
+ //$m=date("M-Y",mktime(0,0,0,$month,1,$year));
+ $y=substr($Payon,3);
//echo "Payon" . $Payon;
if($All != '')
{
-
+ $filename='PayslipFor-'.$m.'-'.$y;
$result = $this->payroll_model->getEmpAll($Payon);
// print_r($result);
// die();
@@ -843,6 +850,9 @@ function getEmployee()
$EmpID = $this->input->post('Employee');
//echo "EmpID" . $EmpID;
$Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon,$EmpID);
+
+ $fname=$Data['PayDetails'][0]->FName;
+ $filename='PayslipFor-'.$EmpID.' '.$fname.' '.$m.' '.$y;
$totalsalary =$Data['PayDetails'][0]->LessAdvance;
$totalsalaryinwords = $this->convertNumber(round($totalsalary));
diff --git a/application/controllers/user.php b/application/controllers/user.php
index ae2fcd46..aff5e9a5 100755
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -78,7 +78,9 @@ class user extends BaseController
$data['typebal'] = $this->dahsboard_Model->typebal();
- /* HR DASHBOARD Controller Start*/
+ /* HR DASHBOARD Controller Start*/
+
+
$data['totemp'] = $this->dahsboard_Model->totemp();
$data['totloan'] = $this->dahsboard_Model->totloan();
$data['totpay'] = $this->dahsboard_Model->totpay();
@@ -90,36 +92,178 @@ class user extends BaseController
- $date = date('Y-m');
+
+
+
+
+ $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"));
+
+ $yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
+ //print_r($yesterday);die;
+ $valuess = 0;
+ foreach ($yesterday as $weekda => $value)
+ {
+
+ if ($value[$WH] == 0)
+ {
+
+ $valuess++;
+ }
+
+
+ }
+ // echo $values;
+ $data['today'] = $valuess;
+
+
+
+
+ // $date = $this->input->post("id");
+ // echo $date;
+ $daydate = date('Y-m',strtotime($date));
//echo $date; die;
- $date = $date . '-01';
- $dat = date('d');
+ $daydate = $daydate . '-01';
+
+
+ $yesterday = $this->dahsboard_Model->attyesterday($WH, $daydate);
+ // print_r($yesterday);
- // $hoilday = 0;
+ //$absEmp =array($absEmp);
+ $values = 0;
+ $absEmp = array();
+ //echo $value; die;
+ foreach ($yesterday as $weekda => $value)
+ {
+ // echo $value[$WH];
- // $month = date('m');
- // //echo $month;
- // $year = date('Y');
- // // echo $year;
- // $hoilday= $year.'-'.$month .'-01';
- // // echo $hoilday;
-
- // $holiDaySalaryMonth = $this->dahsboard_Model->holiDaySalaryMonth($month,$year);
+ if ($value[$WH] == 0)
+ {
- // //print_r( $holiDaySalaryMonth);
+ $values++;
+ $absendId = $value['EmpID'];
+ $absendName = $value['FirstName'];
+ $absEmp [] = $absendId . "-" . $absendName; //absend empid and name list
+ }
+ }
-
- // foreach ($holiDaySalaryMonth as $holidays) {
+ //print_r($absentName);die;
+ // $data['today'] = $values;
+ $data['abs_name'] = $absEmp;
+
+ $OT = 'OT' . date('j',strtotime($date));
+
+ $CUR_month = date('t');
+ //echo $CUR_month;
+ //echo $daydate;
+ $toDayEmployee = $this->dahsboard_Model->yesterdayAllPersentEmpSalary($WH, $OT, $daydate);
+ //$EmpID = $toDayEmployee[0]->EmpID;
- // //print_r($holidays);
- // $holiday [] = date('j', strtotime($holidays->H_Date));
- // }
+ //print_r($toDayEmployee); die;
- //print_r($holiday);
- //$month=date('m')
+ $EmpID = 0;
- // $currentdaydates =date('d');
+ $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);
+
+ // echo $Empid;
+ // print_r($totalEmployeePersent);
+
+ if(!empty($totalEmployeePersent))
+ {
+
+ $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.'
';
+
+ $dayHra = $HRA_Amount / $CUR_month;
+ /** per day hra amount **/
+ //echo $dayHra.'
';
+
+ $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.'
';
+ $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;
+
+
+
$working = array();
$overtime = array();
//$holid = array();
@@ -156,12 +300,15 @@ class user extends BaseController
$totalSalary = 0;
$working = explode(",", $WH);
$overtime = explode(",", $OT);
- foreach ($toDayEmployee as $value) {
+ foreach ($toDayEmployee as $value)
+ {
$values = 0;
- foreach ($working as $work) {
+ foreach ($working as $work)
+ {
// foreach ($overtime as $extra) {
- if ($value[$work] != 0 || $value['OT' . substr($work, 2)] != 0) {
+ if ($value[$work] != 0 || $value['OT' . substr($work, 2)] != 0)
+ {
$totalothour = $value['OT' . substr($work, 2)];
//echo $totalothour;
$values = 1;
@@ -171,7 +318,8 @@ class user extends BaseController
//echo $Empid;
$totalEmployeePersent = $this->dahsboard_Model->persentEmployeeDetails($Empid);
- if(!empty($totalEmployeePersent)) {
+ if(!empty($totalEmployeePersent))
+ {
$HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
$Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
@@ -193,9 +341,12 @@ class user extends BaseController
//echo $dayHra.'
';
$onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
- if ($totalothour != 0) /** if ot not equal zero **/ {
+ if ($totalothour != 0) /** if ot not equal zero **/
+ {
$totSalayOT = $totalothour * $onehoursSalary;
- } else {
+ }
+ else
+ {
$totSalayOT = 0;
}
$currentDaySalary = $daySalary * $values;
@@ -207,7 +358,8 @@ class user extends BaseController
// echo $currentDayHra.'
';
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
/** current date pf calculation**/
- if ($totalsalary <= 20000) {
+ if ($totalsalary <= 20000)
+ {
$esiAmount = $currentDatePF * 1.75 / 100;
/** esiamount not elgiable for 20000 **/
@@ -259,9 +411,11 @@ function dateFunctionChangeVales()
$yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
//print_r($yesterday);die;
$values = 0;
- foreach ($yesterday as $weekda => $value) {
+ foreach ($yesterday as $weekda => $value)
+ {
- if ($value[$WH] == 0) {
+ if ($value[$WH] == 0)
+ {
$values++;
}
@@ -274,7 +428,7 @@ function dateFunctionChangeVales()
- $date = $this->input->post("id");
+ $date = $this->input->post("id");
// echo $date;
$daydate = date('Y-m',strtotime($date));
//echo $date; die;
@@ -292,10 +446,12 @@ function dateFunctionChangeVales()
$values = 0;
$absEmp = array();
//echo $value; die;
- foreach ($yesterday as $weekda => $value) {
+ foreach ($yesterday as $weekda => $value)
+ {
// echo $value[$WH];
- if ($value[$WH] == 0) {
+ if ($value[$WH] == 0)
+ {
$values++;
$absendId = $value['EmpID'];
@@ -322,11 +478,13 @@ function dateFunctionChangeVales()
$employeeSalary = 0;
- foreach ($toDayEmployee as $value) {
+ foreach ($toDayEmployee as $value)
+ {
$values = 0;
$totalothour = 0;
- if ($value[$WH] != 0) {
+ if ($value[$WH] != 0)
+ {
$totalothour = $value[$OT];
//echo $totalothour;die;
@@ -341,7 +499,8 @@ function dateFunctionChangeVales()
// echo $Empid;
// print_r($totalEmployeePersent);
- if(!empty($totalEmployeePersent)) {
+ if(!empty($totalEmployeePersent))
+ {
$HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
$Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
@@ -362,7 +521,8 @@ function dateFunctionChangeVales()
$onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
- if ($totalothour != 0) /** if ot not equal zero **/ {
+ if ($totalothour != 0) /** if ot not equal zero **/
+ {
$totSalayOT = $totalothour * $onehoursSalary;
} else {
$totSalayOT = 0;
@@ -376,7 +536,8 @@ function dateFunctionChangeVales()
// echo $currentDayHra.'
';
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
/** current date pf calculation**/
- if ($totalsalary <= 20000) {
+ if ($totalsalary <= 20000)
+ {
$esiAmount = $currentDatePF * 1.75 / 100;
/** esiamount not elgiable for 20000 **/
@@ -544,7 +705,7 @@ function monthattendance($empID ='')
$weekdays[] = 'WH' . $i;
$otHours[] = 'OT' . $i;
}
- $totalwhhours=0;
+ $totalwhhours=0;
foreach ($monthabs as $weekda)
{
//print_r($weekda);
@@ -635,301 +796,7 @@ function monthattendance($empID ='')
}
- /*Permission Month Reports*/
- function monthattendance1($empID ='')
-{
-
- $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);
- $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);
-
- $totalwhhours = array_sum($values);
- $totalwhhour = $totalwhhours/8;
- //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;
- }
- }
-/*monthperformances report*/
- function monthattendance2($empID ='',$date)
-{
- // echo $date;
-
- $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;
- } }
-
-
+
/*this function used to speedometer year emp performances display*/
@@ -940,15 +807,18 @@ function attendanceyear($empID ='')
$CURDATE = date('d');
$CURYEAR = date('Y');
$EmpID = '';
- if(empty($empID)){
- $EmpID = $this->input->post('id');
- }
- else
- {
+ if(empty($empID))
+ {
+ $EmpID = $this->input->post('id');
+ }
+ else
+ {
$EmpID = $empID;
- }
+ }
+
$day = array();
$datejoin = $this->dahsboard_Model->joindate($EmpID);
+
$DateofJoiningInString = $datejoin[0]->DateofJoining;
$DateofJoining = date_create($DateofJoiningInString);
// print_r($DateofJoining);
@@ -961,8 +831,8 @@ function attendanceyear($empID ='')
$JoinedMonth = date_format($DateofJoining, "n");
-// print_r($finStart);print_r($finEnd);
- // print $JoinedMonth;
+ // print_r($finStart);print_r($finEnd);
+ //print $JoinedMonth;
if ($DateofJoining >= $finStart && $DateofJoining <= $finEnd)
{
@@ -971,11 +841,11 @@ function attendanceyear($empID ='')
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
{
- $joinedMonthWorkingDayCount = $CURDATE - $doj_day +1;
+ $joinedMonthWorkingDayCount = $CURDATE - $doj_day +1 ;
}
else
{
- $joinedMonthWorkingDayCount = $joinedMonthDaysCount - $doj_day;
+ $joinedMonthWorkingDayCount = $joinedMonthDaysCount - $doj_day +1;
}
$joinedMonthDays = 0;
@@ -993,7 +863,7 @@ function attendanceyear($empID ='')
{
if ($value != 0)
{
- //echo $value;
+ // echo $value;
$joinedMonthDays++;
}
}
@@ -1003,18 +873,19 @@ function attendanceyear($empID ='')
}
- // echo $joinedMonthWorkingDayCount;die;
+ //echo $joinedMonthDays;die;
$result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1);
- // print_r($result); die;
+ //print_r($result);
$yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
$TotalNoofDays = $result[0]->TotalWorkingDays;
$DaysWorked = $result[0]->DaysWorked;
- //echo $TotalNoofDays;
+ // echo $TotalNoofDays;
// echo $DaysWorked;die;
$values = 0;
+ $values = array();
$weekdays = array();
$date = date('d');
@@ -1024,7 +895,7 @@ function attendanceyear($empID ='')
{
$weekdays[] = 'WH' . $j;
}
-
+ $totalhours =0;
foreach ($yearabs as $day)
{
foreach ($day as $key => $value)
@@ -1035,7 +906,10 @@ function attendanceyear($empID ='')
{
if ($value != 0)
{
- $values++;
+ //$values++;
+ //$totalhours = array_sum($value);
+ $values[] = $value;
+
}
}
@@ -1044,6 +918,12 @@ function attendanceyear($empID ='')
}
$DaysWorked = 0;
+
+ $totalhours = array_sum($values);
+
+ $values = $totalhours/8;
+ //print_r($totalhours);
+
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
{
$TotalNoofDays = $TotalNoofDays + $joinedMonthWorkingDayCount;
@@ -1076,7 +956,7 @@ function attendanceyear($empID ='')
$values = 0;
-
+ $values = array();
$weekdays = array();
$date = date('d');
@@ -1097,7 +977,7 @@ function attendanceyear($empID ='')
if ($value != 0)
{
- $values++;
+ $values[]=$value;
}
}
@@ -1105,6 +985,10 @@ function attendanceyear($empID ='')
}
}
+ $totalhours = array_sum($values);
+
+ $values = $totalhours/8;
+
$TotalNoofDays = $TotalNoofDays + $CURDATE;
$DaysWorked = $DaysWorked + $values;
$final_res = round(($DaysWorked / $TotalNoofDays) * 100);
@@ -1117,366 +1001,29 @@ function attendanceyear($empID ='')
}
- if(empty($empID)){
+ if(empty($empID))
+ {
echo json_encode($data);
- }
- else{
+ }
+ else
+ {
return $data;
}
}
-/*in this function used to report perfomance*/
-function empPerFormation()
- {
- // $this->global['pageTitle'] = 'Siddharth : Reports';
-//echo "welcome";
- $EmpLists =$this->dahsboard_Model->getEmployee();
- //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-> monthattendance1($EmpID);
- $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;
-$this->loadViews("empperform", $this->global, $data, NULL);
-}
-
-
-
-/*Performeans report datepicker click on partculars month reports display*/
-function monthwiserepoarts()
-{
- echo "hi";
-
-$EmpLists =$this->dahsboard_Model->getEmployee();
-$datepicker=$this->input->post('month');
-
-// print_r (explode("-",$datepicker));
-
-$dates = date("Y-m",strtotime($datepicker));
-$date = $dates . '-01';
-//echo $dates;
-
- //print_r($EmpLists);die;
-//echo $date;
- $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-> monthattendance2($EmpID,$date);
- $fineyearemp = $this->attendanceyear2($EmpID,$date);
-$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;
-
-$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);
-
-
-
-}
-function attendanceyear2($empID ='',$date)
-{
- $CUR_dates = date('Y-04');
- $CUR_date = $CUR_dates .'-01';
- $date = $this->input->post('datepick');
- // echo $date;die;
- $per_months = date('Y-03',strtotime($date));
- $per_month = $per_months.'-01';
-
- 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);
- foreach ($monthabs as $days)
- {
- $TotalNoofDays = $days->NoofDays;
- $TotalWorkingDays = $days->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;
-
- }
- $CURMONTH = date('m');
- $CURDATE = date('d');
- $CURYEAR = date('Y');
- $EmpID = '';
- if(empty($empID)){
- $EmpID = $this->input->post('id');
- }
- else
- {
- $EmpID = $empID;
- }
- $day = array();
- $datejoin = $this->dahsboard_Model->joindate($EmpID);
- $DateofJoiningInString = $datejoin[0]->DateofJoining;
- $DateofJoining = date_create($DateofJoiningInString);
- // print_r($DateofJoining);
- $doj_month = date_format($DateofJoining, "n");
- $doj_year = date_format($DateofJoining, "Y");
- $doj_day = date_format($DateofJoining, "j");
-
- $finStart = $this->getFinancialStartDate();
- $finEnd = $this->getFinancialEndDate();
-
- $JoinedMonth = date_format($DateofJoining, "n");
-
-// print_r($finStart);print_r($finEnd);
- // print $JoinedMonth;
-
- if ($DateofJoining >= $finStart && $DateofJoining <= $finEnd)
- {
- $JoinedMonthAttendance = $this->dahsboard_Model->getAllAttendances($EmpID,$JoinedMonth);
- $joinedMonthDaysCount = cal_days_in_month(CAL_GREGORIAN, $doj_month, $doj_year);
-
- if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
- {
- $joinedMonthWorkingDayCount = $CURDATE - $doj_day +1;
- }
- else
- {
- $joinedMonthWorkingDayCount = $joinedMonthDaysCount - $doj_day;
- }
-
- $joinedMonthDays = 0;
- for ($j = $doj_day; $j <= $joinedMonthDaysCount; $j++)
- {
- $weekdays[] = 'WH' . $j;
- }
- foreach ($JoinedMonthAttendance as $day)
- {
- foreach ($day as $key => $value)
- {
- foreach ($weekdays as $weeks)
- {
- if ($weeks == $key)
- {
- if ($value != 0)
- {
- //echo $value;
- $joinedMonthDays++;
- }
- }
-
- }
- }
-
- }
-
- // echo $joinedMonthWorkingDayCount;die;
-
- $result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1);
-
- // print_r($result); die;
- $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
- $TotalNoofDays = $result[0]->TotalWorkingDays;
- $DaysWorked = $result[0]->DaysWorked;
-
- //echo $TotalNoofDays;
- // echo $DaysWorked;die;
- $values = 0;
- $weekdays = array();
- $date = date('d');
-
- $Work = array_sum($weekdays);
-
- for ($j = 1; $j <= $date; $j++)
- {
- $weekdays[] = 'WH' . $j;
- }
-
- foreach ($yearabs as $day)
- {
- foreach ($day as $key => $value)
- {
- foreach ($weekdays as $weeks)
- {
- if ($weeks == $key)
- {
- if ($value != 0)
- {
- $values++;
- }
- }
-
- }
- }
- }
-
- $DaysWorked = 0;
- if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
- {
- $TotalNoofDays = $TotalNoofDays + $joinedMonthWorkingDayCount;
- $DaysWorked = $joinedMonthDays;
- }
- else
- {
- $TotalNoofDays = $TotalNoofDays + $CURDATE + $joinedMonthWorkingDayCount;
- $DaysWorked = $DaysWorked + $joinedMonthDays + $values;
- }
-
-
-
-
- $final_res = round(($DaysWorked / $TotalNoofDays) * 100);
- // echo "------";
- //echo $final_res;exit();
- $data['workeds'] = $DaysWorked;
- $data['yeardata'] = $final_res;
- $data['totaldays'] = $TotalNoofDays;
-
- }
-
- else
- {
- $result = $this->dahsboard_Model->attendanceyear($EmpID, 4);
- $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
- $TotalNoofDays = $result[0]->TotalWorkingDays;
- $DaysWorked = $result[0]->DaysWorked;
-
-
- $values = 0;
-
- $weekdays = array();
- $date = date('d');
-
- $Work = array_sum($weekdays);
-
- for ($j = 1; $j <= $date; $j++)
- {
- $weekdays[] = 'WH' . $j;
- }
- foreach ($yearabs as $day)
- {
- foreach ($day as $key => $value)
- {
- foreach ($weekdays as $weeks)
- {
- if ($weeks == $key)
- {
- if ($value != 0)
- {
-
- $values++;
- }
- }
-
- }
- }
- }
-
- $TotalNoofDays = $TotalNoofDays + $CURDATE;
- $DaysWorked = $DaysWorked + $values;
- $final_res = round(($DaysWorked / $TotalNoofDays) * 100);
- // echo "------";
- //echo $final_res;exit();
- $data['workeds'] = $DaysWorked;
- $data['yeardata'] = $final_res;
- $data['totaldays'] = $TotalNoofDays;
-
-
- }
-
- if(empty($empID)){
-
- echo json_encode($data);
- }
- else{
- return $data;
- }
-}
-
-
/****************HR DASHBOART Controller END **************************************/
+
/**
* This function is used to load the user list
*/
diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php
index 200611fe..591625c5 100755
--- a/application/models/dahsboard_model.php
+++ b/application/models/dahsboard_model.php
@@ -80,6 +80,14 @@ where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
return $query->result_array();
}
+function yesterdayAllPersentEmpSalary($WH,$OT,$date)
+ {
+ // echo $date;
+ $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));
+ //return
+ return $query->result_array();
+}
function attendance($EmpID,$dates)
@@ -166,17 +174,27 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
// $sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where
// case
// 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 )end and EmpID = ? and month(Month_Year) != month(current_date())';
+ // (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())
+ // else
+ // (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
+ case
+ when (MONTH(CURRENT_DATE) >=4) then
+ ((YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? )) and EmpID = ? and month(Month_Year) != MONTH(CURRENT_DATE)
+ else
+ ((YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >=4 and ? >= 4) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 and ? <=3 )) and Month(Month_Year) >= ? and EmpID = ? and month(Month_Year) != MONTH(CURRENT_DATE)
+ end';
-$sql='select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance
+/*$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())';
+ and MONTH(Month_Year) != MONTH(current_date())';*/
- $query= $this->db->query($sql,array($EmpID,$MONTH));
+ $query= $this->db->query($sql,array($MONTH,$EmpID,$MONTH,$MONTH,$MONTH,$EmpID));
return $query->result();
diff --git a/application/views/dashboard.php b/application/views/dashboard.php
index a633f54c..5c0a2713 100755
--- a/application/views/dashboard.php
+++ b/application/views/dashboard.php
@@ -53,20 +53,23 @@ if(!empty($EmpCount))
-
+
+
-