From 5898479021d96cd7e166795600598fc167f662f4 Mon Sep 17 00:00:00 2001 From: gandhimathi Bharathirajan Date: Thu, 27 Apr 2017 15:50:30 +0530 Subject: [PATCH] Payslip Production changes --- application/models/Payroll_model.php | 25 ++++++++++++-------- application/models/employeedetails_model.php | 9 +++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/application/models/Payroll_model.php b/application/models/Payroll_model.php index 4629f40b..d9731aca 100644 --- a/application/models/Payroll_model.php +++ b/application/models/Payroll_model.php @@ -2,7 +2,8 @@ class Payroll_model extends CI_Model { - + + /** * This function is used to insert the File details in database * @FileDetails array : This will have the set of value which we need to insert into database @@ -46,7 +47,6 @@ class Payroll_model extends CI_Model return $query->result(); } } - /** * This function is used to insert the File data in database * @FileDetails array : This will have the set of value which we need to insert into database @@ -86,9 +86,9 @@ class Payroll_model extends CI_Model { $this->db->select('Pay.*,payfile.TotalNoofDays as TotalNoofDays ,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.DateofBirth as Dob,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.IFSCCode as IFSCCode,Emp.DateofJoining as DOJ,Emp.Designation as Designation,Dep.DepartmentName as DeptName'); $this->db->from('T_Payroll Pay'); - $this->db->join('T_Payroll_File payfile', 'Pay.PayOn = payfile.PayOn','left'); - $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID','left'); - $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left'); + $this->db->join('T_Payroll_File payfile', 'Pay.PayOn = payfile.PayOn'); + $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); + $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode'); $this->db->where('Pay.PayOn', $PayOn); if($EmpId != '') { @@ -122,7 +122,7 @@ class Payroll_model extends CI_Model { $this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname'); $this->db->from('T_Payroll Pay'); - $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID','left'); + $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); if($Payon != '') { $this->db->where('Pay.PayOn', $Payon); @@ -136,13 +136,18 @@ class Payroll_model extends CI_Model * This function is used to get the PayOn details from T_Payroll_File * @return array $result : This is result of the query */ - function getEmpAll() + function getEmpAll($Payon ='') { - $this->db->select('Pay.EmpID as EmpId'); + $this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname'); $this->db->from('T_Payroll Pay'); - $this->db->order_by("Pay.EmpID", "asc"); + $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); + if($Payon != '') + { + $this->db->where('Pay.PayOn', $Payon); + } + $this->db->order_by("Pay.EmpID", "asc"); - $query = $this->db->get(); + $query = $this->db->get(); return $query->result_array(); } diff --git a/application/models/employeedetails_model.php b/application/models/employeedetails_model.php index a9f06577..a7f1036a 100644 --- a/application/models/employeedetails_model.php +++ b/application/models/employeedetails_model.php @@ -188,5 +188,14 @@ function addNewemployee($Employee) return $query->result_array(); } } +function getEmployeeCount( ) + { + + $this->db->select('count(*) as EmpCount'); + $this->db->from('T_Employee_Details'); + $this->db->where('IsActive ',1 ); + $query = $this->db->get(); + return $query->result(); + } } ?> \ No newline at end of file