Supplier details added
This commit is contained in:
parent
a395ad2338
commit
55e3e3f4af
192
application/models/employeedetails_model.php
Normal file
192
application/models/employeedetails_model.php
Normal file
@ -0,0 +1,192 @@
|
||||
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class employeedetails_model extends CI_Model
|
||||
{
|
||||
/**
|
||||
* This function is used to get the user listing count
|
||||
* @param string $searchText : This is optional search text
|
||||
* @return number $count : This is row count
|
||||
*/
|
||||
function employeeListingCount($searchText = ''){
|
||||
|
||||
$this->db->select('count(*) as Count');
|
||||
$this->db->from('T_Employee_Details Emp');
|
||||
//$likeCriteria = '';
|
||||
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
|
||||
if(!empty($searchText)) {
|
||||
$likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%'
|
||||
OR Emp.FirstName LIKE '%".$searchText."%'
|
||||
OR Emp.LastName LIKE '%".$searchText."%'
|
||||
OR Emp.ContactNumber LIKE '%".$searchText."%'
|
||||
OR Emp.EmailId LIKE '%".$searchText."%'
|
||||
OR Emp.Designation LIKE '%".$searchText."%'
|
||||
OR Dep.DepartmentName LIKE '%".$searchText."%'
|
||||
|
||||
)";
|
||||
|
||||
$this->db->where($likeCriteria);
|
||||
}
|
||||
|
||||
|
||||
// print_r( $this->db->last_query());
|
||||
|
||||
$query = $this->db->get();
|
||||
// print_r( $this->db->last_query());
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is used to get the user listing count
|
||||
* @param string $searchText : This is optional search text
|
||||
* @param number $page : This is pagination offset
|
||||
* @param number $segment : This is pagination limit
|
||||
* @return array $result : This is result
|
||||
*/
|
||||
function employeeListing($searchText = '', $page, $segment)
|
||||
{
|
||||
$this->db->select(' Emp.*,Dep.DepartmentName as DepartmentName');
|
||||
$this->db->from('T_Employee_Details Emp');
|
||||
|
||||
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
|
||||
if(!empty($searchText)) {
|
||||
$likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%'
|
||||
OR Emp.FirstName LIKE '%".$searchText."%'
|
||||
OR Emp.LastName LIKE '%".$searchText."%'
|
||||
OR Emp.ContactNumber LIKE '%".$searchText."%'
|
||||
OR Emp.EmailId LIKE '%".$searchText."%'
|
||||
OR Emp.Designation LIKE '%".$searchText."%'
|
||||
OR Dep.DepartmentName LIKE '%".$searchText."%'
|
||||
)";
|
||||
$this->db->where($likeCriteria);
|
||||
}
|
||||
|
||||
|
||||
$this->db->order_by("Emp.EmpID", "asc");
|
||||
$this->db->limit($page, $segment);
|
||||
$query = $this->db->get();
|
||||
//print_r( $this->db->last_query());
|
||||
$result = $query->result();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function getUserRoles()
|
||||
{
|
||||
$this->db->select('roleId, role');
|
||||
$this->db->from('tbl_roles');
|
||||
$this->db->where('roleId !=', 1);
|
||||
$query = $this->db->get();
|
||||
|
||||
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($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
|
||||
* @param number $userId : This is user id
|
||||
* @return array $result : This is user information
|
||||
*/
|
||||
|
||||
function addNewemployee($Employee)
|
||||
{
|
||||
|
||||
$this->db->insert('T_Employee_Details', $Employee);
|
||||
|
||||
$EmpID = $this->db->affected_rows();
|
||||
|
||||
return $EmpID;
|
||||
}
|
||||
|
||||
|
||||
function UpdateEmployee($Emp, $EmpID)
|
||||
{
|
||||
//echo $EmpID;
|
||||
$this->db->where('EmpID', $EmpID);
|
||||
$this->db->update('T_Employee_Details', $Emp);
|
||||
//print_r($this->db->last_query());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
function viewemployee( $EmpID)
|
||||
{
|
||||
$this->db->select('Emp.*,Dep.DepartmentName as DepartmentName');
|
||||
$this->db->from('T_Employee_Details AS Emp');
|
||||
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
|
||||
$this->db->where('Emp.EmpID', $EmpID);
|
||||
$query = $this->db->get();
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
// print_r($this->db->last_query());
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* This function to get the Employee department on respective Employee */
|
||||
function GetEmployeeDepartment($EmployeeID)
|
||||
{
|
||||
$this->db->select('DepartmentName');
|
||||
$this->db->from('T_EmployeeDetails');
|
||||
$this->db->where($EmployeeID);
|
||||
$query = $this->db->get();
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
function checkMailExists($email='',$Empid='')
|
||||
{
|
||||
$this->db->select('EmailId');
|
||||
$this->db->from('T_Employee_Details');
|
||||
$this->db->where('EmailId',$email);
|
||||
if ($Empid != '')
|
||||
{
|
||||
$this->db->where('EmpID !=',$Empid);
|
||||
}
|
||||
$query = $this->db->get();
|
||||
//print_r($this->db->last_query());
|
||||
if ($query->num_rows > 0) {
|
||||
return $query->result_array();
|
||||
}
|
||||
}
|
||||
|
||||
function checkPhotoExists($Pic)
|
||||
{
|
||||
$this->db->select('ProfilePic');
|
||||
$this->db->from('T_Employee_Details');
|
||||
$this->db->where($Pic);
|
||||
|
||||
$query = $this->db->get();
|
||||
// print_r($this->db->last_query());
|
||||
if ($query->num_rows > 0) {
|
||||
return $query->result_array();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user