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')); }
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; }
protected function getJumlahLayak($no_gaji) { $jumlah = Yuran::where('no_gaji', $no_gaji)->sum('yuran'); // missing => $jumlah = $jumlah + jumlah_caruman_lama if ($jumlah < 10000) { $layak = 2 * $jumlah; } else { $layak = 0.8 * $jumlah; } return $layak; }
protected function getJumlahPertaruhan($no_gaji) { $jumlah = Yuran::where('no_gaji', $no_gaji)->sum('pertaruhan'); return $jumlah; }
protected function checkPotongan($no_gaji) { $bulan = Carbon::now()->format('m'); $tahun = Carbon::now()->format('Y'); if ($bulan < 10) { $bulan = '0' . $bulan; } $yuran = Yuran::where('bulan_tahun', $bulan . '-' . $tahun)->where('no_gaji', $no_gaji)->get(); if ($yuran->isEmpty()) { return false; } else { return true; } }
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; }