Esempio n. 1
0
 public function noAnggota()
 {
     $profiles = Profile::where('no_gaji', Request::get('no_gaji'))->get();
     if ($profiles->isEmpty()) {
         Session::flash('error', 'Gagal. No Gaji * ' . Request::get('no_gaji') . ' * tidak berdaftar sebagai ahli KOMADA.');
         return Redirect::route('members.index');
     }
     $yurans = Yuran::where('no_gaji', Request::get('no_gaji'))->where('bulan_tahun', 'like', '%' . Carbon::now()->format('Y'))->orderBy('bulan_tahun', 'asc')->get();
     $yuranTambahan = [];
     for ($i = 1; $i <= 12; $i++) {
         if ($i < 10) {
             $bulan = '0' . $i;
         } else {
             $bulan = $i;
         }
         $yuranTambahans = Yurantambahan::where('created_at', 'like', Carbon::now()->format('Y') . '-' . $bulan . '%')->orderBy('created_at', 'asc')->get();
         if ($yuranTambahans->isEmpty()) {
             $yuranTambahan = 0.0;
         } else {
             foreach ($yuranTambahans as $tambahan) {
                 array_push($yuranTambahan, ['bulan' => $bulan, 'no_gaji' => $tambahan->no_gaji, 'nama' => $tambahan->profileName($tambahan->no_gaji), 'catatan' => $tambahan->sumbangan->nama, 'penerima' => $tambahan->penerima, 'tarikh' => $tambahan->tarikh, 'jumlah' => $tambahan->jumlah]);
             }
         }
         if ($i == Carbon::now()->format('m')) {
             $i = 13;
         }
     }
     $bil = 1;
     $biasas = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->get();
     return View('members.profile', compact('bil', 'profiles', 'yurans', 'yuranTambahan', 'biasas'));
 }
Esempio n. 2
0
 public function pwtPost()
 {
     $found = false;
     $info = [];
     $akaunPotongan = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->where('status', 1)->where('perkhidmatan_id', Request::get('perkhidmatan_id'))->get();
     $info = [];
     $kelayakan = true;
     if (!$akaunPotongan->isEmpty()) {
         // This is true for PWT
         // False for repeatative perkhidmatan id
         $akaun = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->where('status', 1)->where('perkhidmatan_id', Request::get('perkhidmatan_id'))->first();
         $baki = $akaun->baki;
         // Formula tempoh = ceiling(baki / bulanan)
         $bakiTempoh = ceil(number_format($akaun->baki / $akaun->bulanan, 2));
         // LANGSAI
         // Formula :-
         // Langsai = (baki - lebihan kadar) + 6 bulan kadar
         // Lebihankadar = baki tempoh * kadar sebulan;
         $kadarSebulan = $akaun->jumlah * ($akaun->kadar / 100) / 12;
         $lebihanKadar = $bakiTempoh * $kadarSebulan;
         $langsai = $baki - $lebihanKadar + $kadarSebulan * 6;
         // LAYAK
         // Formula :-
         // layak = ???
         $layak = $this->getJumlahLayak(Request::get('no_gaji'));
         $info = [$baki, $bakiTempoh, $langsai, $layak];
         if ($layak < $langsai) {
             $kelayakan = false;
         }
         $found = true;
     }
     //###########################################################################################
     // check if the no_gaji one of ahli komada
     $profile = Profile::where('no_gaji', Request::get('no_gaji'))->get();
     if ($profile->isEmpty()) {
         Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . '* tidak didaftarkan sebagai anggota KOMADA.');
         return Redirect::back()->withInput();
     }
     // check wether if the no_gaji active or inactive
     $profile = Profile::where('no_gaji', Request::get('no_gaji'))->where('status', 0)->get();
     // dd('here');
     //###########################################################################################
     if (!$profile->isEmpty()) {
         Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . '* tidak aktif.');
         return Redirect::back()->withInput();
     }
     // this to pass profile attribute to the view.
     $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first();
     $yuranTerkumpul = $this->getYuranTerkumpul(Request::get('no_gaji'));
     $layakPinjam = $this->getJumlahLayak(Request::get('no_gaji'));
     $pertaruhan = $this->getJumlahPertaruhan(Request::get('no_gaji'));
     if ($yuranTerkumpul <= 0) {
         Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . ' mempunyai yuran terkumpul RM 0.00. Tidak Layak membuat pinjaman.');
         return Redirect::back()->withInput();
     }
     Session::put('no_gaji', Request::get('no_gaji'));
     return View('members.calculator.pwt_calculator', compact('profile', 'akaunPotongan', 'found', 'info', 'akaun', 'kelayakan', 'layakPinjam', 'pertaruhan', 'yuranTerkumpul'));
 }
