db->select('users.name, employees.user_id'); $this->db->from('users'); $this->db->join('employees', 'employees.user_id = users.id'); $this->db->where('users.business_id', $business_id); $this->db->where('users.is_active', 1); $this->db->where('employees.is_active', 1); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->result(); } else { return; } } public function Get_Delegation_list($business_id) { $this->db->select('A.* , name', 'users.name'); $this->db->from('delegation A'); $this->db->join('users', 'users.id = A.delegated_to', 'left'); $this->db->where('A.business_id', $business_id); $this->db->order_by('id','DESC'); $this->db->where('A.is_active', 1); $query = $this->db->get(); $query = $query->result(); return $query; } public function Get_emp_name_list($get_emp_id, $business_id) { $this->db->select('name'); $this->db->from('users'); $this->db->where('id', $get_emp_id); $this->db->where('business_id', $business_id); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->result(); } else { return; } } public function Delegation_list_by_id($id) { $this->db->select('A.*, name', 'users.name'); $this->db->from('delegation A'); $this->db->join('users', 'users.id = A.delegated_to', 'left'); $this->db->where('md5(A.id)', $id); $this->db->where('A.is_active', 1); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->result(); } else { return; } } public function ExpenceDecline($id, $data) { $this->db->where('id',$id); $this->db->where('status', 'pending'); $this->db->update('expence_list', $data); return; } public function Expencecancle($id, $data) { $this->db->where('md5(id)',$id); $this->db->where('status', 'pending'); $this->db->update('expence_list', $data); return; } public function checkUniqueValueInDataBase($table, $where, $data){ $this->db->select('*'); $this->db->from($table); $this->db->where($where, $data); $this->db->where('is_active', 1); return $this->db->get()->result_array(); } }