copy dari repo om Irfan

This commit is contained in:
2026-06-13 16:02:07 +10:00
commit db327c0305
5376 changed files with 2770667 additions and 0 deletions
@@ -0,0 +1,63 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class ModelDaftarHarga extends CI_Model {
public function create($table, $data, $batch = false)
{
if($batch === false){
$insert = $this->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 getDataDaftarHarga($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('daftar_harga');
}else{
$this->db->select('*');
$this->db->from('daftar_harga');
$this->db->where(['ID_DH' => $id]);
}
return $this->db->get()->result_array();
}
public function getDataDaftarHargaKonsistensi($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('barang a');
$this->db->join('daftar_harga b','b.ID_DH=a.DH_ID','right');
$this->db->order_by('b.ID_DH','ASC');
$this->db->group_by('b.ID_DH','ASC');
}else{
$this->db->select('*');
$this->db->from('barang a');
$this->db->join('daftar_harga b','b.ID_DH=a.DH_ID','right');
$this->db->order_by('b.ID_DH','ASC');
$this->db->group_by('b.ID_DH','ASC');
$this->db->where(['b.ID_DH' => $id]);
}
return $this->db->get()->result_array();
}
}
?>