db->select('ListCode'); $this->db->where('ListGroup', '1'); $this->db->where('ListName', $arrayDetails['ListName']); $this->db->where('BranchCode', $arrayDetails['BranchCode']); 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($reqBy, $reqBranch) { $this->db->select('ListCode,ListName,IsActive'); $this->db->where('ListGroup','1'); $this->db->where('BranchCode', $reqBranch); $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, $branch) { $this->db->select('ListName'); $this->db->where('ListName', $arrayDetails['ListName']); $this->db->where('BranchCode', $branch); $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; } public function getStatusBranchList( $id ) { $this->db->select('BranchCode, BranchName'); $this->db->from(BRANCH); $getBranchDetails = $this->db->get(); $branchDetails = $getBranchDetails->result(); if (count($branchDetails) > 0) { $results['branchListStatus'] = true; $results['branch_list_details'] = $branchDetails; } else { $results['branchListStatus'] = false; $results['message'] = "Branch Is Not Avail."; } return $results; } public function getBranchStatusList($branchCode) { echo $branchCode;exit(); } }