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); } public function getDataLicense($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('license a'); $this->db->join('type b','b.ID_TYPE=a.TYPE_ID','left'); $this->db->join('kurir c','c.ID_KURIR=a.KURIR_ID','left'); $this->db->order_by('ID_LICENSE','ASC'); }else{ $this->db->select('*'); $this->db->from('license a'); $this->db->join('type b','b.ID_TYPE=a.TYPE_ID','left'); $this->db->join('kurir c','c.ID_KURIR=a.KURIR_ID','left'); $this->db->order_by('ID_LICENSE','ASC'); $this->db->where(['ID_LICENSE' => $id]); } return $this->db->get()->result_array(); } public function getCountLicense($id = null){ if ($id === null) { $this->db->select('ID_LICENSE'); $this->db->from('license'); }else{ $this->db->select('ID_LICENSE'); $this->db->from('license'); } return $this->db->count_all_results(); } public function getCountLicenseBelum($id = null){ if ($id === null) { $this->db->select('ID_LICENSE'); $this->db->from('license'); $this->db->where('STATUS_LICENSE="Belum Ready"'); } return $this->db->count_all_results(); } public function getCountLicenseSudah($id = null){ if ($id === null) { $this->db->select('ID_LICENSE'); $this->db->from('license'); $this->db->where('STATUS_LICENSE="Ready"'); } return $this->db->count_all_results(); } public function getCountLicenseTerkirim($id = null){ if ($id === null) { $this->db->select('ID_LICENSE'); $this->db->from('license'); $this->db->where('STATUS_LICENSE="Terkirim"'); } return $this->db->count_all_results(); } public function cekPass($id, $pass) { $this->db->select('*'); $this->db->from('karyawan'); $this->db->where(['ID_KARYAWAN' => $id]); $this->db->where(['PASSWORD' => $pass]); return $this->db->get()->result_array(); } } ?>