defined('BASEPATH') OR exit('No direct script access allowed');
class Site extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('boost');
$this->load->library('Ruplib');
$this->load->library('skripsi');
$this->load->helper('date');
}
public function index()
{
$table = 'tb_karyawan';
$data['row'] = $this->boost->ambil($table);
$data['pesan'] = $this->skripsi->kerjakan();
//$data['rp'] = $this->ruplib->rupiah($id);
//echo '<pre>';
//echo print_r($data['row']);
//echo '</pre>';
$data['main_content'] = 'master/vSite';
$this->load->view('template/main', $data);
}
public function daftar_gaji()
{
$table = 'tb_gaji';
$data['row'] = $this->boost->all_transfer_detail();
//$data['pesan'] = $this->skripsi->kerjakan();
//$data['rp'] = $this->ruplib->rupiah($id);
//echo '<pre>';
//echo print_r($data['row']);
//echo '</pre>';
$data['main_content'] = 'master/daftar_gaji';
$this->load->view('template/main', $data);
}
public function transfer_tambah(){
$id= $this->input->post('id');
$jam_lembur = $this->input->post('jam_lembur');
$uang_lembur = $this->input->post('uang_lembur');
$bulan_transfer = $this->input->post('bulan');
$tgl_transfer = $this->input->post('tgl_transfer');
$jam_transfer = $this->input->post('jam_transfer');
$gaji = $this->input->post('gaji');
$total_gaji = $uang_lembur + $gaji; // total gaji
$data = array( 'kary_id' => $id,
'jam_lembur' => $jam_lembur,
'uang_lembur' => $uang_lembur,
'total_gaji' => $total_gaji,
'bulan_transfer' => $bulan_transfer,
'tgl_transfer' => $tgl_transfer,
'jam_transfer' => $jam_transfer
);
//var_dump($data);
//die();
$this->db->insert('tb_gaji', $data);
$url = 'site/transfer_detail/'.$id;
redirect($url);
}
public function transfer_detail($id){
//die($id.'td');
//$data['now'] = "%Y Month: %m Day: %d - %h:%i %a";
$data['row'] = $this->boost->transfer_detail($id);
$data['main_content'] = 'master/transfer_detail';
$this->load->view('template/main', $data);
}
public function transfer($id){
//$data['now'] = "%Y Month: %m Day: %d - %h:%i %a";
$data['row'] = $this->boost->edit($id);
$data['main_content'] = 'master/transfer';
$this->load->view('template/main', $data);
}
public function delete($id){
$this->boost->delete($id);
redirect('site');
}
public function input()
{
//die('input');
$data['main_content'] = 'master/data_input';
$this->load->view('template/main', $data);
}
public function tambah(){
$nm = $this->input->post('nm');
$al = $this->input->post('al');
$norek = $this->input->post('norek');
$gaji = $this->input->post('gaji');
$gol = $this->input->post('gol');
$data = array( 'nama_kar' => $nm,
'alamat_kar' => $al,
'no_rek' => $norek,
'gaji_utama' => $gaji ,
'gol_kar' => $gol
);
//var_dump($data);
//die();
$this->db->insert('tb_karyawan', $data);
redirect('site');
}
public function edit($id){
$data['row'] = $this->boost->edit($id);
$data['main_content'] = 'master/data_edit';
$this->load->view('template/main', $data);
}
public function update(){
$table = "tb_karyawan";
$nm = $this->input->post('nm');
$al = $this->input->post('al');
$norek = $this->input->post('norek');
$gaji = $this->input->post('gaji');
$gol = $this->input->post('gol');
$id = $this->input->post('id');
$field = " nama_kar = '$nm',
alamat_kar = '$al',
no_rek = '$norek',
gaji_utama = '$gaji' ,
gol_kar = '$gol'
";
$kondisi = "WHERE kary_id = $id";
$data['row'] = $this->boost->update($table, $field, $kondisi);
redirect('site');
}
}
0 Response to "controller site.php"
Posting Komentar