db->insert($table, $data); }else{ $insert = $this->db->insert_batch($table, $data); } return $insert; } public function update($table, $data, $pk, $id = null, $batch = false) { if($batch === false){ $insert = $this->db->update($table, $data, array($pk => $id)); }else{ $insert = $this->db->update_batch($table, $data, $pk); } return $insert; } public function delete($table, $data, $pk) { $this->db->where_in($pk, $data); return $this->db->delete($table); } //Terpakai public function getData_Jenis($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('jenis'); $this->db->order_by('NAMA_JENIS ASC'); } else { $this->db->select('*'); $this->db->from('jenis'); $this->db->where(['ID_JENIS' => $id]); } return $this->db->get()->result_array(); } public function getData_Barang_byJENIS($id){ $this->db->select('*'); $this->db->from('barang'); $this->db->where(['JENIS_ID' => $id]); return $this->db->get()->result_array(); } public function getData_Jenis_forKlaim($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('jenis'); $this->db->where('TYPE_JENIS=1'); $this->db->where('ID_JENIS<=5 OR ID_JENIS=8'); $this->db->order_by('NAMA_JENIS ASC'); } else { $this->db->select('*'); $this->db->from('jenis'); $this->db->where(['ID_JENIS' => $id]); } return $this->db->get()->result_array(); } //Tidak Terpakai public function getDataJenisBarang($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('jenis'); $this->db->where('NAMA_JENIS!="Cabutan"'); $this->db->order_by('NAMA_JENIS ASC'); }else{ $this->db->select('*'); $this->db->from('jenis'); $this->db->where(['ID_JENIS' => $id]); $this->db->where('NAMA_JENIS!="Cabutan"'); } return $this->db->get()->result_array(); } public function getDataJenisKonsistensi($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID','right'); $this->db->order_by('b.NAMA_JENIS ASC'); $this->db->group_by('b.ID_JENIS'); }else{ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID','right'); $this->db->order_by('b.NAMA_JENIS ASC'); $this->db->group_by('b.ID_JENIS'); $this->db->where(['b.ID_JENIS' => $id]); } return $this->db->get()->result_array(); } } ?>