diff --git a/app/Models/Monthlypay_model.php b/app/Models/Monthlypay_model.php index 3a6548ab..c3d58b5c 100755 --- a/app/Models/Monthlypay_model.php +++ b/app/Models/Monthlypay_model.php @@ -55,7 +55,7 @@ class Monthlypay_model extends Model } - function getEmpPayDetails($current = "", $s = "") + function getEmpPayDetails_attendance_old($current = "", $s = "") { $month_val = date('m', strtotime($current)); @@ -67,7 +67,7 @@ class Monthlypay_model extends Model ->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_employee_details.is_driver') //->join('t_emp_pay_data','t_emp_pay_data.EmpID=t_employee_details.EmpID','Left') ->where('t_employee_details.IsActive', 1) - ->where('t_employee_details.is_driver', 0) + ->where('t_employee_details.is_driver !=', 1) ->where('t_employee_details.DateofJoining <=', $lastdate) ->orderBy('EmpID', 'asc'); $query = $builder->get(); @@ -77,6 +77,31 @@ class Monthlypay_model extends Model return $result; } + function getEmpPayDetails($current = "", $s = "") + { + + $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; + $builder = $this->db->table('t_employee_details') + ->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_employee_details.is_driver') + //->join('t_emp_pay_data','t_emp_pay_data.EmpID=t_employee_details.EmpID','Left') + ->join('t_monthly_pay_inputs as p','p.EmpID=t_employee_details.EmpID','Left') + ->where('t_employee_details.IsActive', 1) + ->where('t_employee_details.is_driver !=', 1) + ->where('t_employee_details.DateofJoining <=', $lastdate) + ->where("p.Month_Year IS NULL OR + STR_TO_DATE(p.Month_Year, '%m-%Y') <=", $lastdate) + ->orderBy('EmpID', 'asc'); + $query = $builder->get(); + $result = $query->getResult(); + // $last_query = $this->db->getLastQuery(); + // echo $last_query;die; + return $result; + } + function getEmpPayDetailsforMonthInputs($current = "") {