copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageNeraca extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelNeraca', 'MN');
|
||||
$this->load->library(['datatables', 'form_validation']);
|
||||
$this->form_validation->set_error_delimiters('', '');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
|
||||
$datNeraca = $this->MN->getDataNeraca();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'neraca' => $datNeraca
|
||||
];
|
||||
|
||||
$this->load->view('master/Neraca', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_neraca = $this->input->post('id');
|
||||
$nama_neraca = $this->input->post('nama_neraca');
|
||||
$kode_neraca = $this->input->post('kode_neraca');
|
||||
$type_neraca = $this->input->post('type_neraca');
|
||||
|
||||
$input = [
|
||||
'NAMA_NERACA' => $nama_neraca,
|
||||
'KODE_NERACA' => $kode_neraca,
|
||||
'TYPE_NERACA' => $type_neraca
|
||||
];
|
||||
|
||||
$action = $this->MN->create('neraca', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageNeraca');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageNeraca');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_neraca = $this->input->post('id_neraca');
|
||||
$nama_neraca = $this->input->post('nama_neracaed');
|
||||
$kode_neraca = $this->input->post('kode_neracaed');
|
||||
$type_neraca = $this->input->post('type_neracaed');
|
||||
|
||||
$update = [
|
||||
'NAMA_NERACA' => $nama_neraca,
|
||||
'KODE_NERACA' => $kode_neraca,
|
||||
'TYPE_NERACA' => $type_neraca
|
||||
];
|
||||
|
||||
$action = $this->MN->update('neraca', $update,'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageNeraca');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageNeraca');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MN->delete('neraca', $id, 'ID_NERACA')) {
|
||||
$action = $this ->MN->delete('neraca',$id,'ID_NERACA');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageNeraca');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user