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); } //Model getCount public function getCount_Barang(){ $this->db->select('ID_BARANG'); $this->db->from('barang'); return $this->db->count_all_results(); } //Model yang dipakai public function getData_Barang($id = null){ if ($id === null) { $this->db->select('a.ID_BARANG,a.KODE_BARANG,a.NAMA_BARANG,a.JENIS_ID,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->order_by('a.KODE_BARANG ASC'); }else{ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where(['a.ID_BARANG' => $id]); $this->db->group_by('a.ID_BARANG'); $this->db->order_by('b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); } return $this->db->get()->result_array(); } public function getData_Barang_byKODE($id){ $this->db->select('*'); $this->db->from('barang'); $this->db->where(['KODE_BARANG' => $id]); return $this->db->get()->result_array(); } public function getData_Barang_byNAMA($id){ $this->db->select('*'); $this->db->from('barang'); $this->db->where(['NAMA_BARANG' => $id]); return $this->db->get()->result_array(); } public function getData_Barang_forAdmin($jenis_id = null, $merk_id = null, $model_id = null){ if ($jenis_id === null) { $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('merk c','c.ID_MERK=a.MERK_ID','left'); $this->db->join('model d','d.ID_MODEL=a.MODEL_ID','left'); $this->db->order_by('a.ID_BARANG DESC'); $this->db->where('a.ID_BARANG is NULL'); }else{ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('merk c','c.ID_MERK=a.MERK_ID','left'); $this->db->join('model d','d.ID_MODEL=a.MODEL_ID','left'); $this->db->where(['a.JENIS_ID' => $jenis_id]); if ($merk_id!=NULL) { $this->db->where(['a.MERK_ID' => $merk_id]); } if ($model_id!=NULL) { $this->db->where(['a.MODEL_ID' => $model_id]); } } return $this->db->get()->result_array(); } public function getData_Barang_forView($id = null){ if ($id === null) { $this->db->select('a.ID_BARANG,a.KODE_BARANG,a.NAMA_BARANG,a.JENIS_ID,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->order_by('a.ID_BARANG DESC'); }else{ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where(['a.ID_BARANG' => $id]); } return $this->db->get()->result_array(); } public function getData_Jenis_byID($id){ $this->db->select('*'); $this->db->from('jenis'); $this->db->where(['ID_JENIS' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarBeli_byBARANG($id){ $this->db->select('*'); $this->db->from('daftar_beli'); $this->db->where(['BARANG_ID' => $id]); return $this->db->get()->result_array(); } public function getData_DaftarOrder_byBARANG($id){ $this->db->select('*'); $this->db->from('daftar_order'); $this->db->where(['BARANG_ID' => $id]); return $this->db->get()->result_array(); } public function getData_SnStock_byBARANG($id){ $this->db->select('*'); $this->db->from('sn_stock'); $this->db->where(['BARANG_ID' => $id]); return $this->db->get()->result_array(); } public function getData_TransaksiStock_byBARANG($id){ $this->db->select('*'); $this->db->from('transaksi_stock'); $this->db->where(['BARANG_ID' => $id]); return $this->db->get()->result_array(); } //Model yang belum dipakai public function getID_BarangMax() { $this->db->select_max('ID_BARANG'); $this->db->from('barang'); return $this->db->get()->result_array(); } public function getDataBarangSetStock(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('daftar_beli b','b.BARANG_ID=a.ID_BARANG','left'); $this->db->where('b.BARANG_ID is NULL'); return $this->db->get()->result_array(); } public function getBarangKonsinyasi(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.BARANG_ID=a.ID_BARANG','left'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID','left'); $this->db->where('b.GLOBAL_KUANTITI!=0'); $this->db->where('c.TYPE_JENIS=1'); return $this->db->get()->result_array(); } public function getBarangBekasSewa(){ $this->db->select('*'); $this->db->from('daftar_snsewa a'); $this->db->join('daftar_sewa b','b.ID_DS=a.DS_ID','left'); $this->db->join('barang c','c.ID_BARANG=b.BARANG_ID','left'); $this->db->join('sn d','d.ID_SN=a.SN_ID','left'); $this->db->group_by('a.ID_SNSEWA'); $this->db->where('a.STATUS_SNSEWA=1'); return $this->db->get()->result_array(); } public function getSnKonsinyasi($id){ $this->db->select('*'); $this->db->from('sn a'); $this->db->join('daftar_konsinyasi b','b.ID_DK=a.DK_ID','left'); $this->db->join('konsinyasi c','c.ID_KONSINYASI=b.KONSINYASI_ID','left'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID','left'); $this->db->where(['c.PELANGGAN_ID' => $id]); $this->db->group_by('a.ID_SN'); return $this->db->get()->result_array(); } public function getSnBekasSewa(){ $this->db->select('*'); $this->db->from('sn a'); $this->db->join('daftar_sewa b','b.ID_DS=a.DS_ID','left'); $this->db->join('sewa c','c.ID_SEWA=b.SEWA_ID','left'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID','left'); $this->db->join('daftar_snsewa e','e.SN_ID=a.ID_SN','left'); $this->db->group_by('a.ID_SN'); $this->db->where('e.STATUS_SNSEWA=1'); return $this->db->get()->result_array(); } public function getBarangKeluarMasuk(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.BARANG_ID=a.ID_BARANG','left'); $this->db->where('b.GLOBAL_KUANTITI!=0'); $this->db->where('a.JENIS_ID>=7'); $this->db->group_by('a.ID_BARANG'); return $this->db->get()->result_array(); } public function getBarang_Pending(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('b.PCM_KUANTITI!=0'); $this->db->order_by('b.PCM_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_Peminjaman(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('b.PCM_KUANTITI!=0'); $this->db->order_by('b.PCM_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_Service(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('b.PCM_KUANTITI!=0'); $this->db->order_by('b.PCM_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_Konsinyasi(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('b.PCM_KUANTITI!=0'); $this->db->order_by('b.PCM_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_TransaksiStock0(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID','left'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG','left'); $this->db->where('b.TYPE_JENIS!=2'); $this->db->where('c.PCM_KUANTITI!=0'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_TransaksiStock1(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID','left'); $this->db->order_by('b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); $this->db->where('b.TYPE_JENIS!=2'); return $this->db->get()->result_array(); } public function getBarangNonSN(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.BARANG_ID=a.ID_BARANG','left'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID','left'); $this->db->where('b.PCM_KUANTITI!=0'); $this->db->where('c.TYPE_JENIS=0'); return $this->db->get()->result_array(); } public function getBarangSn(){ $this->db->select('*'); $this->db->from('sn a'); $this->db->join('barang b','b.ID_BARANG=a.BARANG_ID','left'); $this->db->where('a.STATUS_SN is NULL'); $this->db->group_by('a.ID_SN'); return $this->db->get()->result_array(); } public function getID_BARANG() { $this->db->select_max('ID_BARANG'); $this->db->from('barang'); return $this->db->get()->result_array(); } public function delKuantiti($id){ $this->db->where(['BARANG_ID' => $id]); $this->db->delete('kuantiti'); } public function delDaftarHarga($id){ $this->db->where(['BARANG_ID' => $id]); $this->db->delete('daftar_harga'); } public function delStock($id){ $this->db->where(['BARANG_ID' => $id]); $this->db->delete('stock'); } public function getDataBarangPembelian($id = null){ if ($id === null) { $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID','left'); $this->db->order_by('KODE_BARANG','ASC'); }else{ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID','left'); $this->db->where('a.TYPE_BARANG="SKU"'); $this->db->or_where('a.TYPE_BARANG="RETAIL"'); $this->db->where(['a.ID_BARANG' => $id]); } return $this->db->get()->result_array(); } public function getDataBarangQtyReal($id = null){ if ($id === null) { $this->db->select('a.QTY_REAL'); $this->db->from('barang a'); $this->db->join('stock b','b.BARANG_ID=a.ID_BARANG'); }else{ $this->db->select('a.QTY_REAL'); $this->db->from('barang a'); $this->db->join('stock b','b.BARANG_ID=a.ID_BARANG'); $this->db->where(['a.ID_BARANG' => $id]); } return $this->db->get()->result_array(); } public function getDataBarangQtyRealIDStock($id = null){ if ($id === null) { $this->db->select('a.QTY_REAL,a.ID_BARANG,b.BLOCKADDSN'); $this->db->from('barang a'); $this->db->join('stock b','b.BARANG_ID=a.ID_BARANG'); }else{ $this->db->select('a.QTY_REAL,a.ID_BARANG'); $this->db->from('barang a'); $this->db->join('stock b','b.BARANG_ID=a.ID_BARANG'); $this->db->where(['b.ID_STOCK' => $id]); } return $this->db->get()->result_array(); } public function getDataStockQty($id = null){ if ($id === null) { $this->db->select('b.QTY'); $this->db->from('barang a'); $this->db->join('stock b','b.BARANG_ID=a.ID_BARANG'); }else{ $this->db->select('b.QTY'); $this->db->from('barang a'); $this->db->join('stock b','b.BARANG_ID=a.ID_BARANG'); $this->db->where(['b.ID_STOCK' => $id]); } return $this->db->get()->result_array(); } 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(); } //Model Get Barang public function getBarang_Sewa(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG','left'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID','left'); $this->db->where('b.SEWA_KUANTITI!=0'); $this->db->where('c.TYPE_JENIS=1'); return $this->db->get()->result_array(); } public function getBarang_Operasional(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG','left'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID','left'); $this->db->where('b.PCM_KUANTITI!=0'); $this->db->order_by('b.PCM_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_Proyek_PCM(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('b.PCM_KUANTITI!=0'); $this->db->order_by('b.PCM_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_Proyek_SP(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('b.PROYEK_KUANTITI!=0'); $this->db->order_by('b.PROYEK_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_Proyek_Plot(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID'); $this->db->where('b.PLOT_KUANTITI!=0'); $this->db->order_by('b.PLOT_KUANTITI DESC,c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Non-Jasa public function getBarang_TypeAll_NonJasa(){ $this->db->select('a.ID_BARANG,c.PCM_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('b.TYPE_JENIS!=2'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_TypeAll_NonJasaITP(){ $this->db->select('a.ID_BARANG,c.ITP_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('b.TYPE_JENIS!=2'); $this->db->order_by('b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_Type0_NonJasaITP(){ $this->db->select('a.ID_BARANG,c.ITP_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('b.TYPE_JENIS=0'); $this->db->order_by('b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Non-QTY public function getBarang_TypeAll_NonQty(){ $this->db->select('a.ID_BARANG,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where('b.TYPE_JENIS=2'); $this->db->order_by('b.TYPE_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang yang bisa Dimodif public function getBarang_Type01(){ $this->db->select('a.ID_BARANG,c.PCM_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('a.JENIS_ID<=5'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Non-QTY public function getBarang_Type02(){ $this->db->select('a.ID_BARANG,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->where('b.TYPE_JENIS=2'); $this->db->order_by('b.TYPE_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Material, Kabel, dll public function getBarang_Type03(){ $this->db->select('a.ID_BARANG,c.PCM_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('a.JENIS_ID=14 OR a.JENIS_ID=11 OR a.JENIS_ID=9 OR a.JENIS_ID=10'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Retail, Sn ataupun Non-SN, Cabutan public function getBarang_Type04(){ $this->db->select('a.ID_BARANG,c.PCM_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('a.JENIS_ID=6 OR a.JENIS_ID=7 OR a.JENIS_ID=8 OR a.JENIS_ID=9 OR a.JENIS_ID=10 OR a.JENIS_ID=13 OR a.JENIS_ID=16 OR a.JENIS_ID=17 OR a.JENIS_ID=25'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Software, License public function getBarang_Type05(){ $this->db->select('a.ID_BARANG,c.PCM_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('a.JENIS_ID=12 OR a.JENIS_ID=21'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Sparepart, Service public function getBarang_Type06(){ $this->db->select('a.ID_BARANG,c.PCM_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('a.JENIS_ID=15'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } //Semua Barang Sparepart tanpa Cabutan public function getBarang_Type07(){ $this->db->select('a.ID_BARANG,c.PCM_KUANTITI,a.KODE_BARANG,a.NAMA_BARANG,b.NAMA_JENIS'); $this->db->from('barang a'); $this->db->join('jenis b','b.ID_JENIS=a.JENIS_ID'); $this->db->join('kuantiti c','c.ID_KUANTITI=a.ID_BARANG'); $this->db->where('a.JENIS_ID=15'); $this->db->order_by('c.PCM_KUANTITI DESC,b.NAMA_JENIS ASC,a.KODE_BARANG ASC'); return $this->db->get()->result_array(); } public function getBarang_DaftarBeli(){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('daftar_beli b','b.BARANG_ID=a.ID_BARANG','left'); $this->db->join('jenis c','c.ID_JENIS=a.JENIS_ID','left'); $this->db->order_by('c.NAMA_JENIS ASC,a.KODE_BARANG ASC'); $this->db->group_by('a.KODE_BARANG'); $this->db->where('a.JENIS_ID!=6'); $this->db->where('c.TYPE_JENIS!=2'); return $this->db->get()->result_array(); } public function getBarang_DaftarReturBeli($id){ $this->db->select('*'); $this->db->from('barang a'); $this->db->join('kuantiti b','b.ID_KUANTITI=a.ID_BARANG','left'); $this->db->join('daftar_beli c','c.BARANG_ID=b.ID_KUANTITI','left'); $this->db->join('pembelian d','d.ID_PEMBELIAN=c.PEMBELIAN_ID','left'); $this->db->join('retur_pembelian e','e.SUPPLIER_ID=d.SUPPLIER_ID','left'); $this->db->order_by('a.KODE_BARANG','ASC'); $this->db->group_by('a.KODE_BARANG'); $this->db->where(['e.SUPPLIER_ID' => $id]); return $this->db->get()->result_array(); } //Model Get Sn public function getSn_Sewa($id){ $this->db->select('*'); $this->db->from('sn a'); $this->db->join('daftar_sewa b','b.ID_DS=a.DS_ID','left'); $this->db->join('sewa c','c.ID_SEWA=b.SEWA_ID','left'); $this->db->join('barang d','d.ID_BARANG=a.BARANG_ID','left'); $this->db->where(['c.PELANGGAN_ID' => $id]); $this->db->group_by('a.ID_SN'); return $this->db->get()->result_array(); } } ?>