예제 #1
0
 public function lapBayaranIndividuPost()
 {
     $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first();
     if ($profile == null) {
         Session::flash('error', 'Gagal. Tiada ahli yang berdaftar dengan no gaji *' . Request::get('no_gaji') . '*.');
         return Redirect::back();
     }
     $nama = $profile->nama;
     $no_gaji = Request::get('no_gaji');
     $fees = Yuran::where('no_gaji', Request::get('no_gaji'))->where('bulan_tahun', 'like', '%' . date('Y'))->get();
     if ($fees->isEmpty()) {
         Session::flash('error', 'Gagal. Tiada maklumat bayaran pada tahun ini.');
         return Redirect::back();
     }
     $bayaran = [];
     foreach ($fees as $fee) {
         $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first();
         $bulan = explode('-', $fee->bulan_tahun);
         $bulan = (int) $bulan[0];
         if ($bulan < 10) {
             $bulan = '0' . $bulan;
         }
         // Yuran Bulanan
         $jumlah = $fee->yuran + $fee->pertaruhan + $fee->tka + $fee->takaful + $fee->potongan;
         array_push($bayaran, ['bulan' => $bulan, 'perkara' => 'Yuran Bulanan', 'catatan' => $profile->zon_gaji->nama, 'jumlah' => $jumlah]);
         // Bayaran pwt
         if ($fee->pwt != 0) {
             array_push($bayaran, ['bulan' => $bulan, 'perkara' => 'PWT', 'catatan' => $profile->zon_gaji->nama, 'jumlah' => $fee->pwt]);
         }
         // Bayaran Tunai
         $bulan = explode('-', $fee->bulan_tahun);
         $bulan = $bulan[0];
         $tunai = Bayaran::where('no_gaji', Request::get('no_gaji'))->where('created_at', 'like', date('Y') . '-' . $bulan . '%')->get();
         if (!$tunai->isEmpty()) {
             $bulan = explode('-', $fee->bulan_tahun);
             foreach ($tunai as $cash) {
                 $catatan = Perkhidmatan::where('id', $cash->akaunpotongan_id)->first();
                 $catatan = $catatan->nama;
                 $jumlah = $cash->jumlah;
                 array_push($bayaran, ['bulan' => $bulan[0], 'perkara' => 'Bayaran Tunai/Cek', 'catatan' => $catatan, 'jumlah' => $jumlah]);
             }
         }
         // end if tunai is not empty
     }
     //end foreach
     return View('members.laporan.janaan.lapBayaranIndividu', compact('nama', 'no_gaji', 'bayaran'));
 }
예제 #2
0
 public function langsaiProses()
 {
     $validation = Validator::make(Request::all(), ['akaunpotongan_id' => 'required', 'jumlah_bayaran' => 'required', 'no_gaji' => 'required']);
     if ($validation->fails()) {
         Session::flash('error', 'Gagal. Sila isikan ruangan yang disediakan dengan format yang betul');
         return Redirect::back();
     }
     $akaun = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->where('perkhidmatan_id', Request::get('akaunpotongan_id'))->where('status', 1)->where('baki', '>=', Request::get('jumlah_bayaran'))->first();
     if (empty($akaun)) {
         Session::flash('error', 'Gagal. Bayaran melebihi baki pinjaman.');
         return Redirect::back();
     }
     // $akaun->baki = $akaun->baki - Request::get('jumlah_bayaran');
     $akaun->baki = 0.0;
     $akaun->status = 0;
     $tunai = Bayaran::create(['no_gaji' => Request::get('no_gaji'), 'akaunpotongan_id' => Request::get('akaunpotongan_id'), 'jumlah' => Request::get('jumlah_bayaran')]);
     if ($akaun->save()) {
         Session::flash('success', 'Berjaya. Bayaran Langsai telah berjaya.');
     }
     return Redirect::back();
 }