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,127 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageBank extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
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() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datBank = $this->Dashboard->getData_Bank();
$no = 0;
foreach ($datBank as $key) {
$datSb = $this->Dashboard->getData_SaldoBank_byBANK($key['ID_BANK']);
$datKasbank = $this->Dashboard->getData_Kasbank_byBANK($key['ID_BANK']);
if ($datSb==TRUE OR $datKasbank==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datBank[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['BANK_SHM']==0) {
$akses = "Tidak Berhak";
$datBank = NULL;
} else if ($datShm[0]['BANK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['BANK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'bank' => $datBank,
'hak' => $datShm[0]['BANK_SHM'],
'akses' => $akses,
];
$this->load->view('master/Bank', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_bank = $this->input->post('id');
$kode_bank = $this->input->post('kode_bank');
$nama_bank = $this->input->post('nama_bank');
$kode_bank = strtoupper($kode_bank);
$nama_bank = strtoupper($nama_bank);
$input = [
'NAMA_BANK' => $nama_bank,
'KODE_BANK' => $kode_bank
];
$action = $this->Dashboard->create('bank', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageBank');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageBank');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_bank = $this->input->post('id_banked');
$kode_bank = $this->input->post('kode_banked');
$nama_bank = $this->input->post('nama_banked');
$kode_bank = strtoupper($kode_bank);
$nama_bank = strtoupper($nama_bank);
$update = [
'NAMA_BANK' => $nama_bank,
'KODE_BANK' => $kode_bank
];
$action = $this->Dashboard->update('bank', $update, 'ID_BANK', $id_bank);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageBank');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageBank');
}
}
public function hapus() {
$id = $this->input->post('id_bankdel');
$datSb = $this->Dashboard->getData_SaldoBank_byBANK($id);
$datKasbank = $this->Dashboard->getData_Kasbank_byBANK($id);
if ($datSaldoBank==TRUE OR $datKasbank==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageBank');
}
$action = $this ->Dashboard->delete('bank', $id, 'ID_BANK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageBank');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageBank');
}
}
}