public function tkaPost() { $tka = Tka::where('jumlah', Request::get('jumlah'))->where('status', 1)->get(); if (!$tka->isEmpty()) { Session::flash('error', 'Gagal. Jumlah yang sama dengan Jumlah TKA semasa .'); return Redirect::back()->withInput(); } $validation = Validator::make(Request::all(), ['jumlah' => 'required|numeric']); if ($validation->fails()) { Session::flash('error', 'Gagal. Masukkan nilai jumlah dengan format yang betul.'); return Redirect::back()->withInput()->withErrors($validation); } $tka = new Tka(); $tka->jumlah = Request::get('jumlah'); $tka->status = 1; if ($tka->save()) { $tka = Tka::where('jumlah', '!=', Request::get('jumlah'))->update(['status' => 0]); Session::flash('success', 'Berjaya. Nilai baru bagi TKA telah disimpan.'); return Redirect::route('members.settings.tka'); } else { Session::flash('error', 'Gagal. Masukkan nilai jumlah dengan format yang betul.'); return Redirect::back()->withInput(); } }
/** * Run the database seeds. * * @return void */ public function run() { User::create(array('name' => 'Suhairi Abdul Hamid', 'email' => '*****@*****.**', 'password' => Hash::make('suhairi'))); User::create(array('name' => 'Nona Azizah', 'email' => '*****@*****.**', 'password' => Hash::make('azizah'))); Perkhidmatan::create(array("nama" => "WANG TUNAI")); Perkhidmatan::create(array("nama" => "BUKU SEKOLAH")); Perkhidmatan::create(array("nama" => "CUKAI JALAN")); Perkhidmatan::create(array("nama" => "INSURANS")); Perkhidmatan::create(array("nama" => "TAYAR / BATERI")); Perkhidmatan::create(array("nama" => "KECEMASAN")); Startup::create(['id' => 1, 'nama' => 'YURAN', 'nilai' => '4184963.80', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); Startup::create(['id' => 2, 'nama' => 'TKA', 'nilai' => '90721.52', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); Startup::create(['id' => 3, 'nama' => 'BIASA', 'nilai' => '00.00', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); Startup::create(['id' => 4, 'nama' => 'PERTARUHAN', 'nilai' => '00.00', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); Startup::create(['id' => 5, 'nama' => 'TAYAR / BATERI', 'nilai' => '00.00', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); Startup::create(['id' => 6, 'nama' => 'INSURANS', 'nilai' => '00.00', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); Tka::create(['id' => 1, 'jumlah' => 6.0, 'status' => 1, 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); Sumbangan::create(['id' => 1, 'nama' => 'Sumbangan Kematian']); Sumbangan::create(['id' => 2, 'nama' => 'Sumbangan IPTA']); Sumbangan::create(['id' => 3, 'nama' => 'Sumbangan Bencana']); Zon::create(['kod' => '01', 'nama' => 'BAHAGIAN KHIDMAT PENGURUSAN']); Zon::create(['kod' => '02', 'nama' => 'BAHAGIAN INDUSTRI PADI']); Zon::create(['kod' => '03', 'nama' => 'BAHAGIAN INDUSTRI PADI DAN BUKAN PADI']); Zon::create(['kod' => '04', 'nama' => 'BAHAGIAN PENGURUSAN INSTITUSI LADANG']); Zon::create(['kod' => '05', 'nama' => 'BAHAGIAN PERANCANGAN DAN TEKNOLOGI MAKLUMAT']); Zon::create(['kod' => '06', 'nama' => 'BAHAGIAN PENGURUSAN EMPANGAN DAN SUMBER AIR']); Zon::create(['kod' => '07', 'nama' => 'BAHAGIAN PENGAIRAN DAN SALIRAN']); Zon::create(['kod' => '08', 'nama' => 'BAHAGIAN KHIDMAT MEKANIKAL DAN INFRASTRUKTUR']); Zon::create(['kod' => '09', 'nama' => 'PERKHIDMATAN MEKANIKAL']); Zon::create(['kod' => '10', 'nama' => 'BAHAGIAN PENGURUSAN WILAYAH']); Zon::create(['kod' => '11', 'nama' => 'WILAYAH 1']); Zon::create(['kod' => '12', 'nama' => 'WILAYAH 2']); Zon::create(['kod' => '13', 'nama' => 'WILAYAH 3']); Zon::create(['kod' => '14', 'nama' => 'WILAYAH 4']); Zon::create(['kod' => '20', 'nama' => 'BAYARAN SENDIRI']); Jantina::create(['nama' => 'LELAKI']); Jantina::create(['nama' => 'PEREMPUAN']); Status::create(['nama' => 'AKTIF']); Status::create(['nama' => 'PENCEN']); Status::create(['nama' => 'TIDAK AKTIF']); Status::where('id', 3)->update(['id' => 0]); Takaful::create(['jumlah' => '10.00', 'status' => 1]); ProfileCategory::create(['id' => 1, 'nama' => 'AHLI BIASA', 'catatan' => '']); ProfileCategory::create(['id' => 2, 'nama' => 'PPK', 'catatan' => '']); ProfileCategory::create(['id' => 3, 'nama' => 'YPPPM', 'catatan' => 'Y']); ProfileCategory::create(['id' => 4, 'nama' => 'SPPM', 'catatan' => 'S']); ProfileCategory::create(['id' => 5, 'nama' => 'KOMADA', 'catatan' => '']); ProfileCategory::create(['id' => 6, 'nama' => 'PELADANG MART', 'catatan' => 'PM']); $profiles = Profile::all(); foreach ($profiles as $profile) { $no_anggota = (int) $profile->no_anggota; if ($no_anggota != 0) { $profile->profile_category_id = 1; $profile->save(); } if (strpos($profile->no_anggota, 'Y') !== false) { $profile->profile_category_id = 3; $profile->save(); } if (strpos($profile->no_anggota, 'S') !== false) { $profile->profile_category_id = 4; $profile->save(); } if (strpos($profile->no_anggota, 'PM') !== false) { $profile->profile_category_id = 6; $profile->save(); } if (strpos($profile->no_anggota, 'A') !== false || strpos($profile->no_anggota, 'B') !== false || strpos($profile->no_anggota, 'C') !== false || strpos($profile->no_anggota, 'F') !== false) { $profile->profile_category_id = 2; $profile->save(); } } }
public function yuranProcess() { // Session::flash('error', 'Sistem dalam Pengemaskinian. Proses Yuran tergendala. Harap Maaf.'); // return Redirect::back(); // check for repeated payment for the selected month $doneMonth = Yuran::where('bulan_tahun', Request::get('bulan_tahun'))->first(); $currentMonth = date('m'); $currentYear = date('Y'); $postedDate = explode('-', Request::get('bulan_tahun')); $postedMonth = $postedDate[0]; $postedYear = $postedDate[1]; if ($postedYear > $currentYear || $postedYear < $currentYear) { Session::flash('error', 'Gagal. Potongan hendaklah pada tahun semasa.'); return Redirect::back(); } if ($postedYear == $currentYear) { if ($postedMonth > $currentMonth) { Session::flash('error', 'Gagal. Potongan hendaklah pada bulan semasa atau sebelum.'); return Redirect::back(); } } if (!empty($doneMonth)) { Session::flash('error', 'Gagal. Bulan yang dipilih telah dibuat potongan.'); return Redirect::back(); } $profiles = Profile::where('status', 1)->where('zon_gaji_id', '!=', 20)->where('tarikh_ahli', 'not like', Carbon::now()->format('Y-m') . '%')->get(); foreach ($profiles as $profile) { $jumlahPotongan = '0.00'; $tka = Tka::where('status', 1)->first(); $takaful = Takaful::where('status', 1)->first(); $dates = explode('-', Request::get('bulan_tahun')); $tarikh = $dates[1] . '-' . $dates[0] . '01 00:00:00'; $potongan = AkaunPotongan::where('no_gaji', $profile->no_gaji)->where('status', 1)->first(); // check bayaran yuran sudah dibuat atau belum // jika belum proses bayaran // jika sudah, skip proses bayaran if (!$this->checkPotongan($profile->no_gaji)) { $yuran = $profile->jumlah_yuran_bulanan; $pertaruhan = $profile->jumlah_pertaruhan; $tka = Tka::where('status', 1)->first()->jumlah; $takaful = Takaful::where('status', 1)->first()->jumlah; // kod = 1 $pwt = $this->getJumlah($profile->no_gaji, 1, 'bulanan'); $pwtcp = $this->getJumlah($profile->no_gaji, 1, 'caj_proses'); $pwtins = $this->getJumlah($profile->no_gaji, 1, 'insurans'); // Kod = 2 $bs = $this->getJumlah($profile->no_gaji, 2, 'bulanan'); // Kod = 3; $rt = $this->getJumlah($profile->no_gaji, 3, 'bulanan'); // Kod = 5 $tb = $this->getJumlah($profile->no_gaji, 5, 'bulanan'); $tbcp = $this->getJumlah($profile->no_gaji, 5, 'caj_proses'); $tbins = $this->getJumlah($profile->no_gaji, 5, 'insurans'); // kod = 6 $kc = $this->getJumlah($profile->no_gaji, 6, 'bulanan'); $kccp = $this->getJumlah($profile->no_gaji, 6, 'caj_proses'); $kcins = $this->getJumlah($profile->no_gaji, 6, 'insurans'); // if($profile->no_gaji == 3374) // return $pwt; Yuran::create(['no_gaji' => $profile->no_gaji, 'bulan_tahun' => Request::get('bulan_tahun'), 'yuran' => $yuran, 'pertaruhan' => $pertaruhan, 'tka' => $tka, 'takaful' => $takaful, 'pwt' => $pwt, 'pwtcp' => $pwtcp, 'pwtins' => $pwtins, 'bs' => $bs, 'rt' => $rt, 'tb' => $tb, 'tbcp' => $tbcp, 'tbins' => $tbins, 'kc' => $kc, 'kccp' => $kccp, 'kcins' => $kcins, 'zon_gaji_id' => $profile->zon_gaji_id]); } } return Redirect::route('members.yuran.index'); }