From 1995f713c0ddd7aeab98baa60e11fecce9aac56e Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Thu, 11 Jan 2018 07:09:53 +0000 Subject: [PATCH] DOJ condition changed monthlypay_model --- application/models/monthlypay_model.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 24870b46..7928a593 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -13,12 +13,18 @@ class monthlypay_model extends CI_Model function monthlyListing($current="") { //echo $current; - $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID'); + $month_val = date('m',strtotime($current)); + $year_val = date('Y',strtotime($current)); + $date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val); + $lastdate = $year_val.'-'.$month_val.'-'.$date_val; + + $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID'); $this->db->from('T_Monthly_Pay_Inputs'); $this->db->join('T_Employee_Details','T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID'); $this->db->join('T_Payroll','T_Monthly_Pay_Inputs.EmpID=T_Payroll.EmpID','left'); $this->db->join('T_Loan_Master','T_Monthly_Pay_Inputs.EmpID=T_Loan_Master.EmpID','left'); $this->db->order_by('T_Employee_Details.EmpID','asc'); + $this->db->where('T_Employee_Details.DateofJoining <=',$lastdate); $this->db->where('Month_Year',$current); $query = $this->db->get(); @@ -61,11 +67,11 @@ class monthlypay_model extends CI_Model left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID 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 month(T_Employee_Details.DateofJoining) <= month(?) and year(T_Employee_Details.DateofJoining) <= year(?) + where T_Employee_Details.DateofJoining <= ? and month(T_Attendance.Month_Year) = month(?) order by T_Employee_Details.EmpID"; - $query = $this->db->query($sql,array($current,$current,$current)); + $query = $this->db->query($sql,array($current,$current)); return $query->result(); } @@ -131,12 +137,14 @@ class monthlypay_model extends CI_Model $month_val = date('m',strtotime($current)); $year_val = date('Y',strtotime($current)); $date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val); + $lastdate = $year_val.'-'.$month_val.'-'.$date_val; $this->db->select('T_Attendance.*,T_Employee_Details.FirstName,T_Employee_Details.LastName'); $this->db->from('T_Attendance'); $this->db->join('T_Employee_Details','T_Attendance.EmpID=T_Employee_Details.EmpID'); // $this->db->where('year(T_Employee_Details.DateofJoining) <= ',$year_val); // $this->db->where('month(T_Employee_Details.DateofJoining) <= ',$month_val); + $this->db->where('T_Employee_Details.DateofJoining <= ',$lastdate); $this->db->where('Month_Year',$current); $this->db->where('T_Employee_Details.IsActive',1); $this->db->order_by('T_Attendance.EmpID', 'asc');