<?php
defined('BASEPATH') or exit('No direct script access allowed');

class ControllerSaleryKaryawan extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();
        //validasi jika user belum login
        check_not_login();
        if ($this->session->userdata('level') != 2) {
            redirect();
        }
        $this->set_timezone();
        $this->load->library('encrypt');
        $this->load->library('form_validation');
        $this->load->library('Mycustom');
        $this->load->library('pdfgenerator');
        $this->load->library('Notifikasi');
        $this->load->model('bagian_manager/insert_model');
        $this->load->model('bagian_manager/select_model');
        $this->load->model('bagian_manager/update_model');
    }
    public function set_timezone()
    {
        date_default_timezone_set("Asia/Jakarta");
    }
    // Gaji Diri Sendiri
    public function index() {}
    // Karyawan GAji
    public function detail_gaji($id)
    {
        // NOtifikasi
        $notif            = $this->notifikasi->notif_manager();
        $data_login       = $this->userlogin->user_login('isloggedin');
        $data_id_login    = $this->session->userdata('isloggedin');
        // Query SQL Data atau isi data page
        // Data gaji
        $gaji_id = $this->encrypt->decode($id);
        $data_gaji = $this->db->get_where('k_gaji', ['id' => $gaji_id])->row_array();
        $detail_gaji = $this->db->get_where('k_dgaji', ['gaji_id' => $gaji_id])->result();
        $identitas_karyawan = $this->db->get_where('sistem_login', ['id' => $data_gaji['login_id']])->row_array();
        $detail_identitas = $this->db->get_where('sistem_identitas', ['login_id' => $data_gaji['login_id']])->row_array();
        $data = array(
            // Untuk memanggil halaman sesuai menu
            'folder'              => 'kas/gaji_detail/',
            'page'                => 'index',
            'judul'               => 'Detail Gaji Karyawan || Bagian Keuangan',
            'notif'               => $notif,
            // Isi data
            'data_id_login'       => $data_id_login,
            'data_login'          => $data_login,
            // Data isian konten
            'identitas'           => $identitas_karyawan,
            'gaji'                => $data_gaji,
            'detail_gaji'         => $detail_gaji,
            'detail_identitas'    => $detail_identitas
        );
        $this->load->view('manager/index', $data);
    }
}

/* End of file ControllerSaleryKaryawan.php and path \application\controllers\manager\sistem\ControllerSaleryKaryawan.php */