employee details Model added
This commit is contained in:
parent
a8f5bc4b36
commit
6ad5dd6d73
@ -9,40 +9,33 @@ class Employeedetails_model extends CI_Model
|
|||||||
*/
|
*/
|
||||||
function employeeListingCount($searchText = ''){
|
function employeeListingCount($searchText = ''){
|
||||||
|
|
||||||
$this->db->select('BaseT.EmpID, BaseT.FirstName, BaseT.LastName, BaseT.DateofBirth,BaseT.ContactNumber, BaseT.EmailId,BaseT.DateofJoining,BaseT.Address1,BaseT.Address2,BaseT.Place,BaseT.City,BaseT.State,BaseT.Pin
|
$this->db->select('count(*) as Count');
|
||||||
,BaseT.DepartmentName,BaseT.User_Comments,role.role');
|
$this->db->from('T_Employee_Details Emp');
|
||||||
$this->db->from('T_EmpDetails as BaseT');
|
//$likeCriteria = '';
|
||||||
|
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
|
||||||
|
if(!empty($searchText)) {
|
||||||
|
$likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%'
|
||||||
$this->db->join('tbl_roles as role', 'role.Role = BaseT.role','left');
|
OR Emp.FirstName LIKE '%".$searchText."%'
|
||||||
|
OR Emp.LastName LIKE '%".$searchText."%'
|
||||||
if(!empty($searchText)) {
|
OR Emp.ContactNumber LIKE '%".$searchText."%'
|
||||||
$likeCriteria = "(BaseT.EmpID LIKE '%".$searchText."%'
|
OR Emp.EmailId LIKE '%".$searchText."%'
|
||||||
OR BaseT.FirstName LIKE '%".$searchText."%'
|
OR Emp.Designation LIKE '%".$searchText."%'
|
||||||
OR BaseT.LastName LIKE '%".$searchText."%'
|
OR Dep.DepartmentName LIKE '%".$searchText."%'
|
||||||
OR BaseT.DateofBirth LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.ContactNumber LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.EmailId LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.DateofJoining LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Role LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Address1 LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Address2 LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Place LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.City LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.State LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.DepartmentName LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.User_Comments LIKE '%".$searchText."%'
|
|
||||||
|
|
||||||
OR BaseT.Pin LIKE '%".$searchText."%'
|
|
||||||
)";
|
)";
|
||||||
$this->db->where($likeCriteria);
|
|
||||||
}
|
$this->db->where($likeCriteria);
|
||||||
//$this->db->where('BaseT.userId !=', 1);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// print_r( $this->db->last_query());
|
||||||
|
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
|
|
||||||
return count($query->result());
|
return $query->result_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used to get the user listing count
|
* This function is used to get the user listing count
|
||||||
* @param string $searchText : This is optional search text
|
* @param string $searchText : This is optional search text
|
||||||
@ -52,37 +45,29 @@ class Employeedetails_model extends CI_Model
|
|||||||
*/
|
*/
|
||||||
function employeeListing($searchText = '', $page, $segment)
|
function employeeListing($searchText = '', $page, $segment)
|
||||||
{
|
{
|
||||||
$this->db->select('BaseT.EmpID, BaseT.FirstName, BaseT.LastName, BaseT.DateofBirth,BaseT.ContactNumber, BaseT.EmailId,BaseT.DateofJoining,BaseT.Address1,BaseT.Address2,BaseT.Place,BaseT.City,BaseT.State,BaseT.Pin,BaseT.DepartmentName,BaseT.User_Comments,role.role');
|
$this->db->select(' Emp.*,Dep.DepartmentName as DepartmentName');
|
||||||
$this->db->from('T_EmpDetails as BaseT');
|
$this->db->from('T_Employee_Details Emp');
|
||||||
|
|
||||||
$this->db->join('tbl_roles as role', 'role.Role = BaseT.Role','left');
|
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
|
||||||
|
if(!empty($searchText)) {
|
||||||
if(!empty($searchText)) {
|
$likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%'
|
||||||
$likeCriteria = "(BaseT.EmpID LIKE '%".$searchText."%'
|
OR Emp.FirstName LIKE '%".$searchText."%'
|
||||||
OR BaseT.FirstName LIKE '%".$searchText."%'
|
OR Emp.LastName LIKE '%".$searchText."%'
|
||||||
OR BaseT.LastName LIKE '%".$searchText."%'
|
OR Emp.ContactNumber LIKE '%".$searchText."%'
|
||||||
OR BaseT.DateofBirth LIKE '%".$searchText."%'
|
OR Emp.EmailId LIKE '%".$searchText."%'
|
||||||
OR BaseT.ContactNumber LIKE '%".$searchText."%'
|
OR Emp.Designation LIKE '%".$searchText."%'
|
||||||
OR BaseT.EmailId LIKE '%".$searchText."%'
|
OR Dep.DepartmentName LIKE '%".$searchText."%'
|
||||||
OR BaseT.DateofJoining LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Role LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Address1 LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Address2 LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.Place LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.City LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.State LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.DepartmentName LIKE '%".$searchText."%'
|
|
||||||
OR BaseT.User_Comments LIKE '%".$searchText."%'
|
|
||||||
|
|
||||||
OR BaseT.Pin LIKE '%".$searchText."%'
|
|
||||||
)";
|
)";
|
||||||
$this->db->where($likeCriteria);
|
$this->db->where($likeCriteria);
|
||||||
}
|
}
|
||||||
//$this->db->where('BaseT.isDeleted', 0);
|
|
||||||
//$this->db->where('BaseT.userId !=', 1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->db->limit($page, $segment);
|
$this->db->limit($page, $segment);
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
|
//print_r( $this->db->last_query());
|
||||||
$result = $query->result();
|
$result = $query->result();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -98,7 +83,34 @@ class Employeedetails_model extends CI_Model
|
|||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to get the Config value from configuration table
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function getConfigValue(string $ConfigID )
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->db->select('ConfigValue');
|
||||||
|
$this->db->from('T_ConfigDetails');
|
||||||
|
$this->db->where('Config_id ',$ConfigID );
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *//**
|
||||||
|
* This function is used to get the Department details from T_DepartmentDetails
|
||||||
|
* @return array $result : This is result of the query
|
||||||
|
*/
|
||||||
|
function getDepartment()
|
||||||
|
{
|
||||||
|
$this->db->select('DEPCode, DepartmentName');
|
||||||
|
$this->db->from('T_DepartmentDetails');
|
||||||
|
$this->db->where('IsActive =', 1);
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This function used to get user information by id
|
* This function used to get user information by id
|
||||||
* @param number $userId : This is user id
|
* @param number $userId : This is user id
|
||||||
@ -107,13 +119,11 @@ class Employeedetails_model extends CI_Model
|
|||||||
|
|
||||||
function addNewemployee($Employee)
|
function addNewemployee($Employee)
|
||||||
{
|
{
|
||||||
$this->db->trans_start();
|
|
||||||
$this->db->insert('T_EmpDetails', $Employee);
|
$this->db->insert('T_Employee_Details', $Employee);
|
||||||
|
|
||||||
$Asset_Code = $this->db->insert_id();
|
$EmpID = $this->db->affected_rows();
|
||||||
|
|
||||||
$this->db->trans_complete();
|
|
||||||
|
|
||||||
return $EmpID;
|
return $EmpID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,5 +171,22 @@ function addNewemployee($Employee)
|
|||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
return $query->result_array();
|
return $query->result_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function insert($data = array()){
|
||||||
|
$this->tableName = 'uploadphoto';
|
||||||
|
$this->primaryKey = 'id';
|
||||||
|
if(!array_key_exists("created",$data)){
|
||||||
|
$data['created'] = date("Y-m-d H:i:s");
|
||||||
|
}
|
||||||
|
if(!array_key_exists("modified",$data)){
|
||||||
|
$data['modified'] = date("Y-m-d H:i:s");
|
||||||
|
}
|
||||||
|
$insert = $this->db->insert($this->tableName,$data);
|
||||||
|
if($insert){
|
||||||
|
return $this->db->insert_id();
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user