function updateStatusGaji($idtg, $status)
 {
     $tg01 = tg01::find($idtg);
     $tg01->status = "Y";
     $tg01->save();
 }
 public function savebonus()
 {
     //Input POST
     $idtg = Input::get("idtg");
     $ttlbns = Input::get("ttlbns");
     // 1. setting validasi
     $messages = array('required' => 'Inputan <b>Tidak Boleh Kosong</b>!', 'numeric' => 'Inputan <b>Harus Angka</b>!', 'same' => 'Password <b>Tidak Sama</b>!');
     $validator = Validator::make(Input::all(), array("ttlbns" => "required"), $messages);
     // 2a. jika semua validasi terpenuhi simpan ke database
     if ($validator->passes()) {
         $tg01 = tg01::find($idtg);
         $tg01->ttlbns = $ttlbns;
         $tg01->save();
         Session::flash('tg01_success', 'Gaji Bonus Telah Ditambahkan!');
         // Redirect ke url + menuju div tertentu
         $url = URL::action("TransaksiTransferController@show", ['id' => $idtg]);
         return Redirect::to($url);
     } else {
         return Redirect::to('inputdata/detail/' . $idtg)->withErrors($validator)->withInput();
     }
 }
 public function detail($id)
 {
     $success = Session::get('tg01_success');
     $danger = Session::get('tg01_danger');
     $tg01 = tg01::find($id);
     $tg02 = new tg02();
     //        $tg02 = tg02::whereRaw();
     $karyawan = mk01::find($tg01->idkar);
     $data = array("karyawan" => $karyawan, "gaji" => $tg01, "gajis" => $tg02->getDetailGajiKaryawan($id), "infogajis" => $tg01->getJamKerjaInSec($tg01->idkar, $tg01->tglgjsblm), "tg01_success" => $success, "tg01_danger" => $danger);
     return View::make('transaksi.trans_gaji_detail_karyawan', $data);
 }