From c83f81f45d27ce992bcd880394742f6a1f6cd024 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 17 Apr 2023 09:24:52 +0800 Subject: [PATCH] update notis peringatan untuk callcenter jana --- app/Http/Controllers/NotisController.php | 1390 +++++++++++------ app/Http/Controllers/ReportController.php | 7 +- app/Models/Cawangan.php | 5 + app/Models/CawanganNotis.php | 38 + app/Models/Notis.php | 61 + app/Models/NotisBid.php | 45 + .../2023_01_10_112549_seed_system_user.php | 2 +- .../2023_04_04_083509_create_notis_table.php | 89 ++ .../excel/gadaibycawnotisfasa1excel.blade.php | 118 ++ resources/views/includes/sidebar.blade.php | 32 +- .../jananotis/gadaibycawnotisfasa1.blade.php | 162 ++ .../views/jananotis/notisfasa1.blade.php | 47 + .../lelong/senarailapbidaanpembida.blade.php | 2 +- .../lelong/senaraiubahrugilelongnew.blade.php | 2 +- .../jananotisperingatan.blade.php | 130 ++ .../senaraimarhunnotis.blade.php | 211 +++ .../notisperingatan/senarainotisall.blade.php | 143 ++ .../senaraitempnotisperingatan.blade.php | 188 +++ .../shownotisperingatan.blade.php | 331 ++++ .../shownotisperingatanall.blade.php | 372 +++++ .../tempbycawnotisperingatan.blade.php | 137 ++ .../pdf/gadaibycawnotisfasa1pdf.blade.php | 197 +++ .../views/pdf/jananotisperingatan.blade.php | 228 +++ .../views/pdf/jananotisperingatan2.blade.php | 228 +++ .../pdf/jananotisperingatanfasa1.blade.php | 223 +++ routes/web.php | 6 + 26 files changed, 3935 insertions(+), 459 deletions(-) create mode 100644 app/Models/CawanganNotis.php create mode 100644 app/Models/Notis.php create mode 100644 app/Models/NotisBid.php create mode 100644 database/migrations/2023_04_04_083509_create_notis_table.php create mode 100644 resources/views/excel/gadaibycawnotisfasa1excel.blade.php create mode 100644 resources/views/jananotis/gadaibycawnotisfasa1.blade.php create mode 100644 resources/views/jananotis/notisfasa1.blade.php create mode 100644 resources/views/notisperingatan/jananotisperingatan.blade.php create mode 100644 resources/views/notisperingatan/senaraimarhunnotis.blade.php create mode 100644 resources/views/notisperingatan/senarainotisall.blade.php create mode 100644 resources/views/notisperingatan/senaraitempnotisperingatan.blade.php create mode 100644 resources/views/notisperingatan/shownotisperingatan.blade.php create mode 100644 resources/views/notisperingatan/shownotisperingatanall.blade.php create mode 100644 resources/views/notisperingatan/tempbycawnotisperingatan.blade.php create mode 100644 resources/views/pdf/gadaibycawnotisfasa1pdf.blade.php create mode 100644 resources/views/pdf/jananotisperingatan.blade.php create mode 100644 resources/views/pdf/jananotisperingatan2.blade.php create mode 100644 resources/views/pdf/jananotisperingatanfasa1.blade.php diff --git a/app/Http/Controllers/NotisController.php b/app/Http/Controllers/NotisController.php index a1df40c8..9c004adc 100644 --- a/app/Http/Controllers/NotisController.php +++ b/app/Http/Controllers/NotisController.php @@ -6,6 +6,7 @@ use Illuminate\Http\Request; use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Permission; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Http; use App\Models\User; use App\Models\Cawangan; use App\Models\LelongBidder; @@ -19,9 +20,13 @@ use App\Models\Daerah; use App\Models\Negeri; use App\Models\Tetapan; use App\Models\Customer; -// use App\Models\NotisBid; -// use App\Models\Notis; -// use App\Models\CawanganNotis; +use App\Models\NotisBid; +use App\Models\Notis; +use App\Models\CawanganNotis; +use App\Models\TransaksiKeuntungan; +use App\Models\LelongTebus; +use App\Models\LogUser; +use Illuminate\Support\Facades\Log; use Carbon\Carbon; @@ -646,515 +651,994 @@ class NotisController extends Controller } -// public function jananotisperingatan() -// { -// $currentDate = Carbon::now(); -// $currentDate = $currentDate->toDateString(); -// $caw = Cawangan::all(); -// $tetapan = Tetapan::where('id','=',1)->first(); -// return view('notisperingatan.jananotisperingatan',compact('caw','tetapan', 'currentDate')); -// } + public function jananotisperingatan() + { + $currentDate = Carbon::now(); + $currentDate = $currentDate->toDateString(); + $caw = Cawangan::all(); + $tetapan = Tetapan::where('id','=',1)->first(); + return view('notisperingatan.jananotisperingatan',compact('caw','tetapan', 'currentDate')); + } -// public function senaraitempnotisperingatan(Request $request) -// { -// $fasa = $request->fasa; -// $jbg = $request->jbg; -// $jbg2 = $request->jbg2; + public function senaraitempnotisperingatan(Request $request) + { + $fasa = $request->fasa; + $jbg = $request->jbg; + $jbg2 = $request->jbg2; -// if($request->fasa == '1'){ -// $cawangan_all = Cawangan::orderBy('caw_name')->get(); -// // dd($cawangan_all); -// $senarai = []; -// $total_bil_lelong = 0; -// foreach($cawangan_all as $cawangan){ -// $getsurat1 = NotisBid::where('kodcaw', $cawangan->caw_code)->get(); -// $sag_pluck_norujukan = $getsurat1->pluck('norujukan'); -// // dd($sag_pluck_norujukan); -// $getsurat = Gadai::on($cawangan->caw_code) -// ->whereNotIn('norujukan', $sag_pluck_norujukan) -// ->where('tempoh', '>=', $jbg) -// ->where('tempoh', '<=', $jbg2) -// ->where('sttebus','=','') -// ->where('tagpalsu','=',0) -// ->where('tagpalsu2','=',0) -// ->where('taglel','=',0) -// ->where('lelong_tawarruq','=',1) -// ->whereNotNull('upah12'); + if($request->fasa == '1'){ + $cawangan_all = Cawangan::orderBy('caw_name')->get(); + // dd($cawangan_all); + $senarai = []; + $total_bil_lelong = 0; + foreach($cawangan_all as $cawangan){ + $getsurat1 = NotisBid::where('kodcaw', $cawangan->caw_code)->get(); + $sag_pluck_norujukan = $getsurat1->pluck('norujukan'); + // dd($sag_pluck_norujukan); + $getsurat = Gadai::on($cawangan->caw_code) + ->whereNotIn('norujukan', $sag_pluck_norujukan) + ->where('tempoh', '>=', $jbg) + ->where('tempoh', '<=', $jbg2) + ->where('sttebus','=','') + ->where('tagpalsu','=',0) + ->where('tagpalsu2','=',0) + ->where('taglel','=',0) + ->where('lelong_tawarruq','=',1) + ->whereNotNull('upah12'); -// $bil_lelong = $getsurat->count('norujukan'); -// $total_bil_lelong += $bil_lelong; -// $total_berat = $getsurat->sum('berat'); -// $total_nilaimarhun = $getsurat->sum('nilaimarhun'); -// $total_pembiayaan = $getsurat->sum('pinjaman'); -// // $total_bakipjm = $getsurat->sum('bakipjm'); -// $data = [ -// 'bil_lelong'=>$bil_lelong, -// 'total_berat'=>$total_berat, -// 'total_nilaimarhun'=>$total_nilaimarhun, -// 'total_pembiayaan'=>$total_pembiayaan, -// // 'total_bakipjm'=>$total_bakipjm, -// 'kodcaw'=>$cawangan->caw_code, -// 'caw_name'=>$cawangan->caw_name]; -// array_push($senarai,$data); -// // dump($data); -// } -// } + $bil_lelong = $getsurat->count('norujukan'); + $total_bil_lelong += $bil_lelong; + $total_berat = $getsurat->sum('berat'); + $total_nilaimarhun = $getsurat->sum('nilaimarhun'); + $total_pembiayaan = $getsurat->sum('pinjaman'); + // $total_bakipjm = $getsurat->sum('bakipjm'); + $data = [ + 'bil_lelong'=>$bil_lelong, + 'total_berat'=>$total_berat, + 'total_nilaimarhun'=>$total_nilaimarhun, + 'total_pembiayaan'=>$total_pembiayaan, + // 'total_bakipjm'=>$total_bakipjm, + 'kodcaw'=>$cawangan->caw_code, + 'caw_name'=>$cawangan->caw_name]; + array_push($senarai,$data); + // dump($data); + } + } -// else if($request->fasa == '2'){ -// $cawangan_all = Cawangan::all(); -// $senarai = []; -// $total_bil_lelong = 0; -// //dd($jbgadai); -// foreach($cawangan_all as $cawangan){ -// $getsurat1 = NotisBid::where('kodcaw', $cawangan->caw_code)->get(); -// $sag_pluck_norujukan = $getsurat1->pluck('norujukan'); -// // dd($sag_pluck_norujukan); -// $getsurat = Gadai::on($cawangan->caw_code) -// ->whereNotIn('norujukan', $sag_pluck_norujukan) -// ->where('tempoh', '>=', $jbg) -// // ->where('tempoh', '<=', $jbg2) -// ->where('sttebus','=','') -// ->where('tagpalsu','=',0) -// ->where('tagpalsu2','=',0) -// ->where('taglel','=',0) -// // ->where('lelong_tawarruq','=',1) -// ->whereNotNull('upah12'); + else if($request->fasa == '2'){ + $cawangan_all = Cawangan::all(); + $senarai = []; + $total_bil_lelong = 0; + //dd($jbgadai); + foreach($cawangan_all as $cawangan){ + $getsurat1 = NotisBid::where('kodcaw', $cawangan->caw_code)->get(); + $sag_pluck_norujukan = $getsurat1->pluck('norujukan'); + // dd($sag_pluck_norujukan); + $getsurat = Gadai::on($cawangan->caw_code) + ->whereNotIn('norujukan', $sag_pluck_norujukan) + ->where('tempoh', '>=', $jbg) + // ->where('tempoh', '<=', $jbg2) + ->where('sttebus','=','') + ->where('tagpalsu','=',0) + ->where('tagpalsu2','=',0) + ->where('taglel','=',0) + // ->where('lelong_tawarruq','=',1) + ->whereNotNull('upah12'); -// // $cawangan_simulasi = CawanganLelong::where('caw_id',$cawangan->id)->where('kali', '=' ,$kali)->count(); -// // if($cawangan_simulasi == 0){ -// $bil_lelong = $getsurat->count('norujukan'); -// $total_bil_lelong += $bil_lelong; -// $total_berat = $getsurat->sum('berat'); -// $total_nilaimarhun = $getsurat->sum('nilaimarhun'); -// $total_pembiayaan = $getsurat->sum('pinjaman'); -// $total_bakipjm = $getsurat->sum('bakipjm'); -// $data = [ -// 'bil_lelong'=>$bil_lelong, -// 'total_berat'=>$total_berat, -// 'total_nilaimarhun'=>$total_nilaimarhun, -// 'total_pembiayaan'=>$total_pembiayaan, -// 'total_bakipjm'=>$total_bakipjm, -// 'kodcaw'=>$cawangan->caw_code, -// 'caw_name'=>$cawangan->caw_name]; -// array_push($senarai,$data); -// // dd($data); -// // } -// } -// } -// // dd($data); + // $cawangan_simulasi = CawanganLelong::where('caw_id',$cawangan->id)->where('kali', '=' ,$kali)->count(); + // if($cawangan_simulasi == 0){ + $bil_lelong = $getsurat->count('norujukan'); + $total_bil_lelong += $bil_lelong; + $total_berat = $getsurat->sum('berat'); + $total_nilaimarhun = $getsurat->sum('nilaimarhun'); + $total_pembiayaan = $getsurat->sum('pinjaman'); + $total_bakipjm = $getsurat->sum('bakipjm'); + $data = [ + 'bil_lelong'=>$bil_lelong, + 'total_berat'=>$total_berat, + 'total_nilaimarhun'=>$total_nilaimarhun, + 'total_pembiayaan'=>$total_pembiayaan, + 'total_bakipjm'=>$total_bakipjm, + 'kodcaw'=>$cawangan->caw_code, + 'caw_name'=>$cawangan->caw_name]; + 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'); -// } + if($total_bil_lelong == 0) + { + return redirect()->route('notisperingatan.jananotisperingatan') + ->with('failed','Tiada surat untuk di dijana'); + } -// return view('notisperingatan.senaraitempnotisperingatan', compact( -// 'getsurat', -// 'senarai', -// 'fasa', -// 'jbg', -// 'jbg2' + return view('notisperingatan.senaraitempnotisperingatan', compact( + 'getsurat', + 'senarai', + 'fasa', + 'jbg', + 'jbg2' -// )); -// } + )); + } -// public function tempbycawnotisperingatan(Request $request) -// { -// $fasa = $request->fasa; -// $jbg = $request->jbg; -// $jbg2 = $request->jbg2; -// $details = $request->kodcaw; -// // dd($jbg); -// if($fasa == '1'){ -// $getsurat = Gadai::on($details) -// ->where('tempoh', '>=', $jbg) -// ->where('tempoh', '<=', $jbg2) -// ->where('kodcaw', $details) -// ->where('sttebus', '=', '') -// ->where('lelong_tawarruq','=',1) -// ->where('taglel', '=', 0) -// ->where('tagpalsu', '=', 0) -// ->where('tagpalsu2', '=', 0) -// ->whereNotNull('upah12') -// ->get(); + public function tempbycawnotisperingatan(Request $request) + { + $fasa = $request->fasa; + $jbg = $request->jbg; + $jbg2 = $request->jbg2; + $details = $request->kodcaw; + // dd($jbg); + if($fasa == '1'){ + $getsurat = Gadai::on($details) + ->where('tempoh', '>=', $jbg) + ->where('tempoh', '<=', $jbg2) + ->where('kodcaw', $details) + ->where('sttebus', '=', '') + ->where('lelong_tawarruq','=',1) + ->where('taglel', '=', 0) + ->where('tagpalsu', '=', 0) + ->where('tagpalsu2', '=', 0) + ->whereNotNull('upah12') + ->get(); + // dd($getsurat); + $gadai_data_pluck_norujukan = $getsurat->pluck('norujukan')->toArray(); + // dd($gadai_data_pluck_norujukan); + $t_gadais = Gadai::on($details) + ->where('tempoh', '>=', $jbg) + ->where('tempoh', '<=', $jbg2) + ->where('sttebus', '=', '') + ->where('taglel', '=', 0) + ->where('tagpalsu', '=', 0) + ->where('tagpalsu2', '=', 0) + ->whereNotNull('upah12') + ->orderBy('t_gadai') + ->select('t_gadai') + ->first(); + }else{ + $getsurat = Gadai::on($details) + ->where('tempoh', '>=', $jbg) + // ->where('tempoh', '<=', $jbg2) + ->where('kodcaw', $details) + ->where('sttebus', '=', '') + ->where('taglel', '=', 0) + ->where('tagpalsu', '=', 0) + ->where('tagpalsu2', '=', 0) + ->whereNotNull('upah12') + ->get(); + + $gadai_data_pluck_norujukan = $getsurat->pluck('norujukan')->toArray(); -// $t_gadais = Gadai::on($details) -// ->where('tempoh', '>=', $jbg) -// ->where('tempoh', '<=', $jbg2) -// ->where('sttebus', '=', '') -// ->where('taglel', '=', 0) -// ->where('tagpalsu', '=', 0) -// ->where('tagpalsu2', '=', 0) -// ->whereNotNull('upah12') -// ->orderBy('t_gadai') -// ->select('t_gadai') -// ->first(); -// }else{ -// $getsurat = Gadai::on($details) -// ->where('tempoh', '>=', $jbg) -// // ->where('tempoh', '<=', $jbg2) -// ->where('kodcaw', $details) -// ->where('sttebus', '=', '') -// ->where('taglel', '=', 0) -// ->where('tagpalsu', '=', 0) -// ->where('tagpalsu2', '=', 0) -// ->whereNotNull('upah12') -// ->get(); + $t_gadais = Gadai::on($details) + ->where('tempoh', '>=', $jbg) + // ->where('tempoh', '<=', $jbg2) + ->where('sttebus', '=', '') + ->where('taglel', '=', 0) + ->where('tagpalsu', '=', 0) + ->where('tagpalsu2', '=', 0) + ->whereNotNull('upah12') + ->orderBy('t_gadai') + ->select('t_gadai') + ->first(); + } + $gadai_all_keyBy_norujukan = $getsurat->keyBy('norujukan'); + // $gadai_all = Gadai::on($details)->whereIn('norujukan', $gadai_data_pluck_norujukan) + // ->select('kadarupah','nokp','tempoh','tempohbayar','norujukan','berat','nilaimarhun','pinjaman','bakipjm','bakiupah','hargajualan','bakihargajualan') + // ->orderBy('norujukan','ASC') + // ->get(); + // dd($gadai_all); -// $t_gadais = Gadai::on($details) -// ->where('tempoh', '>=', $jbg) -// // ->where('tempoh', '<=', $jbg2) -// ->where('sttebus', '=', '') -// ->where('taglel', '=', 0) -// ->where('tagpalsu', '=', 0) -// ->where('tagpalsu2', '=', 0) -// ->whereNotNull('upah12') -// ->orderBy('t_gadai') -// ->select('t_gadai') -// ->first(); -// } + $transaksi_all = TransaksiKeuntungan::on('main')->whereIn('norujukan', $gadai_data_pluck_norujukan) + ->select('keuntungan_rebet','bayaran_keuntungan','norujukan') + ->get(); + $transaksi_all_groupby_norujukan = $transaksi_all->groupBy('norujukan'); -// // $tarikh_lelong = Carbon::parse($t_lelong); -// // $t_anggaran = ($tarikh_lelong->subMonths(1))->toDateString(); -// // $t_lelongdisplay = $tarikh_lelong->format('d-m-Y'); -// //$t_anggaran = ($tarikh_lelong->subDays(20))->format('d/m/Y'); -// //$t_daftarlelong = ($tarikh_lelong->subMonths(1))->format('d/m/Y'); -// //dd($getsurat); + foreach($transaksi_all_groupby_norujukan as $index7=>$transaksi){ + if($gadai_all_keyBy_norujukan[$index7]){ + $gadai_true = $gadai_all_keyBy_norujukan[$index7]; + $gadai_true['data_transaksi'] = $transaksi; + } + } + + + foreach($getsurat as $index1=>$surats) + { + // dd($surats['data_transaksi']); + if(isset($surats['data_transaksi'])){ + $data_transaksi = $transaksi_all_groupby_norujukan[$surats->norujukan]; + $total_untung_rebet = $data_transaksi->sum('keuntungan_rebet'); + $total_untung_asal = $data_transaksi->sum('bayaran_keuntungan'); + $beza_keuntungan = $total_untung_asal - $total_untung_rebet; + // dd($beza_keuntungan); + // dd(true); + $jbg = $surats->tempoh - $surats->tempohbayar; + $jbg2 = 12 - $surats->tempohbayar; + if($surats->tempoh <= '12.00'){ + $keuntungan = bcdiv(($jbg)*$surats->kadarupah/100*$surats->bakipjm,1,1)-$beza_keuntungan; + }else{ + $keuntungan = bcdiv(($jbg2)*$surats->kadarupah/100*$surats->bakipjm,1,1)-$beza_keuntungan; + } + } + else{ + // dd(false); + $jbg = $surats->tempoh - $surats->tempohbayar; + $jbg2 = 12 - $surats->tempohbayar; + $beza_keuntungan = 0.00; + // dd($beza_keuntungan); + if($surats->tempoh <= '12.00'){ + // dd($jbg,$datagadai->kadarupah, $datagadai->bakipjm); + $keuntungan = bcdiv(($jbg)*$surats->kadarupah/100*$surats->bakipjm,1,1)-$beza_keuntungan; + }else{ + // dd(false); + $keuntungan = bcdiv(($jbg2)*$surats->kadarupah/100*$surats->bakipjm,1,1)-$beza_keuntungan; + } + } + // dd($keuntungan); + $ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan']; + // dd($ktlhbyr); + // $getsurat[$index1]['list_norujukan'] = $senarai; + $getsurat[$index1]['keuntungan'] = $keuntungan; + $getsurat[$index1]['ktlhbyr'] = $ktlhbyr; + } -// foreach($getsurat as $index1=>$surats) -// { -// $senarai = Gadai::on($details) -// ->where('norujukan', $surats['norujukan']) -// ->get(); -// // dd($surats['tempoh']); + // $keuntungantlhbyr = TransaksiKeuntungan::on('mysql2') + // ->sum('bayaran_keuntungan'); -// $total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$surats['norujukan'])->sum('keuntungan_rebet'); -// $total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$surats['norujukan'])->sum('bayaran_keuntungan'); -// $beza_keuntungan = $total_untung_asal - $total_untung_rebet; - -// // dd($beza_keuntungan); -// // $keuntungan = bcdiv(($surats['tempoh']-$surats['tempohbayar'])*$surats['kadarupah']/100*$surats['bakipjm'],1,1)-$beza_keuntungan; -// $jbg = $surats['tempoh']-$surats['tempohbayar']; -// $jbg2 = 12- $surats['tempohbayar']; -// if($surats['tempoh'] <= '12.00'){ -// $keuntungan = bcdiv(($jbg)*$surats['kadarupah']/100*$surats['bakipjm'],1,1)-$beza_keuntungan; -// }else{ -// $keuntungan = bcdiv(($jbg2)*$surats['kadarupah']/100*$surats['bakipjm'],1,1)-$beza_keuntungan; -// } -// // dd($surats['hargajualan']); -// $ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan']; -// // dd($ktlhbyr); -// $getsurat[$index1]['list_norujukan'] = $senarai; -// $getsurat[$index1]['keuntungan'] = $keuntungan; -// $getsurat[$index1]['ktlhbyr'] = $ktlhbyr; -// } + return view('notisperingatan.tempbycawnotisperingatan', compact( 'getsurat', + 'details', + 'keuntungan', + 't_gadais', + 'ktlhbyr' -// // $keuntungantlhbyr = TransaksiKeuntungan::on('mysql2') -// // ->sum('bayaran_keuntungan'); + )); + } -// return view('notisperingatan.tempbycawnotisperingatan', compact( 'getsurat', -// 'details', -// 'senarai', -// 'keuntungan', -// 't_gadais', -// 'ktlhbyr' + public function janadatanotisperingatan(Request $request) + { + $fasa = $request->fasa; + $jbg = $request->jbg; + $jbg2 = $request->jbg2; + $current = Carbon::now(); + $current = new Carbon(); + $tarikh_notis = $current->toDateString(); + $selected_caw = $request->caw; + if(!empty($selected_caw)) + { + $caws = Cawangan::whereIn('caw_code',$selected_caw)->get(); + $bil_surat = 0; + $sag_cawangans = []; + foreach($caws as $caw){ + if($fasa == '1'){ + $surat = Gadai::on($caw->caw_code) + ->where('tempoh', '>=', $jbg) + ->where('tempoh', '<=', $jbg2) + ->where('sttebus','=','') + ->where('tagpalsu','=',0) + ->where('tagpalsu2','=',0) + ->where('taglel','=',0) + ->where('lelong_tawarruq','=',1); + // ->count('norujukan'); -// )); -// } + } + else if($fasa == '2'){ + $surat = Gadai::on($caw->caw_code) + ->where('tempoh', '>=', $jbg) + ->where('sttebus','=','') + ->where('tagpalsu','=',0) + ->where('tagpalsu2','=',0) + ->where('taglel','=',0); + // ->count('norujukan'); + } + $bil_sag_cawangan = $surat->count('norujukan'); + array_push($sag_cawangans,['cawangan'=>$caw,'data'=>$surat->get()]); + $bil_surat += $bil_sag_cawangan; + } -// public function janadatanotisperingatan(Request $request) -// { -// $fasa = $request->fasa; -// $jbg = $request->jbg; -// $jbg2 = $request->jbg2; -// $current = Carbon::now(); -// $current = new Carbon(); -// $tarikh_notis = $current->toDateString(); -// $selected_caw = $request->caw; -// if(!empty($selected_caw)) -// { -// $caws = Cawangan::whereIn('caw_code',$selected_caw)->get(); -// $bil_surat = 0; -// $sag_cawangans = []; -// foreach($caws as $caw){ -// if($fasa == '1'){ -// $surat = Gadai::on($caw->caw_code) -// ->where('tempoh', '>=', $jbg) -// ->where('tempoh', '<=', $jbg2) -// ->where('sttebus','=','') -// ->where('tagpalsu','=',0) -// ->where('tagpalsu2','=',0) -// ->where('taglel','=',0) -// ->where('lelong_tawarruq','=',1); -// // ->count('norujukan'); + if($bil_surat == 0) + { + return redirect()->route('notisperingatan.jananotisperingatan') + ->with('failed','Tiada surat untuk di jana'); + } -// } -// else if($fasa == '2'){ -// $surat = Gadai::on($caw->caw_code) -// ->where('tempoh', '>=', $jbg) -// ->where('sttebus','=','') -// ->where('tagpalsu','=',0) -// ->where('tagpalsu2','=',0) -// ->where('taglel','=',0); -// // ->count('norujukan'); -// } -// $bil_sag_cawangan = $surat->count('norujukan'); -// array_push($sag_cawangans,['cawangan'=>$caw,'data'=>$surat->get()]); -// $bil_surat += $bil_sag_cawangan; -// } + //create notis + $notis = Notis::create([ + 'tarikh_notis' => $tarikh_notis, + 'daritempoh' => $jbg, + 'hinggatempoh' => $jbg2, + 'sts_notis' => 1, + 'fasa' => $fasa + ]); -// if($bil_surat == 0) -// { -// return redirect()->route('notisperingatan.jananotisperingatan') -// ->with('failed','Tiada surat untuk di jana'); -// } + foreach($sag_cawangans as $index=>$cawnotis){ -// //create notis -// $notis = Notis::create([ -// 'tarikh_notis' => $tarikh_notis, -// 'daritempoh' => $jbg, -// 'hinggatempoh' => $jbg2, -// 'sts_notis' => 1, -// 'fasa' => $fasa -// ]); + $caw_notis = new CawanganNotis; + $caw_notis->notis_id = $notis->id; + $caw_notis->caw_id = $cawnotis['cawangan']->id; + $caw_notis->fasa = $request->fasa; + $caw_notis->daritempoh = $request->jbg; + $caw_notis->hinggatempoh = $request->jbg2; + $caw_notis->status = 1; + $caw_notis->save(); -// foreach($sag_cawangans as $index=>$cawnotis){ + $suratcaw = $cawnotis['data']; -// $caw_notis = new CawanganNotis; -// $caw_notis->notis_id = $notis->id; -// $caw_notis->caw_id = $cawnotis['cawangan']->id; -// $caw_notis->fasa = $request->fasa; -// $caw_notis->daritempoh = $request->jbg; -// $caw_notis->hinggatempoh = $request->jbg2; -// $caw_notis->status = 1; -// $caw_notis->save(); + $notis_bid_arr = []; + $now = Carbon::now(); + foreach($suratcaw as $surat) + { + $notis_to_be_inserted = new NotisBid(); + $notis_to_be_inserted->notis_id = $notis->id; + $notis_to_be_inserted->tarikh_notis = $tarikh_notis; + $notis_to_be_inserted->caw_id = $cawnotis['cawangan']->id; + $notis_to_be_inserted->kodcaw = $surat->kodcaw; + $notis_to_be_inserted->norujukan = $surat->norujukan; + $notis_to_be_inserted->nokp = $surat->nokp; + $notis_to_be_inserted->jbg = $surat->tempoh; + $notis_to_be_inserted->kadarupah = $surat->kadarupah; + $notis_to_be_inserted->nilaimarhun = $surat->nilaimarhun; + $notis_to_be_inserted->pinjaman = $surat->bakipjm; + $notis_to_be_inserted->bakiupah = $surat->bakiupah; + $notis_to_be_inserted->berat = $surat->berat; + $notis_to_be_inserted->marhun = $surat->marhun; + $notis_to_be_inserted->percent = $surat->percentpinj; + $notis_to_be_inserted->fasa = $request->fasa; + $notis_bid_arr[] = $notis_to_be_inserted->attributesToArray(); + } -// $suratcaw = $cawnotis['data']; + $notis_bid_collection = collect($notis_bid_arr); -// $notis_bid_arr = []; -// $now = Carbon::now(); -// foreach($suratcaw as $surat) -// { -// $notis_to_be_inserted = new NotisBid(); -// $notis_to_be_inserted->notis_id = $notis->id; -// $notis_to_be_inserted->caw_id = $cawnotis['cawangan']->id; -// $notis_to_be_inserted->kodcaw = $surat->kodcaw; -// $notis_to_be_inserted->norujukan = $surat->norujukan; -// $notis_to_be_inserted->nokp = $surat->nokp; -// $notis_to_be_inserted->jbg = $surat->tempoh; -// $notis_to_be_inserted->kadarupah = $surat->kadarupah; -// $notis_to_be_inserted->nilaimarhun = $surat->nilaimarhun; -// $notis_to_be_inserted->pinjaman = $surat->bakipjm; -// $notis_to_be_inserted->bakiupah = $surat->bakiupah; -// $notis_to_be_inserted->berat = $surat->berat; -// $notis_to_be_inserted->marhun = $surat->marhun; -// $notis_to_be_inserted->percent = $surat->percentpinj; -// $notis_to_be_inserted->fasa = $request->fasa; -// $notis_bid_arr[] = $notis_to_be_inserted->attributesToArray(); -// } - -// $notis_bid_collection = collect($notis_bid_arr); - -// NotisBid::insert($notis_bid_arr); + NotisBid::insert($notis_bid_arr); -// } + } -// } -// else -// { -// return redirect()->route('notisperingatan.jananotisperingatan')->with('failed','Tiada surat untuk di jana'); -// } + } + else + { + return redirect()->route('notisperingatan.jananotisperingatan')->with('failed','Tiada surat untuk di jana'); + } -// return redirect()->route('notisperingatan.shownotisperingatan',$notis->id); -// // return redirect()->route('analisa.senaraisimulasi')->with('success',"Success daftar simulasi!"); + return redirect()->route('notisperingatan.shownotisperingatan',$notis->id); + // return redirect()->route('analisa.senaraisimulasi')->with('success',"Success daftar simulasi!"); -// } + } -// public function shownotisperingatan($id) -// { -// $notis_id = $id; -// $notis = Notis::with(['cawangan', 'notisBid'])->find($id); -// $data = $notis; + public function shownotisperingatan($id) + { + $notis_id = $id; + $notis = Notis::with(['cawangan', 'notisBid'])->find($id); + $data = $notis; -// $cawanganAll = $notis->cawangan; -// $notisBidGroupByCawId = $notis->notisBid->groupBy('caw_id'); + $cawanganAll = $notis->cawangan; + $notisBidGroupByCawId = $notis->notisBid->groupBy('caw_id'); -// foreach($cawanganAll as $caw_key_by_id) -// { -// if($notisBidGroupByCawId[$caw_key_by_id['id']]); -// { -// $caw_key_by_id['notisBid'] = $notisBidGroupByCawId[$caw_key_by_id['id']]; -// } -// } + foreach($cawanganAll as $caw_key_by_id) + { + if($notisBidGroupByCawId[$caw_key_by_id['id']]); + { + $caw_key_by_id['notisBid'] = $notisBidGroupByCawId[$caw_key_by_id['id']]; + } + } -// $total_marhun = 0; -// $total_nilaimarhun = 0; -// $total_pinjaman = 0; -// $total_bakiupah = 0; -// $total_berat = 0; -// $arraycaw = []; + $total_marhun = 0; + $total_nilaimarhun = 0; + $total_pinjaman = 0; + $total_bakiupah = 0; + $total_berat = 0; + $arraycaw = []; -// foreach ($cawanganAll as $caw) { -// $berat = 0; -// $nilai_marhun = 0; -// $pinjaman = 0; -// $bakiupah = 0; -// foreach ($caw['notisBid'] as $notis_bid) { -// $total_marhun += 1; -// $nilai_marhun += $notis_bid->nilaimarhun; -// $pinjaman += $notis_bid->pinjaman; -// $bakiupah += $notis_bid->bakiupah; -// $berat += $notis_bid->berat; + foreach ($cawanganAll as $caw) { + $berat = 0; + $nilai_marhun = 0; + $pinjaman = 0; + $bakiupah = 0; + foreach ($caw['notisBid'] as $notis_bid) { + $total_marhun += 1; + $nilai_marhun += $notis_bid->nilaimarhun; + $pinjaman += $notis_bid->pinjaman; + $bakiupah += $notis_bid->bakiupah; + $berat += $notis_bid->berat; -// } + } -// array_push($arraycaw, [ -// 'id_cawangan' => $caw['id'], -// 'cawangan' => $caw->caw_name, -// 'bil_marhun' => count($caw['notisBid']), -// 'berat' => $berat, -// 'n_marhun' => $nilai_marhun, -// 'pinjaman' => $pinjaman, -// 'upahsimpan' => $bakiupah, -// 'bakiupah' => $bakiupah, -// ]); + array_push($arraycaw, [ + 'id_cawangan' => $caw['id'], + 'cawangan' => $caw->caw_name, + 'bil_marhun' => count($caw['notisBid']), + 'berat' => $berat, + 'n_marhun' => $nilai_marhun, + 'pinjaman' => $pinjaman, + 'upahsimpan' => $bakiupah, + 'bakiupah' => $bakiupah, + ]); -// $total_nilaimarhun += $nilai_marhun; -// $total_pinjaman += $pinjaman; -// $total_bakiupah += $bakiupah; -// $total_berat += $berat; -// } + $total_nilaimarhun += $nilai_marhun; + $total_pinjaman += $pinjaman; + $total_bakiupah += $bakiupah; + $total_berat += $berat; + } -// return view('notisperingatan.shownotisperingatan', compact( -// 'data', -// 'arraycaw', -// 'total_marhun', -// 'total_berat', -// 'total_pinjaman', -// 'notis_id', -// 'total_bakiupah', -// 'total_nilaimarhun', -// 'notis' -// )); -// } + return view('notisperingatan.shownotisperingatan', compact( + 'data', + 'arraycaw', + 'total_marhun', + 'total_berat', + 'total_pinjaman', + 'notis_id', + 'total_bakiupah', + 'total_nilaimarhun', + 'notis' + )); + } -// public function senarainotisall() -// { + public function senarainotisall() + { -// $arrayinfo = []; + $arrayinfo = []; -// $notis = Notis::select('tarikh_notis') -// ->groupBy('tarikh_notis') -// ->get(); -// // ->toArray(); -// // dd($notis); + $notis = Notis::select('tarikh_notis','id') + ->groupBy('tarikh_notis') + ->get(); + // ->toArray(); + // dd($notis); -// foreach($notis as $info) -// { -// $detailsinfo = CawanganNotis::join('cawangan','cawangan_notis.caw_id','=','cawangan.id') -// // ->where('kali',$info->kali) -// ->get() -// ->toArray(); -// // dd($detailsinfo); + foreach($notis as $info) + { + $detailsinfo = CawanganNotis::join('cawangan','cawangan_notis.caw_id','=','cawangan.id') + // ->where('kali',$info->kali) + ->get() + ->toArray(); + // dd($detailsinfo); -// array_push($arrayinfo, ['info'=> $info, 'detailsinfo'=>$detailsinfo]); + array_push($arrayinfo, ['info'=> $info, 'detailsinfo'=>$detailsinfo]); -// } + } -// return view('notisperingatan.senarainotisall',compact('notis','arrayinfo')); -// } + return view('notisperingatan.senarainotisall',compact('notis','arrayinfo')); + } -// public function shownotisperingatanall(Request $request, $tarikhnotis) -// { -// $tarikhnotis = $tarikhnotis; -// $notis = Notis::where('tarikh_notis','=',$tarikhnotis)->first(); + public function shownotisperingatanall(Request $request) + { + $arraydata = []; + $arraycaw = []; + $data = []; -// $cawangannotis = CawanganNotis::where('created_at','like', '%'.$tarikhnotis.'%')->get(); -// // dd($cawangannotis); + $total_marhun = 0; + $total_berat = 0; + $total_nmarhun = 0; + $total_pinjaman = 0; + $total_upah = 0; + $total_bakiupah = 0; + $total_nilaimarhun = 0; -// $arraydata = []; -// $arraycaw = []; -// $data = []; + $tarikhnotis = $request->tarikhnotis; + $notisid = $request->notisid; + $notis = Notis::with(['cawangan', 'notisBid','cawanganNotis'])->where('tarikh_notis',$tarikhnotis)->get(); + + foreach ($notis as $not) { + // dd($not); + $cawanganAll = $not->cawangan; + // dd($not->cawanganNotis); + $notBidGroupByCawId = $not->notisBid->groupBy('caw_id'); + $notBidGroupByCawnotis = $not->cawanganNotis->groupBy('caw_id'); -// $total_marhun = 0; -// $total_berat = 0; -// $total_nmarhun = 0; -// $total_pinjaman = 0; -// $total_upah = 0; -// $total_bakiupah = 0; -// $total_nilaimarhun = 0; + foreach ($cawanganAll as $caw_key_by_id) { + // dd($caw_key_by_id); + if ($notBidGroupByCawId[$caw_key_by_id['id']]); { + $caw_key_by_id['notisBid'] = $notBidGroupByCawId[$caw_key_by_id['id']]; + $caw_key_by_id['status'] = $notBidGroupByCawnotis[$caw_key_by_id['id']]; + } + } -// foreach($cawangannotis as $cawlel) -// { -// $cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first(); -// // $databid = LelongBid::join('cawangan_lelong','cawangan_lelong.caw_id','=','lelongbid.caw_id') + foreach($cawanganAll as $cawnot) + { + $berat = 0; + $nilai_marhun = 0; + $pinjaman = 0; + $bakiupah = 0; + foreach ($cawnot['notisBid'] as $not_bid) { + $berat += $not_bid->berat; + $nilai_marhun += $not_bid->nilaimarhun; + $pinjaman += $not_bid->pinjaman; + $bakiupah += $not_bid->bakiupah; + + $total_marhun += 1; + $total_berat = $total_berat + $berat; + $total_nilaimarhun = $total_nilaimarhun + $nilai_marhun; + $total_pinjaman = $total_pinjaman + $pinjaman; + $total_bakiupah = $total_bakiupah + $bakiupah; + } -// $databid = NotisBid:: join('cawangan_notis', function ($join) { -// $join->on('cawangan_notis.caw_id', '=', 'notisbid.caw_id') -// ->on('cawangan_notis.notis_id', '=', 'notisbid.notis_id'); -// }) -// ->select('notisbid.id','notisbid.berat','notisbid.marhun','notisbid.nilaimarhun','notisbid.pinjaman','notisbid.bakiupah') -// ->where('cawangan_notis.caw_id','=', $cawlel->caw_id) -// ->where('cawangan_notis.notis_id','=', $cawlel->notis_id) -// ->get(); + foreach ($cawnot['status'] as $not_bid_status) { + $statusnotis= $not_bid_status->status; + } + array_push($arraycaw,[ + 'id_cawangan'=> $cawnot['id'], + 'cawangan'=>$cawnot['caw_name'], + 't_notis'=>$tarikhnotis, + 'notis_id'=>$not->id, + 'bil_marhun'=>count($cawnot['notisBid']), + 'berat'=>$berat, + 'n_marhun'=>$nilai_marhun, + 'pinjaman'=>$pinjaman, + 'bakiupah'=>$bakiupah, + 'daritempoh'=>$not->daritempoh, + 'hinggatempoh'=>$not->hinggatempoh, + 'fasa'=>$not->fasa, + 'status'=>$statusnotis, + ]); -// $t_notis = Notis::join('cawangan_notis','cawangan_notis.notis_id','=','notis.id') -// ->where('cawangan_notis.notis_id','=', $cawlel->notis_id) -// ->first(); -// $packet = 0; -// $berat = 0; -// $nilai_marhun = 0; -// $pinjaman =0; -// $bakiupah = 0; -// $id = $cawlel->notis_id; + } + + } + // dd($arraycaw); -// foreach($databid as $index1=>$bid) -// { -// $berat = $berat + $bid['berat']; -// $nilai_marhun = $nilai_marhun + $bid['nilaimarhun']; -// $pinjaman =$pinjaman + $bid['pinjaman']; -// $bakiupah = $bakiupah + $bid['bakiupah']; -// } + return view('notisperingatan.shownotisperingatanall',compact( + 'notisid', + 'arraycaw', + 'total_marhun', + 'total_berat', + 'total_nmarhun', + 'total_pinjaman', + 'total_upah', + 'data', + 'tarikhnotis', + 'total_bakiupah', + 'total_nilaimarhun' + )); + } -// array_push($arraycaw,[ -// 'id_cawangan'=> $cawangan['id'], -// 'cawangan'=>$cawangan['caw_name'], -// 't_notis'=>$notis['tarikh_notis'], -// 'bil_marhun'=>sizeof($databid), -// 'berat'=>$berat, -// 'n_marhun'=>$nilai_marhun, -// 'pinjaman'=>$pinjaman, -// 'bakiupah'=>$bakiupah, -// 'daritempoh'=>$t_notis['daritempoh'], -// 'hinggatempoh'=>$t_notis['hinggatempoh'], -// 'fasa'=>$t_notis['fasa'], -// ]); + public function senaraimarhunnotis($notisid, $cawid) + { + $total_berat = 0; + $total_pinjaman = 0; + $total_upah = 0; + $total_hargaasas = 0; + $total_bakiupah = 0; + $total_nilaimarhun = 0; + $total_cazlelong = 0; + $rugilelong = 0; + $bakilelong = 0; + $keuntungan = 0; + $total_baki = 0; + $total_ktlhbyr = 0; + $total_bakipjm = 0; + $notis_id = $notisid; -// $total_marhun = $total_marhun + sizeof($databid); -// $total_berat = $total_berat + $berat; -// $total_nilaimarhun = $total_nilaimarhun + $nilai_marhun; -// $total_pinjaman = $total_pinjaman + $pinjaman; -// $total_bakiupah = $total_bakiupah + $bakiupah; + $notislel = Notis::with('cawangan')->find($notis_id); -// $data = Notis::where('tarikh_notis','=',$tarikhnotis)->first(); -// } + $cawanganDetail = $notislel->cawangan->find($cawid); + + $caw = Cawangan::with(["notisBid" => function($q) use ($notis_id){ + $q->where('notis_id', '=', $notis_id)->select('id','caw_id','kodcaw','norujukan','nokp','pinjaman','bakiupah'); + }]) + ->where('caw_code','=',$cawanganDetail->caw_code)->first(); + + $notisbid_data_pluck_norujukan = $caw->notisBid->pluck('norujukan')->toArray(); + $notisbid_keyby_norujukan = $caw->notisBid->keyBy('norujukan'); -// return view('notisperingatan.shownotisperingatanall',compact( -// 'arraycaw', -// 'total_marhun', -// 'total_berat', -// 'total_nmarhun', -// 'total_pinjaman', -// 'total_upah', -// 'data', -// 'tarikhnotis', -// 'total_bakiupah', -// 'total_nilaimarhun' -// )); -// } + $notis_all = Gadai::on($cawanganDetail->caw_code)->whereIn('norujukan', $notisbid_data_pluck_norujukan) + ->select('nokp','jbg','norujukan','berat','nilaimarhun','pinjaman','bakiupah','kadarupah','bakipjm','tempoh','tempohbayar','sttebus') + ->orderBy('norujukan','ASC') + ->get(); + $transaksi_all = TransaksiKeuntungan::on('main')->whereIn('norujukan', $notisbid_data_pluck_norujukan) + ->select('keuntungan_rebet','bayaran_keuntungan','norujukan') + ->get(); + $transaksi_all_groupby_norujukan = $transaksi_all->groupBy('norujukan'); + + $notis_all_keyBy_norujukan = $notis_all->keyBy('norujukan'); + foreach($transaksi_all_groupby_norujukan as $index7=>$transaksi){ + // dd($notis_all_keyBy_norujukan); + if($notis_all_keyBy_norujukan[$index7]){ + + $gadai_true = $notis_all_keyBy_norujukan[$index7]; + $gadai_true['data_transaksi'] = $transaksi; + } + // dd($transaksi); + } + + $notis_all_data_pluck_nokp = $caw->notisBid->pluck('nokp')->toArray(); + + $customers = Customer::whereIn('kpbaru', $notis_all_data_pluck_nokp) + ->orWhereIn('kplama', $notis_all_data_pluck_nokp) + ->select('nama','telefon','kpbaru', 'kplama','alamat1','alamat2','alamat3') + ->get(); + $customers_keyBy_noKp = $customers->keyBy(function ($item) { + if ($item->kpbaru != '') { + return $item->kpbaru; + } else if ($item->kplama != '') { + return $item->kplama; + } + }); + foreach($notis_all as $index1=>$gadai){ + if(isset($gadai['data_transaksi'])){ + $data_transaksi = $transaksi_all_groupby_norujukan[$gadai->norujukan]; + $total_untung_rebet = $data_transaksi->sum('keuntungan_rebet'); + $total_untung_asal = $data_transaksi->sum('bayaran_keuntungan'); + $total_bayaran_pembiayaan = $data_transaksi->sum('bayaran_pembiayaan'); + $beza_keuntungan = $total_untung_asal - $total_untung_rebet; + // dd($beza_keuntungan); + // dd(true); + $jbg = $gadai->tempoh - $gadai->tempohbayar; + $jbg2 = 12 - $gadai->tempohbayar; + if($gadai->tempoh <= '12.00'){ + $keuntungan = bcdiv(($jbg)*$gadai->kadarupah/100*$gadai->bakipjm,1,1)-$beza_keuntungan; + }else{ + $keuntungan = bcdiv(($jbg2)*$gadai->kadarupah/100*$gadai->bakipjm,1,1)-$beza_keuntungan; + } + + $ktlhbyr = $total_untung_asal; + $total_ktlhbyr = $total_ktlhbyr + $ktlhbyr; + $notis_all[$index1]['ktlhbyr'] = $ktlhbyr ? $ktlhbyr : 0.00; + } + else{ + // dd(false); + $jbg = $gadai->tempoh - $gadai->tempohbayar; + $jbg2 = 12 - $gadai->tempohbayar; + $beza_keuntungan = 0.00; + // dd($gadai->kadarupah); + if($gadai->tempoh <= '12.00'){ + // dd($jbg,$gadai->kadarupah, $gadai->bakipjm); + $keuntungan = bcdiv(($jbg)*$gadai->kadarupah/100*$gadai->pinjaman,1,1)-$beza_keuntungan; + }else{ + // dd(false); + $keuntungan = bcdiv(($jbg2)*$gadai->kadarupah/100*$gadai->pinjaman,1,1)-$beza_keuntungan; + } + } + // dd($gadai->pinjaman); + if($customers_keyBy_noKp[$gadai->nokp]){ + $notis_all[$index1]["cust_info"] = $customers_keyBy_noKp[$gadai->nokp]; + } + $total_berat = $total_berat + $gadai['berat']; + $total_pinjaman = $total_pinjaman + $gadai['[pinjaman]']; + $total_bakipjm = $total_bakipjm + $gadai['bakipjm']; + $total_nilaimarhun = $total_nilaimarhun + $gadai['nilaimarhun']; + $total_bakiupah = $total_bakiupah + $gadai['bakiupah']; + + $notis_all[$index1]['keuntungan'] = $keuntungan; + } + + return view('notisperingatan.senaraimarhunnotis',compact('notis_all','total_berat', + 'total_nilaimarhun', + 'total_pinjaman', + 'total_bakipjm', + 'total_bakiupah', + 'total_ktlhbyr', + 'notislel', + 'notis_id', + 'cawid', + 'cawanganDetail')); + } + + public function kemaskinidatanotis($tarikhnotis) + { + $user = Auth::user(); + $currentdate = Carbon::now(); + $currentdate = $currentdate->toDateTimeString(); + $data = []; + + $notis_all = Notis::with(['cawangan', 'notisBid'])->where('tarikh_notis',$tarikhnotis)->get(); + + foreach ($notis_all as $notisall) { + $cawanganAll = $notisall->cawangan; + // dump($notisall['id']); + $notisBidGroupByCawId = $notisall->notisBid->groupBy('caw_id'); + $notisbid_pluck_by_norujukan = $notisall->notisBid->pluck('norujukan')->toArray(); + $notisbid_keyby_norujukan = $notisall->notisBid->keyBy('norujukan'); + + foreach ($cawanganAll as $caw_key_by_id) { + $cawanganDetail = $cawanganAll->find($caw_key_by_id['id']); + $gadai_all = Gadai::on($cawanganDetail['caw_code'])->whereIn('norujukan', $notisbid_pluck_by_norujukan) + ->select('sttebus','kadarupah','nokp','tempoh','tempohbayar','norujukan','berat','nilaimarhun','pinjaman','bakipjm','bakiupah','hargajualan','bakihargajualan') + ->orderBy('norujukan','ASC') + ->get(); + + $transaksi_all = TransaksiKeuntungan::on('main')->whereIn('norujukan', $notisbid_pluck_by_norujukan) + ->select('keuntungan_rebet','bayaran_keuntungan','norujukan') + ->get(); + // dd($transaksi_all); + $transaksi_all_groupby_norujukan = $transaksi_all->groupBy('norujukan'); + + if ($notisBidGroupByCawId[$caw_key_by_id['id']]); { + $caw_key_by_id['notisBid'] = $notisBidGroupByCawId[$caw_key_by_id['id']]; + + } + + foreach($gadai_all as $data) + { + if($data['sttebus'] == "T" || $data['sttebus'] == "L") + { + $lelongtebus = new LelongTebus; + $lelongtebus->tarikh = $currentdate; + $lelongtebus->kodcaw = $cawanganDetail['caw_code']; + $lelongtebus->teller = $user->name; + $lelongtebus->norujukan = $data['norujukan']; + $lelongtebus->batch_no = $notisall['id']; + $lelongtebus->nilaimarhun = $data['nilaimarhun']; + $lelongtebus->pinjaman = $data['pinjaman']; + $lelongtebus->upah = $data['bakiupah']; + $lelongtebus->jbg = $data['tempoh']; + if($data['sttebus'] == "T"){ + $lelongtebus->jenis_tebus = 'T'; + } + else if($data['sttebus'] == "L"){ + $lelongtebus->jenis_tebus = 'L'; + } + $lelongtebus->save(); + + //insert loguser + $loguser = new LogUser; + $loguser->user_id = $user->id; + $loguser->date = $currentdate; + $loguser->username = $user->username; + $loguser->nama_user = $user->name; + $loguser->norujukan = $data['norujukan']; + if($data['sttebus'] == "T"){ + $loguser->nota = 'OUT NOTIS TEBUS '.$notisall['id']; + } + else if($data['sttebus'] == "L"){ + $loguser->nota = 'OUT NOTIS LELONG '.$notisall['id']; + } + + $loguser->save(); + //hapus notisbid + $updatelelong = NotisBid::where('norujukan','=',$data['norujukan'])->first(); + $updatelelong->delete(); + + $checksag = NotisBid::where('kodcaw',$cawanganDetail['caw_code']) + ->where('notis_id',$notisall['id']) + ->first(); + // dd($checksag); + + if(empty($checksag)) + { + $notisbatch = CawanganNotis::where('caw_id','=',$cawanganDetail['id'])->first(); + $notisbatch->delete(); + + //insert loguser + $loguser = new LogUser; + $loguser->user_id = $user->id; + $loguser->date = $currentdate; + $loguser->username = $user->username; + $loguser->nama_user = $user->name; + $loguser->nota = 'HAPUS CAW NOTIS '.$notisall['id']; + $loguser->save(); + } + } + } + } + return redirect()->route('notisperingatan.shownotisperingatanall',[$tarikhnotis,$notisall['id']]) + ->with('success','Kemaskini Berjaya'); + } +} + +public function jananotisperingatan2($notisid,$cawid) + { + $user = Auth::user(); + $caw = Cawangan::where('id', '=', $cawid)->first(); + + $currentdate = Carbon::now(); + $tarikh_cetak = $currentdate->toDateString(); + + $notis = Notis::find($notisid); + // dd($notisid); + + $arraynorujukan = NotisBid::where('notis_id', $notisid)->where('kodcaw', $caw->caw_code)->pluck('norujukan'); + // dd($arraynorujukan); + + $marhuns = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan','bakipjm','t_matang','tempoh')->orderBy('nokp', 'asc')->get(); + + $marhuns_pluck_nokp = $marhuns->pluck('nokp'); + + $customers = Customer::whereIn('kpbaru', $marhuns_pluck_nokp) + ->orWhereIn('kplama', $marhuns_pluck_nokp) + ->join('poskod', 'customer.poskod', '=', 'poskod.poskod') + ->join('daerah', 'poskod.koddaerah', '=', 'daerah.koddaerah') + ->join('negeri', 'poskod.kodnegeri', '=', 'negeri.kodnegeri') + ->get(); + + $customers_keyBy_noKp = $customers->keyBy(function ($item) { + if ($item->kpbaru != '') { + return $item->kpbaru; + } else if ($item->kplama != '') { + return $item->kplama; + } + }); + + foreach ($marhuns as $index => $marhun) { + if ($customers_keyBy_noKp[$marhun->nokp]) { + $marhuns[$index]['nama'] = $customers_keyBy_noKp[$marhun->nokp]; + $marhuns[$index]['notis'] = $notis; + } + } + //update status cetak + $updatestatus = CawanganNotis::where('notis_id', '=', $notisid)->where('caw_id', '=', $cawid)->first(); + $updatestatus->status = '2'; + $updatestatus->save(); + + $pdf = PDF::loadView('pdf.jananotisperingatan', compact('marhuns','notis', 'notisid', 'caw', 'tarikh_cetak')) + ->setPaper('a4', 'potrait'); + + return $pdf->download('Penjanaan Notis Peringatan Fasa 1 ' . $notisid . '.pdf'); + } + + public function jananotisperingatan2fasa2($notisid,$cawid) + { + $user = Auth::user(); + $caw = Cawangan::where('id', '=', $cawid)->first(); + + $currentdate = Carbon::now(); + $tarikh_cetak = $currentdate->toDateString(); + + $notis = Notis::find($notisid); + // dd($notisid); + + $arraynorujukan = NotisBid::where('notis_id', $notisid)->where('kodcaw', $caw->caw_code)->pluck('norujukan'); + // dd($arraynorujukan); + + $marhuns = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan','bakipjm','t_matang1','tempoh')->orderBy('nokp', 'asc')->get(); + + $marhuns_pluck_nokp = $marhuns->pluck('nokp'); + + $customers = Customer::whereIn('kpbaru', $marhuns_pluck_nokp) + ->orWhereIn('kplama', $marhuns_pluck_nokp) + ->join('poskod', 'customer.poskod', '=', 'poskod.poskod') + ->join('daerah', 'poskod.koddaerah', '=', 'daerah.koddaerah') + ->join('negeri', 'poskod.kodnegeri', '=', 'negeri.kodnegeri') + ->get(); + + $customers_keyBy_noKp = $customers->keyBy(function ($item) { + if ($item->kpbaru != '') { + + return $item->kpbaru; + } else if ($item->kplama != '') { + return $item->kplama; + } + }); + + foreach ($marhuns as $index => $marhun) { + if ($customers_keyBy_noKp[$marhun->nokp]) { + $marhuns[$index]['nama'] = $customers_keyBy_noKp[$marhun->nokp]; + $marhuns[$index]['notis'] = $notis; + } + } + //update status cetak + $updatestatus = CawanganNotis::where('notis_id', '=', $notisid)->where('caw_id', '=', $cawid)->first(); + $updatestatus->status = '2'; + $updatestatus->save(); + + $pdf = PDF::loadView('pdf.jananotisperingatan2', compact('marhuns','notis', 'notisid', 'caw', 'tarikh_cetak')) + ->setPaper('a4', 'potrait'); + + return $pdf->download('Penjanaan Notis Peringatan Fasa 2 ' . $notisid . '.pdf'); + } + + public function blastnotisperingatan($notisid,$cawid) + { + $user = Auth::user(); + $caw = Cawangan::where('id', '=', $cawid)->first(); + + $currentdate = Carbon::now(); + $tarikh_cetak = $currentdate->toDateString(); + + $notis = Notis::find($notisid); + // dd($notis->tarikh_notis); + $notis_bid_all = NotisBid::select('id','nokp','norujukan','jbg','pinjaman','fasa')->where('notis_id', $notisid)->where('kodcaw', $caw->caw_code)->get(); + $arraynorujukan_notis_bid_all = NotisBid::where('notis_id', $notisid)->where('kodcaw', $caw->caw_code)->pluck('norujukan'); + + $arraynorujukan = NotisBid::where('notis_id', $notisid)->where('kodcaw', $caw->caw_code)->pluck('norujukan'); + $gadai_all = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan','bakipjm','t_matang','t_matang1','tempoh')->orderBy('nokp', 'asc')->get(); + + $customers_list = $gadai_all->pluck('nokp')->unique(); + $customers = Customer::whereIn('kpbaru', $customers_list) + ->orWhereIn('kplama', $customers_list) + ->select('id','kpbaru','kplama' ,'nama', 'telefon') + ->get()->keyBy('id'); + + $customers_keyBy_noKp = $customers->keyBy(function ($item) { + if ($item->kpbaru != '') { + return $item->kpbaru; + } else if ($item->kplama != '') { + return $item->kplama; + } + }); + + $customers_pluck_notel = $customers_keyBy_noKp->pluck('telefon'); + // dd($customers_pluck_notel); + foreach($customers_pluck_notel as $index1 =>$custphone) { + // dd($custphone); + $special = preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $custphone); + // dump($special); + if($special == 0){ + if($custphone == ''){ + $newtel = ''; + }elseif($custphone <> ''){ + $newtel = '6'.$custphone; + } + } + elseif($special == 1){ + if($custphone == ''){ + $newtel = ''; + }elseif($custphone <> ''){ + $newtel = '6'.str_replace( array( '-' ), '', $custphone); + } + } + // dump($newtel); + + } + $notis_bid_all_groupby_norujukan = $notis_bid_all->groupBy('norujukan'); + $notis_all_keyBy_norujukan = $gadai_all->keyBy('norujukan'); + foreach($notis_bid_all_groupby_norujukan as $index7=>$notisbid){ + // dd($notis_all_keyBy_norujukan); + if($notis_all_keyBy_norujukan[$index7]){ + + $gadai_true = $notis_all_keyBy_norujukan[$index7]; + $gadai_true['data_notisbid'] = $notisbid; + } + + } + // dd($gadai_all); + foreach ($gadai_all as $index => $suratnotis) { + $datanotisbid = $suratnotis['data_notisbid'][0]->fasa; + // dd($suratnotis); + if($customers_keyBy_noKp[$suratnotis->nokp]) + { + $mobile_no = '60178916936'; + // $mobile_no = $newtel; + $user_true = $customers_keyBy_noKp[$suratnotis->nokp]; + $nama = $user_true->nama; + $bakipjm = number_format($suratnotis->bakipjm, 2, '.', ','); + $t_matang = Carbon::parse($suratnotis->t_matang); + $t_matang1 = Carbon::parse($suratnotis->t_matang1); + $t_matangf1 = $t_matang->format('d-m-Y'); + $t_matangf2 = $t_matang1->format('d-m-Y'); + $cawname = $caw->caw_name; + // dd($t_matang1); + if( $datanotisbid == '1'){ + $message = 'Kepada *'.$nama.'* ('.$suratnotis->nokp.'),'.' Dengan hormatnya dimaklumkan gadaian tuan/puan bernombor *'.$suratnotis->norujukan.'* dengan jumlah baki pembiayaan sebanyak *RM'.$bakipjm.'*'.' akan/telah tamat tarikh matang gadaiannya pada *'.$t_matangf1.'* yang telah mencecah *'.$suratnotis->tempoh.' bulan*. Tuan/puan atau wakil adalah dikehendaki menebus/membayar *KOS KEUNTUNGAN* tersebut secepat mungkin. Jika pihak tuan/puan menghadapi sebarang masalah, sila hubungi kami sebagaimana alamat di dalam *Surat Akaun Gadaian* ATAU datang sendiri ke *'.$cawname.'* dengan membawa bersama salinan asal Surat Akaun Gadaian tuan/puan. Sekian, terima kasih.'; + } + else if( $datanotisbid == '2'){ + $message = 'Kepada *'.$nama.'* ('.$suratnotis->nokp.'),'.' Dengan hormatnya dimaklumkan gadaian tuan/puan bernombor *'.$suratnotis->norujukan.'* dengan jumlah baki pembiayaan sebanyak *RM'.$bakipjm.'*'.' akan/telah tamat kontrak gadaiannya pada *'.$t_matangf2.'* yang telah mencecah *'.$suratnotis->tempoh.' bulan*. Tuan/puan atau wakil adalah dikehendaki menebus/membayar *KOS KEUNTUNGAN* tersebut secepat mungkin. Jika pihak tuan/puan menghadapi sebarang masalah, sila hubungi kami sebagaimana alamat di dalam *Surat Akaun Gadaian* ATAU datang sendiri ke *'.$cawname.'* dengan membawa bersama salinan asal Surat Akaun Gadaian tuan/puan. Sekian, terima kasih.'; + } + // dd($message); + // $message = 'Hello%20Nadine%0Ahow%20are%20you%0A'; + $response = Http::get(env('WABOT_API'), [ + 'number' => $mobile_no, + 'type' => 'text', + 'message' => $message, + 'instance_id' => env('WABOT_INSTANCES_ID'), + 'access_token' => env('WABOT_TOKEN_KEYS') + ]); + + $res_json = $response->json(); + if ($res_json['status'] == "error") { + $message = "WABOT: " . $res_json['message'] . " - " . $res_json['data']; + Log::error($message); + } else { + $message = "WABOT: Success " . $res_json['data']['key']['remoteJid'] . " - " . $res_json['data']['message']['extendedTextMessage']['text']; + Log::info($message); + } + } + // dd($suratnotis['data_notisbid'][$index]); + } + + $updatestatus = CawanganNotis::where('notis_id', '=', $notisid)->where('caw_id', '=', $cawid)->first(); + $updatestatus->status = '3'; //blastwabot + $updatestatus->save(); + + return redirect()->route('notisperingatan.shownotisperingatanall',[$notis->tarikh_notis,$notisid]) + ->with('success','Kemaskini Berjaya'); + } + + + + + + + diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index ca0c9cbe..d29f3852 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -247,6 +247,11 @@ class ReportController extends Controller public function senarailapbidaan ($lelong_id, $kodcaw){ + $lel = Lelong::with('cawangan')->find($lelong_id); + + $cawname = Cawangan::where('caw_code','=',$kodcaw)->first(); + // dd($cawname->id); + $cawanganDetail = $lel->cawangan->find($cawname->id); $arraydetails = []; $arrayinfocaw = []; @@ -304,7 +309,7 @@ class ReportController extends Controller // return $pdf->download('Senarai Nama Bidaan Pembida.pdf'); - return view('lelong.senarailapbidaanpembida',compact('kodcaw','lelongid','arraydetails','lelong_id','lelongid','cawangan','arrayinfocaw','total_hargaasas','total_hargabida')); + return view('lelong.senarailapbidaanpembida',compact('cawanganDetail','kodcaw','lelongid','arraydetails','lelong_id','lelongid','cawangan','arrayinfocaw','total_hargaasas','total_hargabida')); diff --git a/app/Models/Cawangan.php b/app/Models/Cawangan.php index 02b14463..0fa172dd 100644 --- a/app/Models/Cawangan.php +++ b/app/Models/Cawangan.php @@ -70,4 +70,9 @@ class Cawangan extends Model { return $this->belongsTo(User::class, 'kodcaw', 'caw_code'); } + + public function notisBid() + { + return $this->hasMany(NotisBid::class, 'caw_id', 'id'); + } } diff --git a/app/Models/CawanganNotis.php b/app/Models/CawanganNotis.php new file mode 100644 index 00000000..19947509 --- /dev/null +++ b/app/Models/CawanganNotis.php @@ -0,0 +1,38 @@ +hasMany(LelongBid::class, 'caw_id', 'caw_id'); + // } + + 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/Notis.php b/app/Models/Notis.php new file mode 100644 index 00000000..93bdcec2 --- /dev/null +++ b/app/Models/Notis.php @@ -0,0 +1,61 @@ +belongsToMany(Cawangan::class, 'cawangan_notis', 'notis_id', 'caw_id')->withPivot('status'); + } + + public function cawanganNotis() + { + return $this->hasMany(cawanganNotis::class, 'notis_id'); + } + + public function notisBid() + { + return $this->hasMany(NotisBid::class, 'notis_id', 'id'); + } + + // public function lelongBidJual() + // { + // return $this->hasMany(LelongBid::class, 'lelong_id', 'id')->where('status_jual', 1); + // } + + // public function lelongBidBelumSemak() + // { + // return $this->hasMany(LelongBid::class, 'lelong_id', 'id')->where('status_semak', 0); + // } + + // public function lelKarat() + // { + // return $this->hasMany(LelKarat::class, 'lelong_id', 'id'); + // } + + // public function pengesahan() + // { + // return $this->hasMany(Pengesahan::class, 'lelong_id', 'id'); + // } + + // public function pengesahanTelahSah() + // { + // return $this->hasMany(Pengesahan::class, 'lelong_id', 'id')->whereNotNull('disahkan_oleh'); + // } +} diff --git a/app/Models/NotisBid.php b/app/Models/NotisBid.php new file mode 100644 index 00000000..c17c6160 --- /dev/null +++ b/app/Models/NotisBid.php @@ -0,0 +1,45 @@ +belongsTo(Cawangan::class, 'caw_id', 'id'); + } + + public function notis() + { + return $this->belongsTo(Notis::class, 'notis_id', 'id'); + } + + public function cawanganNotis(){ + return $this->hasOne(CawanganNotis::class, 'caw_id','caw_id'); + } + +} diff --git a/database/migrations/2023_01_10_112549_seed_system_user.php b/database/migrations/2023_01_10_112549_seed_system_user.php index ebed371f..bbe73b04 100644 --- a/database/migrations/2023_01_10_112549_seed_system_user.php +++ b/database/migrations/2023_01_10_112549_seed_system_user.php @@ -34,6 +34,6 @@ class SeedSystemUser extends Migration */ public function down() { - // + Schema::dropIfExists('users'); } } diff --git a/database/migrations/2023_04_04_083509_create_notis_table.php b/database/migrations/2023_04_04_083509_create_notis_table.php new file mode 100644 index 00000000..5788de16 --- /dev/null +++ b/database/migrations/2023_04_04_083509_create_notis_table.php @@ -0,0 +1,89 @@ +bigIncrements('id'); + $table->string('tarikh_notis')->nullable(); + $table->string('daritempoh')->nullable(); + $table->string('hinggatempoh')->nullable(); + $table->integer('sts_notis')->nullable(); + $table->integer('fasa')->nullable(); + $table->timestamps(); + }); + + Schema::create('notisbid', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->unsignedBigInteger('notis_id')->unsigned(); + $table->string('tarikh_notis'); + $table->unsignedBigInteger('caw_id')->unsigned(); + $table->string('kodcaw'); + $table->string('norujukan'); + $table->string('nokp'); + $table->decimal('jbg', $precision = 7, $scale = 2); + $table->decimal('kadarupah', $precision = 5, $scale = 2)->nullable(); + $table->decimal('nilaimarhun', $precision = 9, $scale = 2); + $table->decimal('pinjaman', $precision = 9, $scale = 2)->nullable(); + $table->decimal('bakiupah', $precision = 7, $scale = 2); + $table->decimal('berat', $precision = 7, $scale = 2); + $table->string('marhun'); + $table->decimal('percent', $precision = 7, $scale = 2); + $table->integer('fasa')->default(0); + $table->date('tarikhnotis1')->nullable(); + $table->date('tarikhnotis2')->nullable(); + $table->timestamps(); + + $table->foreign('caw_id') + ->references('id')->on('cawangan') + ->onDelete('cascade'); + + $table->foreign('notis_id') + ->references('id')->on('notis') + ->onDelete('cascade'); + }); + + Schema::create('cawangan_notis', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->unsignedBigInteger('notis_id')->unsigned(); + $table->unsignedBigInteger('caw_id')->unsigned(); + $table->integer('fasa')->default(0); + $table->string('daritempoh')->nullable(); + $table->string('hinggatempoh')->nullable(); + $table->integer('status')->nullable(); + $table->timestamps(); + + $table->foreign('caw_id') + ->references('id')->on('cawangan') + ->onDelete('cascade'); + + $table->foreign('notis_id') + ->references('id')->on('notis') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('notis'); + Schema::dropIfExists('notisbid'); + Schema::dropIfExists('cawangan_notis'); + + } +} diff --git a/resources/views/excel/gadaibycawnotisfasa1excel.blade.php b/resources/views/excel/gadaibycawnotisfasa1excel.blade.php new file mode 100644 index 00000000..bbf08915 --- /dev/null +++ b/resources/views/excel/gadaibycawnotisfasa1excel.blade.php @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @foreach($getsurat as $index1=> $notis) + + + + + + + + + + + + + + + + + + + @endforeach + + {{-- @foreach($getsurat as $surat) + + + + + + + + + + + + + + + +@endforeach --}} + + + + + + + + + + \ No newline at end of file diff --git a/resources/views/includes/sidebar.blade.php b/resources/views/includes/sidebar.blade.php index 584b75d0..da065f6f 100644 --- a/resources/views/includes/sidebar.blade.php +++ b/resources/views/includes/sidebar.blade.php @@ -711,7 +711,35 @@ -
  • +
  • + + {{-- + --}} + +
  • + {{--
  • - + --}}
  • BilNo RujukanNamaNo.KPNo.TelefonMarhunBerat (gm)TempohPembiayaan (RM)Baki Pembiayaan (RM)Keuntungan 6 Bulan (RM)Keuntungan Telah Bayar (RM)
    {{ $loop->iteration }}{{ $notis['list_norujukan'][0]['norujukan'] }}{{ $notis['nama'][0]['nama'] ?? NULL}}{{ $notis['list_norujukan'][0]['nokp'] }}6{{ $notis['nama'][0]['telefon'] ?? NULL}}{{ $notis['list_norujukan'][0]['marhun'] }}{{ $notis['list_norujukan'][0]['berat'] }}{{ $notis['list_norujukan'][0]['tempoh'] }}{{ $notis['list_norujukan'][0]['pinjaman'] }}{{ $notis['list_norujukan'][0]['bakipjm'] }}{{ $notis['list_norujukan'][0]['bakiupah'] }}{{ number_format($notis['ktlhbyr'] , 2, '.', ',')}}
    {{ $loop->iteration }}{{ $surat['list_norujukan'][0]['norujukan'] }}{{ $surat['list_norujukan'][0]['nokp'] }}60{{ $surat['list_norujukan'][0]['telefon'] }}{{ $surat['list_norujukan'][0]['tempoh'] }}{{ $surat['list_norujukan'][0]['berat'] }}{{ $surat['list_norujukan'][0]['pinjaman'] }}{{ $surat['list_norujukan'][0]['bakipjm'] }}{{ $surat['list_norujukan'][0]['bakiupah'] }}{{ number_format($surat['ktlhbyr'] , 2, '.', ',')}}
    + + + + + + + + + + + + + + + + + + @foreach($getsurat as $surat) + + + + + + + + + + + + + + + + + + + @endforeach + +
    BilNo RujukanNamaNo.KPNo.TelefonMarhunBerat (gm)TempohPembiayaan (RM)Baki Pembiayaan (RM)Keuntungan 6 Bulan (RM)Keuntungan Telah Bayar (RM)
    {{ $loop->iteration }}{{ $surat['list_norujukan'][0]['norujukan'] }}{{ $surat['nama'][0]['nama'] ?? NULL}}{{ $surat['list_norujukan'][0]['nokp'] }}6{{ $surat['nama'][0]['telefon'] ?? NULL}}{{ $surat['list_norujukan'][0]['marhun'] }}{{ $surat['list_norujukan'][0]['berat'] }}{{ $surat['list_norujukan'][0]['tempoh'] }}{{ $surat['list_norujukan'][0]['pinjaman'] }}{{ $surat['list_norujukan'][0]['bakipjm'] }}{{ $surat['list_norujukan'][0]['bakiupah'] }}{{ number_format($surat['ktlhbyr'] , 2, '.', ',')}}
    + + + + + + +@endsection diff --git a/resources/views/jananotis/notisfasa1.blade.php b/resources/views/jananotis/notisfasa1.blade.php new file mode 100644 index 00000000..4ada230c --- /dev/null +++ b/resources/views/jananotis/notisfasa1.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    + @if ($message = Session::get('failed')) +
    +

    {{ $message }}

    +
    + @endif +

    Notis Peringatan Fasa 1

    + +
    + @csrf +
    + {{-- --}} + {{--
    + +
    --}} + +
    + +
    + +
    + +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + + +@endsection diff --git a/resources/views/lelong/senarailapbidaanpembida.blade.php b/resources/views/lelong/senarailapbidaanpembida.blade.php index 782fce23..b8323ff2 100644 --- a/resources/views/lelong/senarailapbidaanpembida.blade.php +++ b/resources/views/lelong/senarailapbidaanpembida.blade.php @@ -18,7 +18,7 @@
    - SENARAI BIDAAN PEMBIDA + SENARAI BIDAAN PEMBIDA : {{$cawanganDetail->caw_name}}
    diff --git a/resources/views/lelong/senaraiubahrugilelongnew.blade.php b/resources/views/lelong/senaraiubahrugilelongnew.blade.php index f085a3ed..0d627cfc 100644 --- a/resources/views/lelong/senaraiubahrugilelongnew.blade.php +++ b/resources/views/lelong/senaraiubahrugilelongnew.blade.php @@ -107,7 +107,7 @@ Caj Lelong Asal (RM) Baki/(Rugi) Asal (RM) Caj Lelong Ubah (RM) - Baki/(Rugi) Ubah (RM) + Baki/(Rugi) Ubah (RM) Caj Lelong Baru (RM) Baki/(Rugi) Baru (RM) {{-- Tindakan --}} diff --git a/resources/views/notisperingatan/jananotisperingatan.blade.php b/resources/views/notisperingatan/jananotisperingatan.blade.php new file mode 100644 index 00000000..66bc4353 --- /dev/null +++ b/resources/views/notisperingatan/jananotisperingatan.blade.php @@ -0,0 +1,130 @@ +@extends('layouts.app') + +@section('content') + + + +
    +
    +
    +
    +
    +
    + Jana Notis Peringatan +
    +
    +
    + @if ($message = Session::get('failed')) +
    + {{ $message }} +
    + @endif +
    + @csrf +
    Sila Tunggu Sebentar...
    + {{--
    + +
    + +
    +
    --}} +
    + +
    + + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + + + +
    + {{--
    + + +
    + +
    +
    --}} + + {{--
    + + +
    + +
    +
    --}} +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + + + + +@endsection diff --git a/resources/views/notisperingatan/senaraimarhunnotis.blade.php b/resources/views/notisperingatan/senaraimarhunnotis.blade.php new file mode 100644 index 00000000..21896b94 --- /dev/null +++ b/resources/views/notisperingatan/senaraimarhunnotis.blade.php @@ -0,0 +1,211 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    +
    + + + +
    + senarai Sag : {{ $cawanganDetail->caw_name }} +
    +
    +
    +
    + @if ($message = Session::get('success')) +
    + {{ $message }} +
    + @endif + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $notislel->tarikh_notis ); + $t_notis = $myDateTime->format('d-m-Y'); + @endphp + +
    + +
    +
    + +@endsection diff --git a/resources/views/notisperingatan/senarainotisall.blade.php b/resources/views/notisperingatan/senarainotisall.blade.php new file mode 100644 index 00000000..1a98106b --- /dev/null +++ b/resources/views/notisperingatan/senarainotisall.blade.php @@ -0,0 +1,143 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    + +
    + + butiran Notis Peringatan +
    +
    +
    + @if ($message = Session::get('success')) +
    +

    {{ $message }}

    +
    + @endif +
    + +
    + + + + + + {{-- --}} + {{-- + --}} + {{-- --}} + + + + + + @forelse ($arrayinfo as $info) + + + + + + + @empty + + @endforelse + + +
    NoTarikh NotisTarikh LelongFasaCawanganHarga Asas (RM)Tindakan
    {{$loop->iteration}} @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $info['info']['tarikh_notis']); + $datez = $myDateTime->format('d-m-Y'); + @endphp + {{$datez}} + + {{-- --}} + + +
    Tiada Data
    +
    +
    +
    + +
    +
    + + +@endsection diff --git a/resources/views/notisperingatan/senaraitempnotisperingatan.blade.php b/resources/views/notisperingatan/senaraitempnotisperingatan.blade.php new file mode 100644 index 00000000..05ede1fe --- /dev/null +++ b/resources/views/notisperingatan/senaraitempnotisperingatan.blade.php @@ -0,0 +1,188 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    +
    + Butiran Gadaian Mengikut Cawangan Notis Peringatan Fasa {{$fasa}} +
    +
    +
    + @if ($message = Session::get('failed')) +
    +

    {{ $message }}

    +
    + @endif + + {{-- @if (Session::has('message')) +
    {{ Session::get('message') }}
    + @endif --}} + + {{--

    Butiran Gadaian Mengikut Cawangan Lelongan Fasa {{$fasa}}

    --}} + +
    + + + @csrf + + +
    Sila Tunggu Sebentar...
    + +
    +
    +
    + + + + {{-- + + --}} + +
    +
    +
    + + + + + + + + + + + {{-- --}} + + + + + + @php $count = 1; @endphp + @foreach($senarai as $send) + @if($send['bil_lelong'] > 0) + + + + + + + + + + + {{-- --}} + + + @endif + @endforeach + +
    BilKod CawanganCawanganBil LelongBerat (gm)Nilai MarhunPembiayaan (RM)Baki Pembiayaan (RM)Tindakan
    {{ $count++ }}{{ $send['kodcaw'] }}{{ $send['caw_name'] }}{{ $send['bil_lelong'] }} {{ number_format($send['total_berat'], 2) }} {{ number_format($send['total_nilaimarhun'], 2) }} {{ number_format($send['total_pembiayaan'] , 2) }} {{ number_format($send['total_bakipjm'] , 2) }} + @if($fasa == '1') + + @else + + @endif +
    + + +
    +
    +
    +
    + + + + +@endsection diff --git a/resources/views/notisperingatan/shownotisperingatan.blade.php b/resources/views/notisperingatan/shownotisperingatan.blade.php new file mode 100644 index 00000000..9cfddc6a --- /dev/null +++ b/resources/views/notisperingatan/shownotisperingatan.blade.php @@ -0,0 +1,331 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    + + + +
    + +
    +
    +
    + @if ($message = Session::get('success')) +
    + {{ $message }} +
    + @endif + + + +
    +
    +
    +
    +
    + + +@endsection diff --git a/resources/views/notisperingatan/shownotisperingatanall.blade.php b/resources/views/notisperingatan/shownotisperingatanall.blade.php new file mode 100644 index 00000000..b0c98515 --- /dev/null +++ b/resources/views/notisperingatan/shownotisperingatanall.blade.php @@ -0,0 +1,372 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    + + + +
    + + butiran Notis Peringatan +
    +
    +
    + @if ($message = Session::get('success')) +
    + {{ $message }} +
    + @endif + + + + +
    +
    + + +@endsection diff --git a/resources/views/notisperingatan/tempbycawnotisperingatan.blade.php b/resources/views/notisperingatan/tempbycawnotisperingatan.blade.php new file mode 100644 index 00000000..0241fa69 --- /dev/null +++ b/resources/views/notisperingatan/tempbycawnotisperingatan.blade.php @@ -0,0 +1,137 @@ +@extends('layouts.app') + +@section('content') +
    +
    +
    +
    +
    + + + +
    + Butiran Gadaian Cawangan {{ $details }} +
    +
    +
    + {{-- + +

    Butiran Gadaian Cawangan {{ $details }}

    --}} + + @if ($message = Session::get('failed')) +
    +

    {{ $message }}

    +
    + @endif +
    + + @csrf + + + + + + + + + + + + + + + + + + + + @foreach($getsurat as $surat) + {{-- {{dd($surat)}} --}} + + + + + + + + + + + + + + + @endforeach + +
    BilNo RujukanNo Kad PengenalanTempohBerat (gm)Nilai Marhun Asal (RM)Pembiayaan (RM)Baki Pembiayaan (RM)Jumlah Bayaran (RM)Keuntungan 6 Bulan (RM)Keuntungan Semasa (RM)Tamat Kontrak
    {{ $loop->iteration }}{{ $surat->norujukan }}{{ $surat->nokp }}{{ $surat->tempoh }}{{ number_format($surat->berat , 2, '.', ',') }}{{ number_format($surat->nilaimarhun, 2, '.', ',') }}{{ number_format($surat->pinjaman , 2, '.', ',') }}{{ number_format($surat->bakipjm , 2, '.', ',') }}{{ number_format($surat->ktlhbyr , 2, '.', ',')}}{{ number_format($surat->bakiupah, 2, '.', ',') }}{{ number_format($surat->keuntungan , 2, '.', ',') }}{{ $surat->t_matang1 }}
    + +
    +
    +
    +
    + + +@endsection diff --git a/resources/views/pdf/gadaibycawnotisfasa1pdf.blade.php b/resources/views/pdf/gadaibycawnotisfasa1pdf.blade.php new file mode 100644 index 00000000..db49931c --- /dev/null +++ b/resources/views/pdf/gadaibycawnotisfasa1pdf.blade.php @@ -0,0 +1,197 @@ + + + + + + +
    + {{--
    PKB LOGO
    --}} + +
    +
    SENARAI NOTIS PERINGATAN FASA 1
    +
    + + + + + +
    Cawangan : {{ $cawanganDetail['caw_name'] }}Bilangan Surat : {{ $bil_lelongcaw[0]['bil_lelong'] }}
    + +
    +
    + + + + + {{-- --}} + + + + + + + + + + + @foreach($getsurat as $surat) + + + + {{-- --}} + + + + + + + + + + + + + @endforeach +
    BilNo RujukanNamaNo.KPNo.TelefonMarhunBerat (gm)TempohPembiayaan (RM)Baki Pembiayaan (RM)Keuntungan 6 Bulan (RM)Keuntungan Telah Bayar (RM)
    {{ $loop->iteration }}{{ $surat['list_norujukan'][0]['norujukan'] }}{{ $surat['nama'][0]['nama'] ?? NULL}}{{ $surat['list_norujukan'][0]['nokp'] }}6{{ $surat['nama'][0]['telefon'] ?? NULL}}{{ $surat['list_norujukan'][0]['marhun'] }}{{ $surat['list_norujukan'][0]['berat'] }}{{ $surat['list_norujukan'][0]['tempoh'] }}{{ $surat['list_norujukan'][0]['pinjaman'] }}{{ $surat['list_norujukan'][0]['bakipjm'] }}{{ $surat['list_norujukan'][0]['bakiupah'] }}{{ number_format($surat['ktlhbyr'] , 2, '.', ',')}}
    + +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/views/pdf/jananotisperingatan.blade.php b/resources/views/pdf/jananotisperingatan.blade.php new file mode 100644 index 00000000..fe68d64c --- /dev/null +++ b/resources/views/pdf/jananotisperingatan.blade.php @@ -0,0 +1,228 @@ + + + + + + + + + + + + + +@foreach($marhuns as $index1=> $notis) +{{-- {{dd($notis['nama']['alamat1'])}} --}} + + + + +
    + + + {{-- --}} + + + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TARIKH CETAK + :@php + $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak); + $datez = $myDateTime->format('d-m-Y'); + echo($datez); + @endphp + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $notis->t_matang); + $datez1 = $myDateTime->format('d-m-Y'); + // echo($datez); + @endphp +

    NO RUJUKAN:{{ $notis['norujukan']}}NO TELEFON:{{ $notis['nama']['telefon'] }}
    KEPADA:{{ $notis['nama']['nama']}} +
    {{ strtoupper($notis['nama']['alamat1']) }} + {{-- {!! ($notis['nama']['alamat1'] === null || $notis['nama']['alamat1'] === '') ? '' : '
    ' . strtoupper($notis['nama']['alamat1']) !!}
    --}}
    + {{ ' ' . $notis['nama']['poskod'] . ' ' . strtoupper($notis['nama']['namadaerah']) . ' ' . strtoupper($notis['nama']['negeri'])}}
    NO K/P: {{ $notis['nokp'] }}
    + + +

    Tuan/Puan,

    +

    NOTIS PEMBERITAHUAN

    +

    Dengan hormatnya dimaklumkan gadaian tuan/puan bernombor {{$notis->norujukan}} dengan jumlah pembiayaan + sebanyak RM{{number_format($notis->bakipjm, 2, '.', ',')}} akan/telah tamat tarikh matang gadaiannya pada {{$datez1}} yang telah mencecah {{$notis->tempoh}} bulan. + Tuan/puan atau wakil adalah dikehendaki menebus/membayar KOS KEUNTUNGAN tersebut secepat mungkin. + Jika pihak tuan/puan menghadapi sebarang masalah, sila hubungi kami sebagaimana alamat di atas ATAU + datang sendiri ke AR-RAHN dengan membawa bersama salinan asal Surat Akaun Gadaian tuan/puan.

    + + + +

    Sekian, terima kasih.

    + + + + +

    Nota:

    + Sila abaikan notis ini sekiranya pihak tuan/puan telah membuat urusan di atas. +
    + + Notis ini adalah cetakan berkomputer dan tiada tandatangan diperlukan + +
    +
    + @endforeach \ No newline at end of file diff --git a/resources/views/pdf/jananotisperingatan2.blade.php b/resources/views/pdf/jananotisperingatan2.blade.php new file mode 100644 index 00000000..7809d07f --- /dev/null +++ b/resources/views/pdf/jananotisperingatan2.blade.php @@ -0,0 +1,228 @@ + + + + + + + + + + + + + +@foreach($marhuns as $index1=> $notis) +{{-- {{dd($notis['nama']['alamat1'])}} --}} + + + + +
    + + + {{-- --}} + + + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TARIKH CETAK + :@php + $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak); + $datez = $myDateTime->format('d-m-Y'); + echo($datez); + @endphp + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $notis->t_matang1); + $datez1 = $myDateTime->format('d-m-Y'); + // echo($datez); + @endphp +

    NO RUJUKAN:{{ $notis['norujukan']}}NO TELEFON:{{ $notis['nama']['telefon'] }}
    KEPADA:{{ $notis['nama']['nama']}} +
    {{ strtoupper($notis['nama']['alamat1']) }} + {{-- {!! ($notis['nama']['alamat1'] === null || $notis['nama']['alamat1'] === '') ? '' : '
    ' . strtoupper($notis['nama']['alamat1']) !!}
    --}}
    + {{ ' ' . $notis['nama']['poskod'] . ' ' . strtoupper($notis['nama']['namadaerah']) . ' ' . strtoupper($notis['nama']['negeri'])}}
    NO K/P: {{ $notis['nokp'] }}
    + + +

    Tuan/Puan,

    +

    NOTIS PEMBERITAHUAN

    +

    Dengan hormatnya dimaklumkan gadaian tuan/puan bernombor {{$notis->norujukan}} dengan jumlah pembiayaan + sebanyak RM{{number_format($notis->bakipjm, 2, '.', ',')}} akan/telah tamat kontrak gadaiannya pada {{$datez1}} yang telah mencecah {{$notis->tempoh}} bulan. + Tuan/puan atau wakil adalah dikehendaki menebus/membayar KOS KEUNTUNGAN tersebut secepat mungkin. + Jika pihak tuan/puan menghadapi sebarang masalah, sila hubungi kami sebagaimana alamat di atas ATAU + datang sendiri ke AR-RAHN dengan membawa bersama salinan asal Surat Akaun Gadaian tuan/puan.

    + + + +

    Sekian, terima kasih.

    + + + + +

    Nota:

    + Sila abaikan notis ini sekiranya pihak tuan/puan telah membuat urusan di atas. +
    + + Notis ini adalah cetakan berkomputer dan tiada tandatangan diperlukan + +
    +
    + @endforeach \ No newline at end of file diff --git a/resources/views/pdf/jananotisperingatanfasa1.blade.php b/resources/views/pdf/jananotisperingatanfasa1.blade.php new file mode 100644 index 00000000..7b0f62b2 --- /dev/null +++ b/resources/views/pdf/jananotisperingatanfasa1.blade.php @@ -0,0 +1,223 @@ + + + + + + + + + + + + + +@foreach($marhuns as $index1=> $notis) +{{-- {{dd($notis['nama']['alamat1'])}} --}} + + + + +
    + + + {{-- --}} + + + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TARIKH CETAK + :@php + $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak); + $datez = $myDateTime->format('d-m-Y'); + echo($datez); + @endphp +

    NO RUJUKAN:{{ $notis['norujukan']}}NO TELEFON:{{ $notis['nama']['telefon'] ?? NULLL }}
    KEPADA:{{ $notis['nama']['nama'] ?? NULL}} +
    {{ strtoupper($notis['nama']['alamat1'] ?? NULL ) }} + {{-- {!! ($notis['nama']['alamat1'] === null || $notis['nama']['alamat1'] === '') ? '' : '
    ' . strtoupper($notis['nama']['alamat1']) !!}
    --}}
    + {{ ' ' . $notis['nama']['poskod'] ?? NULL. ' ' . strtoupper($notis['nama']['namadaerah']) . ' ' . strtoupper($notis['nama']['negeri'])}}
    NO K/P: {{ $notis['nokp'] }}
    + + +

    Tuan/Puan,

    +

    NOTIS PEMBERITAHUAN

    +

    Dengan hormatnya dimaklumkan gadaian tuan/puan bernombor {{ $notis['norujukan']}} dengan jumlah baki pembiayaan sebanyak RM {{ number_format($notis['bakipjm'] , 2, '.', ',')}} telah tamat tempoh gadaiannya pada @php + $myDateTime1 = DateTime::createFromFormat('Y-m-d', $notis['t_matang']); + $datez1 = $myDateTime1->format('d-m-Y'); + echo($datez1); + @endphp dan telah mencecah {{ $notis['tempoh']}} bulan. + Tuan/puan atau wakil adalah dikehendaki menebus/membayar ANSURAN PEMBIAYAAN tersebut secepat mungkin. Jika pihak tuan/puan menghadapi sebarang masalah, sila hubungi kami sebagaimana alamat di atas ATAU datang sendiri ke premis AR-RAHN kami.

    + + + + +

    Notis:

    + Sila bawa bersama Surat Akaun Gadai (SAG) untuk sebarang urusan. +
    + + Sila abaikan notis ini sekiranya penebusan telah dibuat. + +

    Surat ini adalah cetakan komputer dan tiada tandatangan diperlukan

    + +
    +
    + @endforeach \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index e802ec95..ad66262b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -653,6 +653,12 @@ Route::group(['middleware' => ['permission:notisperingatan'], 'prefix' => 'notis Route::post('/gadaibycawnotisfasa1',['as'=>'notisperingatan.gadaibycawnotisfasa1','uses'=>'NotisController@gadaibycawnotisfasa1']); Route::get('/gadaibycawnotisfasa1pdf/{tempoh}/{tempoh2}',['as'=>'notisperingatan.gadaibycawnotisfasa1pdf','uses'=>'NotisController@gadaibycawnotisfasa1pdf']); Route::get('/gadaibycawnotisfasa1excel/{tempoh}/{tempoh2}',['as'=>'notisperingatan.gadaibycawnotisfasa1excel','uses'=>'NotisController@gadaibycawnotisfasa1excel']); + + Route::get('/kemaskinidatanotis/{tarikhnotis}',['as'=>'notisperingatan.kemaskinidatanotis','uses'=>'NotisController@kemaskinidatanotis']); + Route::get('/jananotisperingatan2/{notisid}/{cawid}',['as'=>'notisperingatan.jananotisperingatan2','uses'=>'NotisController@jananotisperingatan2']); + Route::get('/jananotisperingatan2fasa2/{notisid}/{cawid}',['as'=>'notisperingatan.jananotisperingatan2fasa2','uses'=>'NotisController@jananotisperingatan2fasa2']); + Route::get('/blastnotisperingatan/{notisid}/{cawid}',['as'=>'notisperingatan.blastnotisperingatan','uses'=>'NotisController@blastnotisperingatan']); + }); // Route::get('/sms', [SmsController::class, 'index']);