Esempio n. 3
0
 public function indexPost()
 {
     $accounts = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->get();
     if ($accounts->isEmpty()) {
         Session::flash('error', 'Gagal. No gaji *' . Request::get('no_gaji') . '* tiada sebarang pinjaman');
         return Redirect::back();
     }
     $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first();
     $nama = $profile->nama;
     $no_gaji = Request::get('no_gaji');
     return View('members.tangguh.form', compact('accounts', 'nama', 'no_gaji'));
 }
Esempio n. 4
0
 protected function getPinjaman($no_gaji, $bulan_tahun, $perkhidmatan_id)
 {
     $tarikh = explode('-', $bulan_tahun);
     $tarikh = $tarikh[1] . '-' . $tarikh[0];
     $bayaran = [];
     $yuran = Yuran::where('no_gaji', $no_gaji)->where('created_at', 'like', $tarikh . '%')->first();
     $tarikhYuran = $yuran->created_at;
     $akaun = AkaunPotongan::where('no_gaji', $no_gaji)->where('perkhidmatan_id', $perkhidmatan_id)->where('status', 1)->where('created_at', '<=', $tarikhYuran)->first();
     if ($akaun != null) {
         $bayaran = ['jumlah' => $akaun->bulanan, 'cp' => $akaun->caj_perkhidmatan, 'ins' => $akaun->insurans];
     } else {
         $bayaran = ['jumlah' => 0.0, 'cp' => 0.0, 'ins' => 0.0];
     }
     return $bayaran;
 }
Esempio n. 5
0
 public function index()
 {
     $accounts = AkaunPotongan::where('status', 1)->get();
     $profiles = [];
     if ($accounts->isEmpty()) {
         return View('members.index', compact('profiles'));
     }
     foreach ($accounts as $account) {
         if ($account->baki <= $account->bulanan * 3) {
             $profile = Profile::where('no_gaji', $account->no_gaji)->first();
             if ($profile != null) {
                 array_push($profiles, ['nama' => $profile->nama, 'no_gaji' => $account->no_gaji, 'baki' => $account->baki, 'bulanan' => $account->bulanan]);
             }
         }
     }
     return View('members.index', compact('profiles'));
 }
Esempio n. 6
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. 7
0
 protected function deactivated($no_gaji)
 {
     AkaunPotongan::where('no_gaji', $no_gaji)->where('status', 1)->where('perkhidmatan_id', 1)->update(['status' => 0, 'baki' => '0.00']);
 }
Esempio n. 8
0
 public function masalah2()
 {
     $accounts = AkaunPotongan::where('bulanan', 0)->where('status', 1)->get();
     return View('members.masalah.masalah2', compact('accounts'));
 }
Esempio n. 9
0
 public function getJumlah($no_gaji, $kod, $perkara)
 {
     $bulanan = AkaunPotongan::where('no_gaji', $no_gaji)->where('perkhidmatan_id', $kod)->first();
     if ($bulanan == null) {
         $total = 0.0;
     } else {
         $total = $bulanan->{$perkara};
         // if $perkara = insurans, caj_proses
         if ($perkara != 'bulanan') {
             $tarikh = explode('-', Request::get('bulan_tahun'));
             $tarikh = $tarikh[1] . '-' . $tarikh[0];
             $updated_at = substr($bulanan->created_at, 0, 7);
             if ($tarikh != $updated_at) {
                 $total = 0.0;
             }
         }
         //check if perkhidmatan_id isTangguh
         if ($perkara == 'bulanan' && $this->isTangguh($no_gaji, $bulanan->id)) {
             $total = 0.0;
         }
         // echo $total; exit;
         $bulanan->baki = $bulanan->baki - $total;
         $bulanan->save();
     }
     return $total;
 }
Esempio n. 10
0
 protected function getJumlahLangsai($id)
 {
     // LANGSAI
     // Formula :-
     // Langsai = (baki - lebihan kadar) + 6 bulan kadar
     $account = AkaunPotongan::find($id);
     $tempoh = $account->tempoh;
     $bilBayaran = Yuran::where('no_gaji', $account->no_gaji)->where('created_at', '>=', $account->created_at)->count('id');
     $kadarSebulan = $account->kadar * $account->jumlah / 100 / 12;
     $kadar6Bulan = 6 * $kadarSebulan;
     $jumlahLebihanKadar = ($account->tempoh - $bilBayaran) * $kadarSebulan;
     $langsai = $account->baki - $jumlahLebihanKadar + $kadar6Bulan;
     return $langsai;
 }