diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index a2458254..c807b01d 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -428,6 +428,10 @@ class HomeController extends Controller if ($user->hasRole('callcenter')) { return view('homecallcenter'); + } else if ($user->hasRole('operasi-kpi')) { + return view('homeoperasikpi'); + } else if ($user->hasRole('hr')) { + return view('homehr'); } else if ($user->hasRole('admin')) { return view('homeadmin'); } else if ($user->hasRole('account')) { diff --git a/app/Http/Controllers/KpiController.php b/app/Http/Controllers/KpiController.php new file mode 100644 index 00000000..42bad896 --- /dev/null +++ b/app/Http/Controllers/KpiController.php @@ -0,0 +1,752 @@ +middleware('auth'); + } + + public function janaekpi() + { + $currentDate = Carbon::now(); + $currentDate = $currentDate->toDateString(); + $caw = Cawangan::all(); + // $bulan = Bulan::all(); + // $tahun = Tahun::all(); + $years = []; + for ($year=2023; $year <= 2024; $year++) $years[$year] = $year; + $jawatan = Jawatan::all(); + // dd($bulan); + $tetapan = Tetapan::where('id','=',1)->first(); + return view('kpi.janakpi',compact('caw','tetapan', 'currentDate','years','jawatan')); + } + + public function senaraitempkpi(Request $request) + { + $bulan = $request->month; + $tahun = $request->year; + $jawatan = $request->jawatan[0]; + $mula = date("Y-m-d",strtotime("$tahun-$bulan-01")); //2023-01-01 + $hingga = date("Y-m-t",strtotime("$tahun-$bulan-01")); //2023-01-31 + + if($jawatan == 'pc'){ + $cawangan_all = Cawangan::orderBy('caw_name')->get(); + $nama_jawatan = Jawatan::where('idjawatan', $jawatan)->first(); + $senarai = []; + foreach($cawangan_all as $cawangan){ + + $getnamapc = UserKaunter::where('cawangan',$cawangan->caw_code) + ->where('role_asal', $jawatan) + ->first(); + $toarray=$getnamapc->toArray(); + // dd($toarray['name']); + $checkExisting = CawanganKpi::where('namastaff', '=', $toarray['name']) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $tahun) + ->where('bulan', '=', $bulan) + ->get(); + // dd($checkExisting); + if ($checkExisting->isEmpty()) { + + $kodcaw = $cawangan->caw_code; + // $ringkasan = new RingkasanHarianServices(); + // $laporan_ringkasan = $ringkasan->getRingkasanHarian($mula,$hingga,$kodcaw); + $laporan_ringkasan = Http::get(config('app.api_url'). 'get/ringkasanharian/' ,[ + 'mula' => $mula, + 'hingga' => $hingga, + 'kodcaw' => $kodcaw, + ])->json(); + + $data = [ + 'nama_staff'=>$getnamapc['name'], + 'nokpstaff'=>$getnamapc['no_kp'], + 'kodcaw'=>$cawangan->caw_code, + 'caw_name'=>$cawangan->caw_name, + 'namajawatan'=>$nama_jawatan->namajawatan, + 'laporan_ringkasan' => $laporan_ringkasan ? $laporan_ringkasan : '', + ]; + + array_push($senarai,$data); + } + // dump($data); + } + } + + else if($jawatan == 'ppc'){ + $cawangan_all = Cawangan::orderBy('caw_name')->get(); + $nama_jawatan = Jawatan::where('idjawatan', $jawatan)->first(); + $senarai = []; + foreach($cawangan_all as $cawangan){ + $getnamapc = UserKaunter::where('cawangan', $cawangan->caw_code) + ->where('role_asal', $jawatan) + ->first(); + $toarray=$getnamapc->toArray(); + $checkExisting = CawanganKpi::where('namastaff', '=', $toarray['name']) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $tahun) + ->where('bulan', '=', $bulan) + ->get(); + // dd($checkExisting); + if ($checkExisting->isEmpty()) { + $kodcaw = $cawangan->caw_code; + // $ringkasan = new RingkasanHarianServices(); + // $laporan_ringkasan = $ringkasan->getRingkasanHarian($mula,$hingga,$kodcaw); + $laporan_ringkasan = Http::get(config('app.api_url'). 'get/ringkasanharian/' ,[ + 'mula' => $mula, + 'hingga' => $hingga, + 'kodcaw' => $kodcaw, + ])->json(); + + $aging = Http::get(config('app.api_url'). 'laporan/aging',[ + 'kodcaw' => $kodcaw, + 'tahun'=>$tahun, + 'bulan'=>$bulan + ])->json(); + + + + $data = [ + // 'cawid'=>$getnamapc['name'], + 'nama_staff'=>$getnamapc['name'], + 'nokpstaff'=>$getnamapc['no_kp'], + 'kodcaw'=>$cawangan->caw_code, + 'caw_name'=>$cawangan->caw_name, + 'namajawatan'=>$nama_jawatan->namajawatan, + 'laporan_ringkasan' => $laporan_ringkasan ? $laporan_ringkasan : '', + 'aging' => $aging ? $aging : '', + ]; + + array_push($senarai,$data); + } + } + } + else if($jawatan == 'teller'){ + $cawangan_all = Cawangan::orderBy('caw_name')->get(); + $nama_jawatan = Jawatan::where('idjawatan', $jawatan)->first(); + $senarai = []; + // dd($cawangan_all); + foreach($cawangan_all as $cawangan){ + + // dd($getnamapc); + + $kodcaw = $cawangan->caw_code; + // $ringkasan = new RingkasanHarianServices(); + // $laporan_ringkasan = $ringkasan->getRingkasanHarian($mula,$hingga,$kodcaw); + $laporan_ringkasan = Http::get(config('app.api_url'). 'get/ringkasanharian/' ,[ + 'mula' => $mula, + 'hingga' => $hingga, + 'kodcaw' => $kodcaw, + ])->json(); + + $getnamateller = UserKaunter::where('cawangan', $cawangan->caw_code) + ->where('role_asal', $jawatan) + ->whereNotIn('name', ['LELONG']) + ->orderBy('name','desc') + ->get(); + // dd($getnamateller); + $pluckteller = $getnamateller->pluck('name')->toArray(); + $nokpstaff = $getnamateller->keyBy('no_kp')->toArray(); + // dd($plucktellernokp); + $gadai = Http::get(config('app.api_url'). 'getLaporanGadaiRangeDatebyTeller/'. $kodcaw,[ + 'mula' => $mula, + 'akhir' => $hingga, + 'teller'=> $pluckteller, + ])->json(); + foreach($gadai as $index=>$datateller){ + $getnokpteller = UserKaunter::where('cawangan', $cawangan->caw_code) + ->where('name', $datateller['teller']) + ->first(); + + $gadai[$index]['nokpstaff'] = $getnokpteller['no_kp']; + + } + $toarray=$getnokpteller->toArray(); + $checkExisting = CawanganKpi::where('namastaff', '=', $toarray['name']) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $tahun) + ->where('bulan', '=', $bulan) + ->where('jawatan', '=', 'teller') + ->get(); + // dd($checkExisting); + if ($checkExisting->isEmpty()) { + $tebus = Http::get(config('app.api_url'). 'getLaporanTebusRangeDatebyTeller/'. $kodcaw,[ + 'mula' => $mula, + 'akhir' => $hingga, + 'teller'=> $pluckteller, + ])->json(); + + $data = [ + 'nokpstaff'=>$nokpstaff, + 'kodcaw'=>$cawangan->caw_code, + 'caw_name'=>$cawangan->caw_name, + 'namajawatan'=>$nama_jawatan->namajawatan, + 'laporan_ringkasan' => $laporan_ringkasan ? $laporan_ringkasan : '', + 'gadai' => $gadai ? $gadai : '', + 'tebus' => $tebus ? $tebus : '', + ]; + + array_push($senarai,$data); + } + } + } + else if($jawatan == 'penilai'){ + $cawangan_all = Cawangan::orderBy('caw_name')->get(); + $nama_jawatan = Jawatan::where('idjawatan', $jawatan)->first(); + $senarai = []; + foreach($cawangan_all as $cawangan){ + $kodcaw = $cawangan->caw_code; + $laporan_ringkasan = Http::get(config('app.api_url'). 'get/ringkasanharian/' ,[ + 'mula' => $mula, + 'hingga' => $hingga, + 'kodcaw' => $kodcaw, + ])->json(); + + $gadaipenilai = Http::get(config('app.api_url'). 'getLaporanGadaiRangeDatebyPenilai/'. $kodcaw,[ + 'mula' => $mula, + 'akhir' => $hingga + ])->json(); + foreach($gadaipenilai as $index=>$datapenilai){ + $getnokppenilai = UserKaunter::where('cawangan', $cawangan->caw_code) + ->where('name', $datapenilai['penilai']) + ->first(); + $gadaipenilai[$index]['nokpstaff'] = $getnokppenilai['no_kp'] ? $getnokppenilai['no_kp'] : ''; + } + $toarray=$getnokppenilai->toArray(); + $checkExisting = CawanganKpi::where('namastaff', '=', $toarray['name']) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $tahun) + ->where('bulan', '=', $bulan) + ->where('jawatan', '=', 'penilai') + ->get(); + // dd($checkExisting); + if ($checkExisting->isEmpty()) { + $data = [ + 'kodcaw'=>$cawangan->caw_code, + 'caw_name'=>$cawangan->caw_name, + 'namajawatan'=>$nama_jawatan->namajawatan, + 'laporan_ringkasan' => $laporan_ringkasan ? $laporan_ringkasan : '', + 'gadaipenilai' => $gadaipenilai ? $gadaipenilai : '', + ]; + + array_push($senarai,$data); + } + // dd($data); + } + } + // dd($data); + + // if($total_bil_lelong == 0) + // { + // return redirect()->route('notisperingatan.jananotisperingatan') + // ->with('failed','Tiada surat untuk di dijana'); + // } + + // dd($data); + return view('kpi.senaraitempkpi', compact( + // 'getsurat', + 'senarai', + 'nama_jawatan', + 'tahun', + 'bulan', + 'jawatan' + + )); + } + + public function savedatakpi(Request $request) + { + // dd($request->all()); + $jawatan = $request->jawatan; + $bulan = $request->bulan; + $tahun = $request->tahun; + $mula = date("Y-m-d",strtotime("$tahun-$bulan-01")); //2023-01-01 + $hingga = date("Y-m-t",strtotime("$tahun-$bulan-01")); //2023-01-31 + $current = Carbon::now(); + $current = new Carbon(); + $currentNow = Carbon::now(); + $tarikh_savekpi = $current->toDateString(); + $selected_caw = $request->kodcaw; + // dd($request->caw); + // if(!empty($selected_caw)) + $cawangan_all = Cawangan::whereIn('caw_code',$selected_caw)->get(); + // dd($caws); + $bil_surat = 0; + $senarai = []; + if($jawatan == 'pc'){ + $datakpi_temp_arr = []; + foreach($request->nama_staff as $key => $datastaff){ + + $checkExisting = CawanganKpi::where('namastaff', '=', $request->nama_staff[$key]) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $request->tahun) + ->where('bulan', '=', $request->bulan) + ->get(); + if ($checkExisting->isEmpty()) { + $cawangan = Cawangan::where('caw_code',$request->kodcaw[$key])->first(); + $caw_kpi = new CawanganKpi; + $caw_kpi->caw_id = $cawangan->id; + $caw_kpi->kodcaw = $request->kodcaw[$key]; + $caw_kpi->tahun_kpi = date('Y'); + $caw_kpi->tahun = $request->tahun; + $caw_kpi->bulan = $request->bulan; + $caw_kpi->jawatan = $request->jawatan; + $caw_kpi->namastaff = $request->nama_staff[$key]; + $caw_kpi->nokpstaff = $request->nokpstaff[$key]; + $caw_kpi->status_jana = 1; + $caw_kpi->save(); + + $datakpi_to_be_inserted = [ + 'idcawkpi' => $caw_kpi->id, + 'caw_id' => $cawangan->id, + 'kodcaw' => $request->kodcaw[$key], + 'tahun_kpi' => date('Y'), + 'tahun' => $request->tahun, + 'bulan' => $request->bulan, + 'jawatan' => $request->jawatan, + 'namastaff' => $request->nama_staff[$key], + 'nokpstaff' => $request->nokpstaff[$key], + 'pc_bilpembiayaan' => $request->bilangan_gadai[$key], + 'pc_pembiayaan' => $request->total_gadai[$key], + 'pc_pendapatan' => $request->pendapatan[$key], + 'pc_pelangganbaru' => $request->bilangan_customer_baru[$key], + 'created_at' => $currentNow, + 'updated_at' => $currentNow, + ]; + + array_push($datakpi_temp_arr, $datakpi_to_be_inserted); + } + else { + return redirect() + ->route('janakpi.janaekpi') + ->with('failed', 'Maaf, Bulan dan Tahun KPI bagi nama staff ini telah wujud dalam db.'); + } + + } + DataKpi::insert($datakpi_temp_arr); + + } + else if($jawatan == 'ppc'){ + $datakpi_temp_arr = []; + foreach ($request->nama_staff as $key => $datastaff) { + $checkExisting = CawanganKpi::where('namastaff', '=', $request->nama_staff[$key]) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $request->tahun) + ->where('bulan', '=', $request->bulan) + ->get(); + if ($checkExisting->isEmpty()) { + $cawangan = Cawangan::where('caw_code',$request->kodcaw[$key])->first(); + // dd($cawangan); + $caw_kpi = new CawanganKpi; + $caw_kpi->caw_id = $cawangan->id; + $caw_kpi->kodcaw = $request->kodcaw[$key]; + $caw_kpi->tahun_kpi = date('Y'); + $caw_kpi->tahun = $request->tahun; + $caw_kpi->bulan = $request->bulan; + $caw_kpi->jawatan = $request->jawatan; + $caw_kpi->namastaff = $request->nama_staff[$key]; + $caw_kpi->nokpstaff = $request->nokpstaff[$key]; + $caw_kpi->status_jana = 1; + $caw_kpi->save(); + + $datakpi_to_be_inserted = [ + 'idcawkpi' => $caw_kpi->id, + 'caw_id' => $cawangan->id, + 'kodcaw' => $request->kodcaw[$key], + 'tahun_kpi' => date('Y'), + 'tahun' => $request->tahun, + 'bulan' => $request->bulan, + 'jawatan' => $request->jawatan, + 'namastaff' => $request->nama_staff[$key], + 'nokpstaff' => $request->nokpstaff[$key], + 'ppc_aging1' => $request->aging1[$key], + 'ppc_aging2' => $request->aging2[$key], + 'ppc_aging3' => $request->aging3[$key], + 'ppc_penebusan' => $request->total_tebus[$key], + 'created_at' => $currentNow, + 'updated_at' => $currentNow, + ]; + + array_push($datakpi_temp_arr, $datakpi_to_be_inserted); + + + + } + else { + return redirect() + ->route('janakpi.janaekpi') + ->with('failed', 'Maaf, Bulan dan Tahun KPI bagi nama staff ini telah wujud dalam db.'); + } + } + DataKpi::insert($datakpi_temp_arr); + } + else if($jawatan == 'teller'){ + // dd($request->all()); + $datakpi_temp_arr = []; + foreach($request->nama_staff as $key => $datastaff){ + $checkExisting = CawanganKpi::where('namastaff', '=', $request->nama_staff[$key]) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $request->tahun) + ->where('bulan', '=', $request->bulan) + ->where('jawatan', '=', $request->jawatan) + ->get(); + if ($checkExisting->isEmpty()) { + $cawangan = Cawangan::where('caw_code',$request->kodcaw[$key])->first(); + $caw_kpi = new CawanganKpi; + $caw_kpi->caw_id = $cawangan->id; + $caw_kpi->kodcaw = $request->kodcaw[$key]; + $caw_kpi->tahun_kpi = date('Y'); + $caw_kpi->tahun = $request->tahun; + $caw_kpi->bulan = $request->bulan; + $caw_kpi->jawatan = $request->jawatan; + $caw_kpi->namastaff = $request->nama_staff[$key]; + $caw_kpi->nokpstaff = $request->nokpstaff[$key]; + $caw_kpi->status_jana = 1; + $caw_kpi->save(); + + $datakpi_to_be_inserted = [ + 'idcawkpi' => $caw_kpi->id, + 'caw_id' => $cawangan->id, + 'kodcaw' => $request->kodcaw[$key], + 'tahun_kpi' => date('Y'), + 'tahun' => $request->tahun, + 'bulan' => $request->bulan, + 'jawatan' => $request->jawatan, + 'namastaff' => $request->nama_staff[$key], + 'nokpstaff' => $request->nokpstaff[$key], + 'teller_bilgadai' => $request->total_gadai[$key], + 'teller_pembiayaan' => $request->total_pembiayaan[$key], + 'teller_biltebus' => $request->total_tebus[$key], + 'teller_tebuspembiayaan' => $request->total_penebusan[$key], + 'created_at' => $currentNow, + 'updated_at' => $currentNow, + ]; + + array_push($datakpi_temp_arr, $datakpi_to_be_inserted); + + + + } + else { + return redirect() + ->route('janakpi.janaekpi') + ->with('failed', 'Maaf, Bulan dan Tahun KPI bagi nama staff ini telah wujud dalam db.'); + } + } + DataKpi::insert($datakpi_temp_arr); + } + else if($jawatan == 'penilai'){ + // dd($request->all()); + $datakpi_temp_arr = []; + foreach($request->nama_staff as $key => $datastaff){ + $checkExisting = CawanganKpi::where('namastaff', '=', $request->nama_staff[$key]) + ->where('tahun_kpi', '=', date('Y')) + ->where('tahun', '=', $request->tahun) + ->where('bulan', '=', $request->bulan) + ->where('jawatan', '=', $request->jawatan) + ->get(); + if ($checkExisting->isEmpty()) { + $cawangan = Cawangan::where('caw_code',$request->kodcaw[$key])->first(); + $caw_kpi = new CawanganKpi; + $caw_kpi->caw_id = $cawangan->id; + $caw_kpi->kodcaw = $request->kodcaw[$key]; + $caw_kpi->tahun_kpi = date('Y'); + $caw_kpi->tahun = $request->tahun; + $caw_kpi->bulan = $request->bulan; + $caw_kpi->jawatan = $request->jawatan; + $caw_kpi->namastaff = $request->nama_staff[$key]; + $caw_kpi->nokpstaff = $request->nokpstaff[$key]; + $caw_kpi->status_jana = 1; + $caw_kpi->save(); + + $datakpi_to_be_inserted = [ + 'idcawkpi' => $caw_kpi->id, + 'caw_id' => $cawangan->id, + 'kodcaw' => $request->kodcaw[$key], + 'tahun_kpi' => date('Y'), + 'tahun' => $request->tahun, + 'bulan' => $request->bulan, + 'jawatan' => $request->jawatan, + 'namastaff' => $request->nama_staff[$key], + 'nokpstaff' => $request->nokpstaff[$key], + 'penilai_bilgadai' => $request->total_gadai[$key], + 'penilai_pembiayaan' => $request->total_pembiayaan[$key], + 'created_at' => $currentNow, + 'updated_at' => $currentNow, + ]; + + array_push($datakpi_temp_arr, $datakpi_to_be_inserted); + + + + } + else { + return redirect() + ->route('janakpi.janaekpi') + ->with('failed', 'Maaf, Bulan dan Tahun KPI bagi nama staff ini telah wujud dalam db.'); + } + } + DataKpi::insert($datakpi_temp_arr); + } + + + + //} + // else + // { + // return redirect()->route('janakpi.janaekpi')->with('failed','Tiada surat untuk di jana'); + // } + + return redirect()->route('janakpi.janaekpi') + ->with('success',"Berjaya Daftar KPI ".$jawatan.' ('.$bulan.'/'.$tahun.')'); + // return redirect()->route('analisa.senaraisimulasi')->with('success',"Success daftar simulasi!"); + + } + + Public function listdatakpi(){ + $tahunkpi = date('Y'); + $senarai = []; + $cawangan_all = Cawangan::with(['cawanganKpi']) + ->withCount(['cawanganKpi' => function ($query) use ($tahunkpi) { + $query->where('tahun_kpi', $tahunkpi); + }]) + ->orderBy('caw_name','ASC') + ->get(); + foreach($cawangan_all as $index3=>$cawangan){ + + $getnamastaff = CawanganKpi::where('kodcaw', $cawangan->caw_code) + ->groupBy('nokpstaff') + ->get(); + $kodcaw = $cawangan->caw_code; + + $data = [ + 'namastaff'=>$getnamastaff->toArray(), + 'nokpstaff'=>$getnamastaff->toArray(), + ]; + + array_push($senarai,$data); + // dd($data); + + $cawangan_all_groupby_caw = $cawangan->groupBy('caw_code'); + + $cawangan_all[$index3]["cawangan_info"] = $cawangan; + $cawangan_all[$index3]["namastaff"] = $getnamastaff; + } + return view('kpi.datakpibycaw',compact('cawangan_all','senarai')); + } + + Public function listdatakpidetail($nokpstaff,$kodcaw, Request $request){ + $getnamastaff = CawanganKpi::where('kodcaw', $kodcaw) + ->where('nokpstaff',$nokpstaff) + ->first(); + // dd($getnamastaff); + $jawatan = Jawatan::where('idjawatan', $getnamastaff->jawatan) + ->get(); + $bycaw_all = CawanganKpi::with(['cawangan','dataKpi'=> function ($query) use ($jawatan) { + $query->where('jawatan', $jawatan[0]['idjawatan']) + ->orderByRaw('CONVERT(bulan, SIGNED) asc') + ->orderByRaw('CONVERT(tahun, SIGNED) asc'); + }]) + ->where('nokpstaff',$nokpstaff) + ->where('kodcaw',$kodcaw) + ->where('jawatan',$jawatan[0]['idjawatan']) + ->get(); + + foreach($bycaw_all as $index3=>$listbatch){ + $bycaw_all_groupby_caw = $listbatch->groupBy('lelong_id'); + $bycaw_all[$index3]["datakpi_info"] = $listbatch->dataKpi; + $bycaw_all[$index3]["nama_caw"] = $listbatch->cawangan->caw_name; + } + return view('kpi.datakpibycawdetail',compact('getnamastaff','bycaw_all','jawatan','kodcaw')); + + + + } + + Public function checkpenilai($nokpstaff,$jawatan){ + + $getnamastaff = CawanganKpi::where('nokpstaff', $nokpstaff) + ->where('jawatan',$jawatan) + ->first(); + // dd($getnamastaff); + $jawatan = Jawatan::where('idjawatan', $jawatan) + ->get(); + // dd($jawatan); + $kodcaw = $getnamastaff['kodcaw']; + $bycaw_all = CawanganKpi::with(['cawangan','dataKpi'=> function ($query) use ($jawatan) { + $query->where('jawatan', $jawatan[0]['idjawatan']); + }]) + ->where('nokpstaff',$nokpstaff) + ->where('kodcaw',$kodcaw) + ->where('jawatan', $jawatan[0]['idjawatan']) + ->get(); + // dd($bycaw_all); + foreach($bycaw_all as $index3=>$listbatch){ + // dd($listbatch->toArray()); + $bycaw_all_groupby_caw = $listbatch->groupBy('lelong_id'); + $bycaw_all[$index3]["datakpi_info"] = $listbatch->dataKpi; + $bycaw_all[$index3]["nama_caw"] = $listbatch->cawangan->caw_name; + // $bycaw_all[$index3]["nama_caw"] = $listbatch->cawangan; + } + // dd($bycaw_all); + return view('kpi.datakpibycawdetail',compact('getnamastaff','bycaw_all','jawatan')); + + + } + + Public function listdatakpidetail2($nokpstaff,$kodcaw, Request $request){ + $namacaw = Cawangan::where('caw_code',$kodcaw)->first(); + $getnamastaff = CawanganKpi::where('kodcaw', $kodcaw) + ->where('nokpstaff',$nokpstaff) + ->first(); + // dd($getnamastaff); + $jawatan1 = Jawatan::where('idjawatan', $request->jawatan) + ->get(); + $jawatan = $request->jawatan; + // dd($jawatan[0]); + + $bycaw_all = CawanganKpi::with(['cawangan','dataKpi'=> function ($query) use ($jawatan) { + $query->where('jawatan', $jawatan); + }]) + ->where('nokpstaff',$nokpstaff) + ->where('kodcaw',$kodcaw) + ->where('jawatan',$request->jawatan) + ->get(); + // dd($bycaw_all); + + foreach($bycaw_all as $index3=>$listbatch){ + // dd($listbatch->toArray()); + $bycaw_all_groupby_caw = $listbatch->groupBy('lelong_id'); + $bycaw_all[$index3]["datakpi_info"] = $listbatch->dataKpi; + $bycaw_all[$index3]["nama_caw"] = $listbatch->cawangan->caw_name; + $bycaw_all[$index3]["jawatan1"] = $jawatan1; + // $bycaw_all[$index3]["nama_caw"] = $listbatch->cawangan; + } + if($request->type == 'excel') + { + + return view('kpi.datakpibycawdetail_excel',compact('getnamastaff','bycaw_all','jawatan','kodcaw','jawatan1')); + + } + else + { + $pdf = PDF::loadView('kpi.datakpibycawdetail_pdf',compact('getnamastaff','bycaw_all','jawatan','kodcaw','jawatan1','namacaw')) + ->setPaper('a4', 'potrait'); + + return $pdf->download('Data KPI '.$getnamastaff->namastaff.'.pdf'); + } + } + + Public function listdatakpidetailall($kodcaw, Request $request){ + $kodcaw = $kodcaw; + $getnamastaff = CawanganKpi::where('kodcaw', $kodcaw) + ->groupBy('jawatan','nokpstaff') + ->orderBy('namastaff') + ->get(); + $getdatakpi = DataKpi::where('kodcaw', $kodcaw) + // ->groupBy('jawatan','nokpstaff') + ->orderByRaw('CONVERT(bulan, SIGNED) asc') + ->orderByRaw('CONVERT(tahun, SIGNED) asc') + // ->select('namastaff','jawatan','bulan') + ->get(); + $groupby_nama = $getdatakpi->groupby('namastaff'); + $collection_datakpi = Collect(); + foreach($groupby_nama as $index=>$nama){ + $groupby_jawatan = $nama->groupBy('jawatan'); + $collection_datakpi->push($groupby_jawatan); + $groupby_nama[$index]["jawatan"] = $groupby_jawatan; + } + + + return view('kpi.datakpibycawdetailall',compact('collection_datakpi','kodcaw')); + } + + Public function listdatakpidetailall2($kodcaw, Request $request){ + $namacaw = Cawangan::where('caw_code',$kodcaw)->first(); + $getnamastaff = CawanganKpi::where('kodcaw', $kodcaw) + ->groupBy('jawatan','nokpstaff') + ->orderBy('namastaff') + ->get(); + $getdatakpi = DataKpi::where('kodcaw', $kodcaw) + ->orderByRaw('CONVERT(bulan, SIGNED) asc') + ->orderByRaw('CONVERT(tahun, SIGNED) asc') + ->get(); + $groupby_nama = $getdatakpi->groupby('namastaff'); + $collection_datakpi = Collect(); + foreach($groupby_nama as $index=>$nama){ + $groupby_jawatan = $nama->groupBy('jawatan'); + $collection_datakpi->push($groupby_jawatan); + $groupby_nama[$index]["jawatan"] = $groupby_jawatan; + } + + if($request->type == 'excel') + { + + return view('kpi.datakpibycawdetailall_excel',compact('collection_datakpi','kodcaw')); + + } + else + { + $pdf = PDF::loadView('kpi.datakpibycawdetailall_pdf',compact('collection_datakpi','kodcaw','namacaw')) + ->setPaper('a4', 'potrait'); + + return $pdf->download('Data KPI Keseluruhan'.$kodcaw.'.pdf'); + } + + + return view('kpi.datakpibycawdetailall',compact('collection_datakpi')); + + + + } + public function hapusdatakpi($recno) + { + $datastaff = DataKpi::where('id','=',$recno) + ->get(); + $datastafftoarray = $datastaff->toArray(); + $nokpstaff = $datastafftoarray[0]['nokpstaff']; + $kodcaw = $datastafftoarray[0]['kodcaw']; + $idcawkpi = $datastafftoarray[0]['idcawkpi']; + // dd($idcawkpi); + + $caw = DataKpi::where('id','=',$recno); + $caw->delete(); + $caw1 = CawanganKpi::where('id','=',$idcawkpi); + $caw1->delete(); + $checkExisting = CawanganKpi::where('nokpstaff', '=', $nokpstaff) + ->where('kodcaw', '=', $kodcaw) + ->get(); + // dd($checkExisting); + if ($checkExisting->isEmpty()) { + return redirect()->route('janakpi.listdatakpi') + ->with('success','Data '.$kodcaw.' Berjaya Dihapuskan'); + } + else{ + return redirect()->route('janakpi.listdatakpidetail',['nokpstaff'=>$nokpstaff,'kodcaw' => $kodcaw]) + ->with('success','Data '.$kodcaw.' Berjaya Dihapuskan'); + } + } + + +} diff --git a/app/Models/Bulan.php b/app/Models/Bulan.php new file mode 100644 index 00000000..69e50db9 --- /dev/null +++ b/app/Models/Bulan.php @@ -0,0 +1,17 @@ +hasMany(NotisBid::class, 'caw_id', 'id'); } + + public function cawanganKpi() + { + return $this->hasMany(CawanganKpi::class, 'caw_id', 'id'); + } + + public function datakpi() + { + return $this->belongsToMany(DataKpi::class, 'cawangan_kpi', 'caw_id', 'id'); + } } diff --git a/app/Models/CawanganKpi.php b/app/Models/CawanganKpi.php new file mode 100644 index 00000000..0e5ab3a5 --- /dev/null +++ b/app/Models/CawanganKpi.php @@ -0,0 +1,37 @@ +belongsTo(Cawangan::class, 'caw_id', 'id'); + } + public function dataKpi() + { + return $this->hasMany(DataKpi::class, 'namastaff', 'namastaff'); + } + + // public function cawangan() + // { + // return $this->belongsTo(Cawangan::class, 'caw_id', 'id'); + // } + + // public function notis() + // { + // return $this->belongsTo(Notis::class, 'notis_id', 'id'); + //} +} diff --git a/app/Models/DataKpi.php b/app/Models/DataKpi.php new file mode 100644 index 00000000..30fafe53 --- /dev/null +++ b/app/Models/DataKpi.php @@ -0,0 +1,47 @@ +belongsTo(Cawangan::class, 'caw_id','id'); + } + + public function cawanganKpi(){ + return $this->hasOne(CawanganKpi::class, 'caw_id','caw_id'); + } +} diff --git a/app/Models/Jawatan.php b/app/Models/Jawatan.php new file mode 100644 index 00000000..39f46803 --- /dev/null +++ b/app/Models/Jawatan.php @@ -0,0 +1,18 @@ +hasMany(Gadai::class, 'teller', 'name'); + } +} diff --git a/database/seeders/RolesSeeder.php b/database/seeders/RolesSeeder.php index 191ccdfd..61008b60 100644 --- a/database/seeders/RolesSeeder.php +++ b/database/seeders/RolesSeeder.php @@ -192,7 +192,10 @@ class RolesSeeder extends Seeder 'name' => 'notisperingatan', 'description' => 'Penjanaan Notis Peringatan Oleh Call Center' ]); - + Permission::create([ + 'name' => 'skoptugasan', + 'description' => 'Skop Tugasan Cawangan Kegunaan E-KPI' + ]); // create roles and assign existing permissions $role1 = Role::create(['name' => 'admin']); $role1->givePermissionTo('pengguna'); @@ -277,6 +280,11 @@ class RolesSeeder extends Seeder $role11->givePermissionTo('pengesahanpembida'); $role11->givePermissionTo('pendaftaranbatch'); + $role12 = Role::create(['name' => 'operasi-kpi']); + $role12->givePermissionTo('skoptugasan'); + + $role13 = Role::create(['name' => 'hr']); + $role13->givePermissionTo('skoptugasan'); // $role3 = Role::create(['name' => 'Super-Admin']); // gets all permissions via Gate::before rule; see AuthServiceProvider @@ -374,5 +382,21 @@ class RolesSeeder extends Seeder 'user_type' => 1 ]); $user->assignRole($role10); + + $user = \App\Models\User::factory()->create([ + 'name' => 'Operasi KPI', + 'username' => 'operasikpi', + 'email' => 'operasikpi@example.com', + 'user_type' => 1 + ]); + $user->assignRole($role12); + + $user = \App\Models\User::factory()->create([ + 'name' => 'HR', + 'username' => 'hr', + 'email' => 'hr@example.com', + 'user_type' => 1 + ]); + $user->assignRole($role13); } } diff --git a/resources/views/homehr.blade.php b/resources/views/homehr.blade.php new file mode 100644 index 00000000..933e008c --- /dev/null +++ b/resources/views/homehr.blade.php @@ -0,0 +1,16 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Dashboard') }}
+
+ HR Page +
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/homeoperasikpi.blade.php b/resources/views/homeoperasikpi.blade.php new file mode 100644 index 00000000..45f9072c --- /dev/null +++ b/resources/views/homeoperasikpi.blade.php @@ -0,0 +1,16 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Dashboard') }}
+
+ operasi kpi Page +
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/includes/sidebar.blade.php b/resources/views/includes/sidebar.blade.php index a8755c03..40b57ad4 100644 --- a/resources/views/includes/sidebar.blade.php +++ b/resources/views/includes/sidebar.blade.php @@ -106,6 +106,54 @@ + @endhasrole + @hasrole('operasi-kpi') +
  • + + +
  • + @endhasrole + @hasrole('hr') +
  • + + +
  • @endhasrole @hasrole('admin')
  • diff --git a/resources/views/kpi/datakpibycaw.blade.php b/resources/views/kpi/datakpibycaw.blade.php new file mode 100644 index 00000000..f0fd05b8 --- /dev/null +++ b/resources/views/kpi/datakpibycaw.blade.php @@ -0,0 +1,84 @@ +@extends('layouts.app') + +@section('content') +
    +
    + +
    +
    + +
    +
    + Senarai Data KPI Mengikut Cawangan +
    +
    + +
    + @if ($message = Session::get('success')) +
    + {{ $message }} +
    + @endif + +
    + + + + + + + + + {{-- --}} + {{-- --}} + + + + + @foreach ($cawangan_all as $bid) + {{-- {{dd($bid['namastaff'])}} --}} + + + + + + {{-- --}} + {{-- --}} + + @endforeach + + +
    BilCawanganNama StaffKeseluruhanJawatanMaklumat Lanjut
    {{$loop->iteration}} + + {{ $bid->cawangan_info->caw_name}} + + @foreach($bid['namastaff'] as $index=>$nama) + {{$loop->iteration.'. '}}{{ $nama['namastaff']}}
    + @endforeach +
    + Keseluruhan
    +
    {{ $bid->cawangan_kpi_count}}
    +
    +
    +
    +
    +
    +
    + + +@endsection diff --git a/resources/views/kpi/datakpibycawdetail.blade.php b/resources/views/kpi/datakpibycawdetail.blade.php new file mode 100644 index 00000000..08503af0 --- /dev/null +++ b/resources/views/kpi/datakpibycawdetail.blade.php @@ -0,0 +1,201 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    +
    + + + +
    + {{$getnamastaff->namastaff}}
    +
    + Jawatan: {{$jawatan[0]['namajawatan']}} + @php $jawatan = $jawatan[0]['idjawatan']; @endphp +
    + + +
    +
    + + @if ($message = Session::get('success')) +
    +

    {{ $message }}

    +
    + @endif +
    + @csrf + + + {{-- --}} + + + + @if($jawatan == 'pc') + + + + + + + + + + + @elseif($jawatan == 'ppc') + + + + + + + + + + + @elseif($jawatan == 'teller') + @php $checking = $getnamastaff->namastaff; @endphp + Data KPI Penilai + + + + + + + + + + + @elseif($jawatan == 'penilai') + + + + + + + + + @endif + + + + @foreach ($bycaw_all as $index=>$bid) + {{-- {{dd($bid['datakpi_info'][$index]['tahun'])}} --}} + @if($jawatan == 'pc') + + + + + + + + + + @elseif($jawatan == 'ppc') + + + + + + + + + + + @elseif($jawatan == 'penilai') + + + + + + + + + @elseif($jawatan == 'teller') + + + + + + + + + + + @endif + @endforeach + + +
    BilTahunBulanBilangan SAGPembiayaan (RM)Pendapatan (RM)Pelanggan BaruHapus
    BilTahunBulanAging (1-6bulan)Aging (>6-12bulan)Aging (>12bulan)Penebusan (RM)Hapus
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)Bil. SAG PenebusanPembiayaan (RM)Hapus
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)Hapus
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['pc_bilpembiayaan']}}{{ number_format($bid['datakpi_info'][$index]['pc_pembiayaan'], 2)}}{{ number_format($bid['datakpi_info'][$index]['pc_pendapatan'], 2)}}{{ $bid['datakpi_info'][$index]['pc_pelangganbaru']}} Hapus
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ number_format($bid['datakpi_info'][$index]['ppc_aging1'], 2)}}%{{ number_format($bid['datakpi_info'][$index]['ppc_aging2'], 2)}}%{{ number_format($bid['datakpi_info'][$index]['ppc_aging3'], 2)}}%{{ number_format($bid['datakpi_info'][$index]['ppc_penebusan'], 2)}} Hapus
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['penilai_bilgadai']}}{{ number_format($bid['datakpi_info'][$index]['penilai_pembiayaan'], 2)}} Hapus
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['teller_bilgadai']}}{{ number_format($bid['datakpi_info'][$index]['teller_pembiayaan'], 2)}}{{ $bid['datakpi_info'][$index]['teller_biltebus']}}{{ number_format($bid['datakpi_info'][$index]['teller_tebuspembiayaan'], 2)}} Hapus
    +
    +
    + +
    +
    + + +@endsection diff --git a/resources/views/kpi/datakpibycawdetail_excel.blade.php b/resources/views/kpi/datakpibycawdetail_excel.blade.php new file mode 100644 index 00000000..07a15bbb --- /dev/null +++ b/resources/views/kpi/datakpibycawdetail_excel.blade.php @@ -0,0 +1,163 @@ + + + + + + + + +
    + + {{--
    +
    + PKB LOGO +
    --}} + +
    + Nama: {{$getnamastaff->namastaff}}
    + Jawatan: {{$jawatan1[0]['namajawatan']}}
    +
    +
    +
    + @php $jawatan = $jawatan1[0]['idjawatan']; @endphp + + + + {{-- {{dd($jawatan)}} --}} + @if($jawatan == 'pc') + + + + + + + + + + @elseif($jawatan == 'ppc') + + + + + + + + + + @elseif($jawatan == 'teller') + + + + + + + + + + @elseif($jawatan == 'penilai') + + + + + + + + @endif + + + @foreach ($bycaw_all as $index=>$bid) + {{-- {{dd($jawatan)}} --}} + @if($jawatan == 'pc') + + + + + + + + + @elseif($jawatan == 'ppc') + + + + + + + + + @elseif($jawatan == 'penilai') + + + + + + + @elseif($jawatan == 'teller') + + + + + + + + + @endif + @endforeach + + + + + + + + + + \ No newline at end of file diff --git a/resources/views/kpi/datakpibycawdetail_pdf.blade.php b/resources/views/kpi/datakpibycawdetail_pdf.blade.php new file mode 100644 index 00000000..6a0ffba4 --- /dev/null +++ b/resources/views/kpi/datakpibycawdetail_pdf.blade.php @@ -0,0 +1,247 @@ + + + + + + +
    +
    DATA KPI: {{$namacaw->caw_name}}
    +
    +
    +
    +
    +
    Nama: {{$getnamastaff->namastaff}}
    + Jawatan: {{$jawatan1[0]['namajawatan']}}

    + @php $jawatan = $jawatan1[0]['idjawatan']; @endphp + + +
    BilTahunBulanBilangan SAGPembiayaan (RM)Pendapatan (RM)Pelanggan Baru
    BilTahunBulanAging (1-6bulan)Aging (>6-12bulan)Aging (>12bulan)Penebusan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)Bil. SAG PenebusanPembiayaan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['pc_bilpembiayaan']}}{{ number_format($bid['datakpi_info'][$index]['pc_pembiayaan'], 2)}}{{ number_format($bid['datakpi_info'][$index]['pc_pendapatan'], 2)}}{{ $bid['datakpi_info'][$index]['pc_pelangganbaru']}}
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ number_format($bid['datakpi_info'][$index]['ppc_aging1'], 2)}}{{ number_format($bid['datakpi_info'][$index]['ppc_aging2'], 2)}}{{ number_format($bid['datakpi_info'][$index]['ppc_aging3'], 2)}}{{ number_format($bid['datakpi_info'][$index]['ppc_penebusan'], 2)}}
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['penilai_bilgadai']}}{{ number_format($bid['datakpi_info'][$index]['penilai_pembiayaan'], 2)}}
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['teller_bilgadai']}}{{ number_format($bid['datakpi_info'][$index]['teller_pembiayaan'], 2)}}{{ $bid['datakpi_info'][$index]['teller_biltebus']}}{{ number_format($bid['datakpi_info'][$index]['teller_tebuspembiayaan'], 2)}}
    + + @if($jawatan == 'pc') + + + + + + + + + + @elseif($jawatan == 'ppc') + + + + + + + + + + @elseif($jawatan == 'teller') + {{-- @php $checking = $getnamastaff->namastaff; @endphp --}} + {{-- Data KPI Penilai --}} + + + + + + + + + + @elseif($jawatan == 'penilai') + + + + + + + + @endif + + @foreach ($bycaw_all as $index=>$bid) + {{-- {{dd($bid['datakpi_info'][$index]['tahun'])}} --}} + @if($jawatan == 'pc') + + + + + + + + + @elseif($jawatan == 'ppc') + + + + + + + + + @elseif($jawatan == 'penilai') + + + + + + + @elseif($jawatan == 'teller') + + + + + + + + + @endif + @endforeach +
    BilTahunBulanBilangan SAGPembiayaan (RM)Pendapatan (RM)Pelanggan Baru
    BilTahunBulanAging (1-6bulan)Aging (>6-12bulan)Aging (>12bulan)Penebusan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)Bil. SAG PenebusanPembiayaan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['pc_bilpembiayaan']}}{{ number_format($bid['datakpi_info'][$index]['pc_pembiayaan'], 2)}}{{ number_format($bid['datakpi_info'][$index]['pc_pendapatan'], 2)}}{{ $bid['datakpi_info'][$index]['pc_pelangganbaru']}}
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ number_format($bid['datakpi_info'][$index]['ppc_aging1'], 2)}}%{{ number_format($bid['datakpi_info'][$index]['ppc_aging2'], 2)}}%{{ number_format($bid['datakpi_info'][$index]['ppc_aging3'], 2)}}%{{ number_format($bid['datakpi_info'][$index]['ppc_penebusan'], 2)}}
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['penilai_bilgadai']}}{{ number_format($bid['datakpi_info'][$index]['penilai_pembiayaan'], 2)}}
    {{$loop->iteration}} + {{ $bid['datakpi_info'][$index]['tahun']}}{{ $bid['datakpi_info'][$index]['bulan']}}{{ $bid['datakpi_info'][$index]['teller_bilgadai']}}{{ number_format($bid['datakpi_info'][$index]['teller_pembiayaan'], 2)}}{{ $bid['datakpi_info'][$index]['teller_biltebus']}}{{ number_format($bid['datakpi_info'][$index]['teller_tebuspembiayaan'], 2)}}
    + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/views/kpi/datakpibycawdetailall.blade.php b/resources/views/kpi/datakpibycawdetailall.blade.php new file mode 100644 index 00000000..d0238165 --- /dev/null +++ b/resources/views/kpi/datakpibycawdetailall.blade.php @@ -0,0 +1,190 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    +
    + + + +
    + SENARAI
    +
    + @if ($message = Session::get('success')) +
    +

    {{ $message }}

    +
    + @endif +
    +
    +
    + + @foreach($collection_datakpi as $index1=>$liststaff) + @foreach($liststaff as $index2=>$staff) + {{-- {{dd($staff[0]['kodcaw'])}} --}} +
    + @csrf + + + + Nama: {{$staff[0]['namastaff']}}
    + Jawatan: {{$index2}}
    + @if($index2 == 'pc') + + + + + + + + + + @elseif($index2 == 'ppc') + + + + + + + + + + @elseif($index2 == 'teller') + + + + + + + + + + @elseif($index2 == 'penilai') + + + + + + + + @endif + + + + @if($index2 == 'pc') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @elseif($index2 == 'ppc') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @elseif($index2 == 'penilai') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + @endforeach + @elseif($index2 == 'teller') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @endif + +
    BilTahunBulanBilangan SAGPembiayaan (RM)Pendapatan (RM)Pelanggan Baru
    BilTahunBulanAging (1-6bulan)Aging (>6-12bulan)Aging (>12bulan)Penebusan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)Bil. SAG PenebusanPembiayaan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['pc_bilpembiayaan']}}{{ number_format($detail['pc_pembiayaan'], 2)}}{{ number_format($detail['pc_pendapatan'], 2)}}{{ $detail['pc_pelangganbaru']}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ number_format($detail['ppc_aging1'], 2)}}%{{ number_format($detail['ppc_aging2'], 2)}}%{{ number_format($detail['ppc_aging3'], 2)}}%{{ number_format($detail['ppc_penebusan'], 2)}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['penilai_bilgadai']}}{{ number_format($detail['penilai_pembiayaan'], 2)}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['teller_bilgadai']}}{{ number_format($detail['teller_pembiayaan'], 2)}}{{ $detail['teller_biltebus']}}{{ number_format($detail['teller_tebuspembiayaan'], 2)}}
    + @endforeach + @endforeach + +
    +
    + + +@endsection diff --git a/resources/views/kpi/datakpibycawdetailall_excel.blade.php b/resources/views/kpi/datakpibycawdetailall_excel.blade.php new file mode 100644 index 00000000..86018f62 --- /dev/null +++ b/resources/views/kpi/datakpibycawdetailall_excel.blade.php @@ -0,0 +1,168 @@ + + + + + + + + +
    + + {{--
    +
    + PKB LOGO +
    --}} + + @foreach($collection_datakpi as $index1=>$liststaff) + @foreach($liststaff as $index2=>$staff) + {{-- {{dd($staff)}} --}} +
    + + + Nama: {{$staff[0]['namastaff']}}
    + Jawatan: {{$index2}}
    + @if($index2 == 'pc') + + + + + + + + + + @elseif($index2 == 'ppc') + + + + + + + + + + @elseif($index2 == 'teller') + + + + + + + + + + @elseif($index2 == 'penilai') + + + + + + + + @endif + + + + @if($index2 == 'pc') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @elseif($index2 == 'ppc') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @elseif($index2 == 'penilai') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + @endforeach + @elseif($index2 == 'teller') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @endif + +
    BilTahunBulanBilangan SAGPembiayaan (RM)Pendapatan (RM)Pelanggan Baru
    BilTahunBulanAging (1-6bulan)Aging (>6-12bulan)Aging (>12bulan)Penebusan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)Bil. SAG PenebusanPembiayaan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['pc_bilpembiayaan']}}{{ number_format($detail['pc_pembiayaan'], 2)}}{{ number_format($detail['pc_pendapatan'], 2)}}{{ $detail['pc_pelangganbaru']}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ number_format($detail['ppc_aging1'], 2)}}%{{ number_format($detail['ppc_aging2'], 2)}}%{{ number_format($detail['ppc_aging3'], 2)}}%{{ number_format($detail['ppc_penebusan'], 2)}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['penilai_bilgadai']}}{{ number_format($detail['penilai_pembiayaan'], 2)}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['teller_bilgadai']}}{{ number_format($detail['teller_pembiayaan'], 2)}}{{ $detail['teller_biltebus']}}{{ number_format($detail['teller_tebuspembiayaan'], 2)}}
    + @endforeach + @endforeach + + + + + + + + \ No newline at end of file diff --git a/resources/views/kpi/datakpibycawdetailall_pdf.blade.php b/resources/views/kpi/datakpibycawdetailall_pdf.blade.php new file mode 100644 index 00000000..f0b53ee7 --- /dev/null +++ b/resources/views/kpi/datakpibycawdetailall_pdf.blade.php @@ -0,0 +1,250 @@ + + + + + + +
    +
    DATA KPI : {{$namacaw->caw_name}}
    +
    +
    +
    +
    + + @foreach($collection_datakpi as $index1=>$liststaff) + @foreach($liststaff as $index2=>$staff) +
    +
    Nama: {{$staff[0]['namastaff']}}
    + Jawatan: {{$index2}}
    + + + + @if($index2 == 'pc') + + + + + + + + + + @elseif($index2 == 'ppc') + + + + + + + + + + @elseif($index2 == 'teller') + + + + + + + + + + @elseif($index2 == 'penilai') + + + + + + + + @endif + + + + @if($index2 == 'pc') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @elseif($index2 == 'ppc') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @elseif($index2 == 'penilai') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + @endforeach + @elseif($index2 == 'teller') + @foreach($liststaff[$index2] as $index3=>$detail) + + + + + + + + + @endforeach + @endif + +
    BilTahunBulanBilangan SAGPembiayaan (RM)Pendapatan (RM)Pelanggan Baru
    BilTahunBulanAging (1-6bulan)Aging (>6-12bulan)Aging (>12bulan)Penebusan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)Bil. SAG PenebusanPembiayaan (RM)
    BilTahunBulanBil. SAG GadaianPembiayaan (RM)
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ number_format($detail['pc_bilpembiayaan'], 0)}}{{ number_format($detail['pc_pembiayaan'], 2)}}{{ number_format($detail['pc_pendapatan'], 2)}}{{ $detail['pc_pelangganbaru']}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ number_format($detail['ppc_aging1'], 2)}}%{{ number_format($detail['ppc_aging2'], 2)}}%{{ number_format($detail['ppc_aging3'], 2)}}%{{ number_format($detail['ppc_penebusan'], 2)}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['penilai_bilgadai']}}{{ number_format($detail['penilai_pembiayaan'], 2)}}
    {{$loop->iteration}} + {{ $detail['tahun']}}{{ $detail['bulan']}}{{ $detail['teller_bilgadai']}}{{ number_format($detail['teller_pembiayaan'], 2)}}{{ $detail['teller_biltebus']}}{{ number_format($detail['teller_tebuspembiayaan'], 2)}}
    + +
    + @endforeach + @endforeach + + + + + + \ No newline at end of file diff --git a/resources/views/kpi/janakpi.blade.php b/resources/views/kpi/janakpi.blade.php new file mode 100644 index 00000000..c4504714 --- /dev/null +++ b/resources/views/kpi/janakpi.blade.php @@ -0,0 +1,138 @@ +@extends('layouts.app') + +@section('content') + + + +
    +
    +
    +
    +
    +
    + Jana Actual E-KPI Cawangan +
    +
    +
    + @if ($message = Session::get('failed')) +
    + {{ $message }} +
    + @endif + @if($message = Session::get('success')) +
    +

    {{$message}}

    +
    + @endif + + @csrf +
    Sila Tunggu Sebentar...
    + {{--
    + +
    + +
    +
    --}} +
    + + +
    + {!! Form::selectMonth('month') !!} + + {!! Form::select('year', $years) !!} + +
    + + +
    + +
    + +
    + +
    + + + +
    + {{--
    + + +
    + +
    +
    --}} + + {{--
    + + +
    + +
    +
    --}} +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    + + + + +@endsection diff --git a/resources/views/kpi/senaraitempkpi.blade.php b/resources/views/kpi/senaraitempkpi.blade.php new file mode 100644 index 00000000..937347b8 --- /dev/null +++ b/resources/views/kpi/senaraitempkpi.blade.php @@ -0,0 +1,327 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    +
    + Butiran Mengikut Jawatan: {{$nama_jawatan['namajawatan']}}
    +
    + Tahun: {{$tahun}}
    + Bulan: {{$bulan}} +
    +
    + @if ($message = Session::get('failed')) +
    +

    {{ $message }}

    +
    + @endif + +
    + @csrf + {{-- --}} + +
    Sila Tunggu Sebentar...
    + +
    +
    +
    + + + + + +
    +
    +
    + + + @if($jawatan == 'pc') + + {{-- --}} + + + + + + + + + + {{-- --}} + + @elseif($jawatan == 'ppc') + + {{-- --}} + + + + + + + + + + {{-- --}} + + @elseif($jawatan == 'teller') + + {{-- --}} + + + + + + + + + + + @elseif($jawatan == 'penilai') + + {{-- --}} + + + + + + + + + @endif + + + @php $count = 1; @endphp + @foreach($senarai as $send) + {{-- {{dd($jawatan)}} --}} + {{-- @if($send['bilangan'] > 0) --}} + @if($jawatan == 'pc') + + {{-- --}} + + + + + + + + + + + + @elseif($jawatan == 'ppc') + + {{-- --}} + + + + + + @php $jumpembiayaan = 1; @endphp + @foreach($send['aging'][0]['count'] as $index=>$total) + @php + $jumpembiayaan += $send['aging'][0]['sum'][$index]; + @endphp + @endforeach + {{-- //1 - 6 Bulan --}} + @php $jumlahcount = 0;$jumlahsum = 0; @endphp + @foreach($send['aging'][0]['count'] as $index=>$ag) + @if ($index < 6) + @php + $jumlahcount += $ag; $jumlahsum += $send['aging'][0]['sum'][$index]; + @endphp + @endif + @endforeach + + {{-- //>6 Bulan --}} + @php $jumlahcount = 0;$jumlahsum = 0; @endphp + @foreach($send['aging'][0]['sum'] as $index=>$ag) + @if ($index > 5 && $index < 12 ) + @php + $jumlahsum += $send['aging'][0]['sum'][$index]; + @endphp + @endif + @endforeach + + {{-- >12 Bulan --}} + @php $jumlahcount = 0;$jumlahsum = 0; @endphp + @foreach($send['aging'][0]['sum'] as $index=>$ag) + @if ($index > 11 && $index < 14) + @php + $jumlahsum += $send['aging'][0]['sum'][$index]; + @endphp + @endif + @endforeach + + + + + @elseif($jawatan == 'teller') + + {{-- --}} + + + + + + + + {{-- {{dd($send['tebus'])}} --}} + + + + + @elseif($jawatan == 'penilai') + + {{-- --}} + + + + + + + + + @endif + @endforeach + +
    BilKod CawanganCawanganNama StaffNoKP StaffBilangan SAGPembiayaan (RM)Pendapatan (RM)Pelanggan BaruTindakan
    BilKod CawanganCawanganNama StaffNoKP StaffAging (1-6bulan)Aging (>6-12bulan)Aging (>12bulan)Penebusan (RM)Tindakan
    BilKod CawanganCawanganNama StaffNoKP StaffBil. SAG GadaianPembiayaan (RM)Bil. SAG PenebusanPembiayaan (RM)
    BilKod CawanganCawanganNama StaffNoKP StaffBil. SAG GadaianPembiayaan (RM)
    {{ $count++ }}{{ $send['kodcaw'] }}{{ $send['caw_name'] }}{{ $send['nama_staff'] }}{{ $send['nokpstaff'] }}{{ $send['laporan_ringkasan']['bilangan_gadai'] }}{{ number_format($send['laporan_ringkasan']['total_gadai'], 2) }} {{ number_format($send['laporan_ringkasan']['upahsimpankaunter']+$send['laporan_ringkasan']['keuntungansebenarkaunter']+$send['laporan_ringkasan']['total_keuntungan_online'] , 2) }} {{ $send['laporan_ringkasan']['bilangan_customer_baru'] }}
    {{ $count++ }}{{ $send['kodcaw'] }}{{ $send['caw_name'] }}{{ $send['nama_staff'] }}{{ $send['nokpstaff'] }}{{ number_format(($jumlahsum/$jumpembiayaan)*100,2) }}%{{ number_format(($jumlahsum/$jumpembiayaan)*100,2) }}%{{ number_format(($jumlahsum/$jumpembiayaan)*100,2) }}% {{ number_format($send['laporan_ringkasan']['total_tebus'] , 2)}}
    {{ $count++ }}{{ $send['kodcaw'] }} + @foreach($send['gadai'] as $index=>$kodcaw) +
    + @endforeach
    {{ $send['caw_name'] }} + {{-- {{dd($send['gadai'])}} --}} + @foreach($send['gadai'] as $index=>$nama) + {{ $nama['teller'] }}
    + @endforeach +
    @foreach($send['gadai'] as $index=>$nama) + {{ $nama['nokpstaff']}}
    + @endforeach
    @foreach($send['gadai'] as $index=>$nama) + {{ $nama['total_gadai'] }}
    + @endforeach
    + @foreach($send['gadai'] as $index=>$nama) + {{ number_format($nama['total_pembiayaan'], 2) }}
    + @endforeach +
    @foreach($send['tebus'] as $tebus) + {{ $tebus['total_tebus'] }}
    + @endforeach
    + @foreach($send['tebus'] as $tebus) + {{ number_format($tebus['total_penebusan'], 2) }}
    + @endforeach +
    {{ $count++ }}{{ $send['kodcaw'] }} + @foreach($send['gadaipenilai'] as $index=>$kodcaw) +
    + @endforeach
    {{ $send['caw_name'] }} + @foreach($send['gadaipenilai'] as $index=>$nama) + {{ $nama['penilai'] }}
    + @endforeach +
    @foreach($send['gadaipenilai'] as $index=>$nama) + {{ $nama['nokpstaff']}}
    + @endforeach
    @foreach($send['gadaipenilai'] as $index=>$nama) + {{ $nama['total_gadai'] }}
    + @endforeach
    + @foreach($send['gadaipenilai'] as $index=>$nama) + {{ number_format($nama['total_pembiayaan'], 2) }}
    + @endforeach +
    + + +
    +
    +
    +
    + + + + +@endsection diff --git a/routes/web.php b/routes/web.php index 477aa4f3..fba04e8a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -719,4 +719,17 @@ Route::group(['middleware' => ['permission:WTDcaw'],'prefix'=>'wtdcaw'], functio Route::get('/excellistsagwtdproses/{kodcaw}',['as'=>'wtdcaw.excellistsagwtdproses','uses'=>'NotisController@excellistsagwtdproses']); Route::get('/excellistsagwtdprosesbycust/{cawid}',['as'=>'wtdcaw.excellistsagwtdprosesbycust','uses'=>'NotisController@excellistsagwtdprosesbycust']); +}); + +Route::group(['middleware' => ['permission:skoptugasan'],'prefix'=>'janakpi'], function () { + Route::get('/janaekpi',['as'=>'janakpi.janaekpi','uses'=>'KpiController@janaekpi']); + Route::post('/senaraitempkpi',['as'=>'janakpi.senaraitempkpi','uses'=>'KpiController@senaraitempkpi']); + Route::post('/savedatakpi',['as'=>'janakpi.savedatakpi','uses'=>'KpiController@savedatakpi']); + Route::get('/listdatakpi',['as'=>'janakpi.listdatakpi','uses'=>'KpiController@listdatakpi']); + Route::get('/listdatakpidetail/{nokpstaff}/{kodcaw}',['as'=>'janakpi.listdatakpidetail','uses'=>'KpiController@listdatakpidetail']); + Route::get('/checkpenilai/{nokpstaff}/{jawatan}',['as'=>'janakpi.checkpenilai','uses'=>'KpiController@checkpenilai']); + Route::post('/listdatakpidetail2/{nokpstaff}/{kodcaw}',['as'=>'janakpi.listdatakpidetail2','uses'=>'KpiController@listdatakpidetail2']); + Route::get('/listdatakpidetailall/{kodcaw}',['as'=>'janakpi.listdatakpidetailall','uses'=>'KpiController@listdatakpidetailall']); + Route::post('/listdatakpidetailall2/{kodcaw}',['as'=>'janakpi.listdatakpidetailall2','uses'=>'KpiController@listdatakpidetailall2']); + Route::get('/hapusdatakpi/{recno}',['as'=>'janakpi.hapusdatakpi','uses'=>'KpiController@hapusdatakpi']); }); \ No newline at end of file