db->select('ListCode'); $this->db->where('ListGroup', '1'); $this->db->where('ListName', $arrayDetails['ListName']); if($this->db->get(PICK_LIST_DETAILS)->first_row()){ $result['Status'] = false; $result['message'] = "Status name is already exist!"; } else { $this->db->insert(PICK_LIST_DETAILS, $arrayDetails); if($this->db->affected_rows() == '1'){ $result['Status'] = true; $result['message'] = "Successfully status details added"; } else { $result['Status'] = false; $result['message'] = "Something went wrong.please try again"; } } // $checkExistActivity = $this->db->get(PICK_LIST_DETAILS); return $result; } /* * get status details * parama id * created by Surendiran * */ public function getStatus() { $this->db->select('ListCode,ListName,IsActive'); $this->db->where('ListGroup','1'); $this->db->order_by('ListCode','DESC'); $statusDetails = $this->db->get(PICK_LIST_DETAILS); if($statusDetails->result()){ $result['Status'] = true; $result['details'] = $statusDetails->result(); } else { $result['Status'] = false; $result['message'] = "No records found!"; } return $result; } /* * update status details * created by Surendiran * */ public function update($arrayDetails=null,$ListCode=null) { $this->db->select('ListName'); $this->db->where('ListName', $arrayDetails['ListName']); $this->db->where_not_in('ListCode', $ListCode); if($this->db->get(PICK_LIST_DETAILS)->first_row()){ $result['Status'] = false; $result['message'] = "Status name is already exist!"; } else { $this->db->where('ListCode',$ListCode); $this->db->update(PICK_LIST_DETAILS, $arrayDetails); if($this->db->affected_rows() == '1'){ $result['Status'] = true; $result['message'] = "Successfully status details updated"; } else { $result['Status'] = false; $result['message'] = "Something went wrong.please try again"; } } return $result; } }