Esempio n. 1
0
 public function proses()
 {
     $validation = Validator::make(Request::all(), ['no_gaji' => 'required|numeric', 'nama' => 'required', 'jumlah' => 'required|numeric', 'tempoh' => 'required|numeric', 'kadar' => 'required|numeric', 'bulanan' => 'required|numeric']);
     if ($validation->fails()) {
         Session::flash('error', 'Gagal. Sila isikan semua ruangan dengan format yang betul.');
         return Redirect::back();
     }
     // 1. add up in table akaunpotongan
     // 2.
     $akaunPotongan = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->where('perkhidmatan_id', 2)->where('status', 1)->first();
     if (empty($akaunPotongan)) {
         AkaunPotongan::create(['no_gaji' => Request::get('no_gaji'), 'perkhidmatan_id' => '2', 'jumlah' => Request::get('jumlah'), 'tempoh' => Request::get('tempoh'), 'kadar' => Request::get('kadar'), 'caj_perkhidmatan' => '0.00', 'insurans' => '0.00', 'jumlah_keseluruhan' => Request::get('jumlah_keseluruhan'), 'baki' => Request::get('jumlah_keseluruhan'), 'bulanan' => Request::get('bulanan'), 'status' => 1]);
     } else {
         // This is for overlapping buku sekolah
         // 1. deactivate current active accountpotongan
         // 2. and then create a new one with new bulanan payment
     }
     Session::flash('success', 'Berjaya. Pinjaman Buku Sekolah berjaya direkodkan');
     return Redirect::back();
 }
Esempio n. 2
0
 public function overlapProcess()
 {
     return Request::all();
     // Data Validation
     $validation = Validator::make(Request::all(), ['no_gaji' => 'required|numeric', 'jumlah' => 'required|numeric', 'tempoh' => 'required|numeric', 'kadar' => 'required|numeric', 'kadar_bulanan' => 'required|numeric', 'caj_perkhidmatan' => 'required|numeric', 'insurans' => 'required|numeric', 'byrn_bulanan' => 'required|numeric', 'jumlah_keseluruhan' => 'required|numeric']);
     if ($validation->fails()) {
         Session::flash('error', 'Sila isi ruang yang disediakan dengan format yang betul.');
         return Redirect::back()->withInput()->withErrors($validation);
     }
     // verify check jumlah layak
     if (Request::get('jumlah') > $this->getJumlahLayak(Request::get('no_gaji'))) {
         Session::flash('error', 'Gagal. Anda hanya layak meminjam sebanyak RM ' . $this->getJumlahLayak(Request::get('no_gaji')));
         return Redirect::back();
     }
     if ($this->checkAccounts(Request::get('no_gaji'))) {
         // deactivate AkaunPotongan here
         $this->deactivated(Request::get('no_gaji'));
         $baki = '0.00';
     } else {
         $baki = Request::get('jumlah_keseluruhan');
     }
     AkaunPotongan::create(['no_gaji' => Request::get('no_gaji'), 'perkhidmatan_id' => 1, 'jumlah' => Request::get('jumlah'), 'tempoh' => Request::get('tempoh'), 'kadar' => (double) Request::get('kadar'), 'caj_perkhidmatan' => Request::get('caj_perkhidmatan'), 'insurans' => Request::get('insurans'), 'jumlah_keseluruhan' => Request::get('jumlah_keseluruhan'), 'baki' => $baki, 'bulanan' => Request::get('byrn_bulanan'), 'status' => 1]);
     return Redirect::back();
 }