load->database(); } function name_list(){ //$this->db->order_by('id', 'DESC'); $query = $this->db->get('master_vendor'); return $query->result(); } function vendor_type(){ //$this->db->order_by('id', 'DESC'); $query = $this->db->get('master_vendor_type'); return $query->result(); } function save_name($post) { unset($post['submit']); $this->db->insert('master_vendor', $post); return $this->db->affected_rows(); } function updateVendor($post,$id) { unset($post['submit']); unset($post['id']); //print_r($post);die; $this->db->where('id', $id); $this->db->update('master_vendor',$post); return $this->db->affected_rows(); } function delete_name($id) { $this->db->where('id', $id); $this->db->delete('master_icd'); } function edit_name($post,$id){ $data = array( 'name' => $post['slotEditname'], ); $this->db->where('id', $id); $this->db->update('master_icd', $data); } function duplicate_entry($post) { $val = $post['val']; if (isset($post['currId'])) { $currId = $post['currId']; $query1 = $this->db->get_where('master_icd', array('id' => $currId)); $exceptVal = $query1->result()[0]->name; $this->db->where('name', $val); $this->db->where('name !=', $exceptVal); $query = $this->db->get('master_icd'); } else{ $query = $this->db->get_where('master_icd', array('name' => $val)); } if($query->num_rows() > 0) { return 'exist'; } else{ return 'notexist'; } } function status_change($post){ $id = $post['id']; $stat = $post['val']; $this->db->set('status', $stat); $this->db->where('id', $id); $this->db->update('master_vendor'); if($stat == '1') { return 'Status set active'; } else{ return 'Status set deactive'; } } function getWherevalue($id){ $this->db->where('id', $id); $query = $this->db->get('master_vendor'); return $query->row(); } function getNameBysearch($search) { if($orderColumn==0) $this->db->order_by('id', $orderType); else if($orderColumn==1) $this->db->order_by('name', $orderType); else if($orderColumn==2) $this->db->order_by('status', $orderType); $this->db->like('id', $search); $this->db->or_like('name', $search); $this->db->or_like('status', $search); $query = $this->db->get('master_vendor'); return $query->result(); } function getNameByLimit($limit, $start, $orderColumn, $orderType) { if($orderColumn==0) $this->db->order_by('id', $orderType); else if($orderColumn==1) $this->db->order_by('vedor_name', $orderType); else if($orderColumn==2) $this->db->order_by('vendor_phone', $orderType); $this->db->limit($limit, $start); $query = $this->db->get('master_vendor'); return $query->result(); } function getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType) { if($orderColumn==0) $this->db->order_by('id', $orderType); else if($orderColumn==1) $this->db->order_by('vedor_name', $orderType); else if($orderColumn==2) $this->db->order_by('vendor_phone', $orderType); $this->db->like('id', $search); $this->db->or_like('vedor_name', $search); $this->db->or_like('vendor_phone', $search); $this->db->limit($limit, $start); $query = $this->db->get('master_vendor'); return $query->result(); } function vendor_type_name($id) { $this->db->where('id', $id); $query = $this->db->get('master_vendor_type'); return $query->row()->name; } }