public function payment($id)
 {
     $tg01 = tg01::find($id);
     $check = new tg01();
     // update hutang
     $idph = $check->checkExistHutangKaryawan($tg01->tgltg, $tg01->idkar);
     if ($idph != -1) {
         $th02 = th02::find($idph);
         $th02->idtg = $id;
         $th02->status = 'Y';
         $th02->save();
         $mk01 = mk01::find($tg01->idkar);
         $mk01->htsld = $mk01->htsld + $th02->nilhut;
         $mk01->save();
         //            echo "- ada hutang <br>";
     }
     // update tabungan
     $idtb = $check->checkExistTabunganKaryawan($tg01->tgltg, $tg01->idkar);
     if ($idtb != -1) {
         $tt01 = tt01::find($idtb);
         $tt01->idtg = $id;
         $tt01->save();
         $mk01 = mk01::find($tt01->idkar);
         $mk01->tbsld = $mk01->tbsld + $tt01->niltb;
         $mk01->save();
         //            echo "- ada tabungan <br>";
     }
     // Update hutang, kasbon dan tabungan sesuai pembayaran gaji
     $check->updateHutangTabunganLunas($idph, $idtb);
     // update status gaji
     $check->updateStatusGaji($id, "Y");
     Session::flash('tg01_success', 'Gaji Telah Di Transfer!');
     // Redirect ke url + menuju div tertentu
     $url = URL::action("TransaksiTransferController@index");
     return Redirect::to($url);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $tt01 = tt01::find($id);
     $idkar = $tt01->idkar;
     $niltb = $tt01->niltb;
     $tt01->delete();
     $mk01 = mk01::find($idkar);
     $mk01->tbsld = $mk01->tbsld - $niltb;
     $mk01->save();
     Session::flash('tt01_success', 'Data Telah DiHapus!');
     return Redirect::to('inputdata/tabungan');
 }