add rssa-pintar to git
This commit is contained in:
No files matched your search
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
class M_radiologi extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$query = $this->db->get('master_radiologi');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function status() {
|
||||
$this->db->order_by('mro_nama', 'ASC');
|
||||
$this->db->where('mro_status', 1);
|
||||
$query = $this->db->get('master_radiologi');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function statusdetail() {
|
||||
$this->db->join('master_radiologi', 'master_radiologi.mro_id = master_radiologi_detail.mrod_mro_id','left');
|
||||
$this->db->order_by('mro_nama', 'ASC');
|
||||
$this->db->order_by('mrod_nama', 'ASC');
|
||||
$this->db->where('mrod_status', 1);
|
||||
$query = $this->db->get('master_radiologi_detail');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$insert = array(
|
||||
'mro_nama' => $this->input->post('nama'),
|
||||
'mro_keterangan' => $this->input->post('keterangan'),
|
||||
'mro_status' => 1,
|
||||
);
|
||||
$insert = $this->db->insert('master_radiologi', $insert);
|
||||
$id = $this->db->insert_id();
|
||||
|
||||
$status = $_POST['statusdetail'];$num=0;
|
||||
foreach($status as $key =>$datanya)
|
||||
{
|
||||
$insert_data = array(
|
||||
'mrod_nama' => $_POST['detail'][$num],
|
||||
'mrod_keterangan' => $_POST['ket'][$num],
|
||||
'mrod_status' => $_POST['statusdetail'][$num],
|
||||
'mrod_mro_id' => $id,
|
||||
);
|
||||
$insert = $this->db->insert('master_radiologi_detail', $insert_data);
|
||||
|
||||
$num++;
|
||||
}
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('mro_id', $id);
|
||||
$query = $this->db->get('master_radiologi');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function editdetail($id) {
|
||||
$this->db->where('mrod_mro_id', $id);
|
||||
$query = $this->db->get('master_radiologi_detail');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$update = array(
|
||||
'mro_nama' => $this->input->post('nama'),
|
||||
'mro_keterangan' => $this->input->post('keterangan'),
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mro_id', $id);
|
||||
$this->db->update('master_radiologi', $update);
|
||||
|
||||
$status = $_POST['statusdetail'];$num=0;
|
||||
foreach($status as $key =>$datanya)
|
||||
{
|
||||
$data = array(
|
||||
'mrod_nama' => $_POST['detail'][$num],
|
||||
'mrod_keterangan' => $_POST['ket'][$num],
|
||||
'mrod_status' => $_POST['statusdetail'][$num],
|
||||
'mrod_mro_id' => $id,
|
||||
);
|
||||
if($_POST['baru'][$num]=="2"){
|
||||
$this->db->where('mrod_id', $_POST['iddetail'][$num]);
|
||||
$this->db->update('master_radiologi_detail', $data);
|
||||
}else{
|
||||
$insert = $this->db->insert('master_radiologi_detail', $data);
|
||||
}
|
||||
$num++;
|
||||
}
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mro_id', $id);
|
||||
$this->db->delete('master_radiologi');
|
||||
|
||||
$this->db->where('mrod_mro_id', $id);
|
||||
$this->db->delete('master_radiologi_detail');
|
||||
}
|
||||
|
||||
function deletedetail($id) {
|
||||
$this->db->where('mrod_id', $id);
|
||||
$this->db->delete('master_radiologi_detail');
|
||||
}
|
||||
|
||||
function disabled($id) {
|
||||
$update_data = array(
|
||||
'mro_status' => 0,
|
||||
);
|
||||
$this->db->where('mro_id', $id);
|
||||
$this->db->update('master_radiologi', $update_data);
|
||||
|
||||
$update_data_detail = array(
|
||||
'mrod_status' => 0,
|
||||
);
|
||||
$this->db->where('mrod_mro_id', $id);
|
||||
$this->db->update('master_radiologi_detail', $update_data_detail);
|
||||
}
|
||||
|
||||
function aktif($id) {
|
||||
$update_data = array(
|
||||
'mro_status' => 1,
|
||||
);
|
||||
$this->db->where('mro_id', $id);
|
||||
$this->db->update('master_radiologi', $update_data);
|
||||
|
||||
$update_data_detail = array(
|
||||
'mrod_status' => 1,
|
||||
);
|
||||
$this->db->where('mrod_mro_id', $id);
|
||||
$this->db->update('master_radiologi_detail', $update_data_detail);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user