93 lines
2.1 KiB
PHP
93 lines
2.1 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ManagePajak extends CI_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('ModelPajak', 'MP');
|
|
$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()
|
|
{
|
|
|
|
$datPajak = $this->MP->getDataPajak();
|
|
|
|
$data = [
|
|
'sidebar' => "master data",
|
|
'navChild' => "",
|
|
'pajak' => $datPajak
|
|
];
|
|
|
|
$this->load->view('master/Pajak', $data);
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_pajak = $this->input->post('id');
|
|
$kode_pajak = $this->input->post('kode_pajak');
|
|
$nama_pajak = $this->input->post('nama_pajak');
|
|
|
|
$input = [
|
|
'NAMA_PAJAK' => $nama_pajak,
|
|
'KODE_PAJAK' => $kode_pajak,
|
|
'SALDO_PAJAK' => '0',
|
|
'HUTANG_PAJAK' => '0'
|
|
];
|
|
|
|
$action = $this->MP->create('pajak', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('flash', 'ditambah');
|
|
redirect('ManagePajak');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'ditambah');
|
|
redirect('ManagePajak');
|
|
}
|
|
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_pajak = $this->input->post('id_pajak');
|
|
$kode_pajak = $this->input->post('kode_pajaked');
|
|
$nama_pajak = $this->input->post('nama_pajaked');
|
|
|
|
$update = [
|
|
'NAMA_PAJAK' => $nama_pajak,
|
|
'KODE_PAJAK' => $kode_pajak
|
|
];
|
|
|
|
$action = $this->MP->update('pajak', $update,'ID_PAJAK',$id_pajak);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('flash', 'diedit');
|
|
redirect('ManagePajak');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'diedit');
|
|
redirect('ManagePajak');
|
|
}
|
|
|
|
}
|
|
|
|
public function hapus()
|
|
{
|
|
$id = $this->input->post('id');
|
|
if ($this->MP->delete('pajak', $id, 'ID_PAJAK')) {
|
|
$action = $this ->MP->delete('pajak',$id,'ID_PAJAK');
|
|
$this->session->set_flashdata('flash', 'dihapus');
|
|
redirect('ManagePajak');
|
|
}
|
|
}
|
|
|
|
}
|