From 9dc9d370e4d04bd1ae5c52e766887c93f90d1f6d Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 3 Apr 2023 15:52:47 +0800 Subject: [PATCH] update excel excel by sag dan pdf senarai notis lelong --- app/Http/Controllers/NotisController.php | 680 +++++++++++++++++- .../views/excel/listnotis_excel2.blade.php | 133 ++++ .../excel/listnotis_excelbysag.blade.php | 2 +- .../excel/listnotis_excelbysag2.blade.php | 110 +++ .../views/jananotis/senarainotis2.blade.php | 160 +++++ resources/views/pdf/listnotis2.blade.php | 224 ++++++ routes/web.php | 12 +- 7 files changed, 1313 insertions(+), 8 deletions(-) create mode 100644 resources/views/excel/listnotis_excel2.blade.php create mode 100644 resources/views/excel/listnotis_excelbysag2.blade.php create mode 100644 resources/views/jananotis/senarainotis2.blade.php create mode 100644 resources/views/pdf/listnotis2.blade.php diff --git a/app/Http/Controllers/NotisController.php b/app/Http/Controllers/NotisController.php index cf09c0f4..a1df40c8 100644 --- a/app/Http/Controllers/NotisController.php +++ b/app/Http/Controllers/NotisController.php @@ -19,6 +19,10 @@ 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 Carbon\Carbon; use PDF; @@ -123,6 +127,70 @@ class NotisController extends Controller return view('jananotis.senarainotis',compact('marhuns','lelong_id','bayaran','listsag')); } + public function senarainotis2($lelong_id){ + $user = Auth::user(); + $lelong = Lelong::find($lelong_id); + // dd($lelong); + $caw = Cawangan::with(["lelongBid" => function($q) use ($lelong_id){ + $q->where('lelong_id', '=', $lelong_id)->select('id','caw_id','kodcaw','norujukan','hargaasas','pinjaman','bakiupah'); + }]) + ->where('caw_code','=',$user->kodcaw)->first(); + + $lelongbid_data_pluck_norujukan = $caw->lelongBid->pluck('norujukan')->toArray(); + + $lelongbid_keyby_norujukan = $caw->lelongBid->keyBy('norujukan'); + // dd($lelongbid_keyby_norujukan); + + $gadai_all = Gadai::on($caw->caw_code)->whereIn('norujukan', $lelongbid_data_pluck_norujukan) + ->select('nokp','tempoh','norujukan','bakipjm','bakiupah','hargajualan','bakihargajualan') + ->orderBy('nokp','ASC') + ->get(); + + $gadai_all_pluck_nokp = $gadai_all->pluck('nokp')->unique(); + $customers = Customer::whereIn('kpbaru', $gadai_all_pluck_nokp) + ->orWhereIn('kplama', $gadai_all_pluck_nokp) + ->select('kpbaru', 'kplama','alamat1','alamat2','alamat3','telefon') + ->get(); + // dd($customers->toArray()); + $customers_keyBy_noKp = $customers->keyBy(function ($item) { + if ($item->kpbaru != '') { + return $item->kpbaru; + } else if ($item->kplama != '') { + return $item->kplama; + } + }); + + $gadai_all_groupby_nokp = $gadai_all->groupBy('nokp'); + + foreach($customers as $index=>$customer){ + if($customer->kpbaru != ''){ + $customers[$index]['nokp'] = $customer->kpbaru; + } + elseif($customer->kplama != ''){ + $customers[$index]['nokp'] = $customer->kplama; + } + + if($gadai_all_groupby_nokp[$customer->nokp]){ + $customers[$index]['gadai'] = $gadai_all_groupby_nokp[$customer->nokp]; + } + + foreach($customer['gadai'] as $index2=>$datagadai){ + if($lelongbid_keyby_norujukan[$datagadai->norujukan]){ + // $customer['gadai'][$index2]['lelongbid'] = $lelongbid_keyby_norujukan[$datagadai->norujukan]; + $lelongbid_true = $lelongbid_keyby_norujukan[$datagadai->norujukan]; + $ktlhbyr = $datagadai->hargajualan - $datagadai->bakihargajualan; + $sumcajlelong = $lelongbid_true->hargaasas * ($lelong->cajlelong / 100); + $cajlelongnew = round($sumcajlelong, 1, 1); + $totalbaki = $lelongbid_true->hargaasas - $lelongbid_true->pinjaman - $lelongbid_true->bakiupah - $cajlelongnew; + $customer['gadai'][$index2]['bakilelong'] = number_format($totalbaki, 2, '.', ','); + $customer['gadai'][$index2]['ktlhbyr'] = number_format($ktlhbyr, 2, '.', ','); + } + } + // dd($customer); + + } + return view('jananotis.senarainotis2',compact('customers','lelong_id')); + } public function jananotis($lelong_id){ @@ -314,7 +382,7 @@ class NotisController extends Controller else { $pdf = PDF::loadView('pdf.listnotis',compact('marhuns','lelong_id','bayaran','listsag','caw')) - ->setPaper('a4', 'portrait'); + ->setPaper('a4', 'landscape'); return $pdf->download('Senarai Notis.pdf'); } @@ -322,6 +390,101 @@ class NotisController extends Controller } + Public function listnotis2(Request $request){ + $user = Auth::user(); + $lelong_id = $request->lelong_id; + $lelong = Lelong::find($lelong_id); + $caw = Cawangan::with(["lelongBid" => function($q) use ($lelong_id){ + $q->where('lelong_id', '=', $lelong_id)->select('id','caw_id','kodcaw','norujukan','hargaasas','pinjaman','bakiupah'); + }]) + ->where('caw_code','=',$user->kodcaw)->first(); + + $lelongbid_data_pluck_norujukan = $caw->lelongBid->pluck('norujukan')->toArray(); + + $lelongbid_keyby_norujukan = $caw->lelongBid->keyBy('norujukan'); + // dd($lelongbid_keyby_norujukan); + + $gadai_all = Gadai::on($caw->caw_code)->whereIn('norujukan', $lelongbid_data_pluck_norujukan) + ->select('nokp','tempoh','norujukan','bakipjm','bakiupah','hargajualan','bakihargajualan') + ->orderBy('norujukan','ASC') + ->get(); + // dd($gadai_all); + + + + $gadai_all_pluck_nokp = $gadai_all->pluck('nokp')->unique(); + $customers = Customer::whereIn('kpbaru', $gadai_all_pluck_nokp) + ->orWhereIn('kplama', $gadai_all_pluck_nokp) + ->select('nama','kpbaru', 'kplama','alamat1','alamat2','alamat3','telefon') + ->get(); + // dd($customers->toArray()); + $customers_keyBy_noKp = $customers->keyBy(function ($item) { + if ($item->kpbaru != '') { + return $item->kpbaru; + } else if ($item->kplama != '') { + return $item->kplama; + } + }); + + $gadai_all_groupby_nokp = $gadai_all->groupBy('nokp'); + + foreach($gadai_all as $index3=>$gadai){ + if($customers_keyBy_noKp[$gadai->nokp]){ + $gadai_all[$index3]["cust_info"] = $customers_keyBy_noKp[$gadai->nokp]; + + } + } + + foreach($customers as $index=>$customer){ + if($customer->kpbaru != ''){ + $customers[$index]['nokp'] = $customer->kpbaru; + } + elseif($customer->kplama != ''){ + $customers[$index]['nokp'] = $customer->kplama; + } + + if($gadai_all_groupby_nokp[$customer->nokp]){ + $customers[$index]['gadai'] = $gadai_all_groupby_nokp[$customer->nokp]; + } + + foreach($customer['gadai'] as $index2=>$datagadai){ + if($lelongbid_keyby_norujukan[$datagadai->norujukan]){ + // $customer['gadai'][$index2]['lelongbid'] = $lelongbid_keyby_norujukan[$datagadai->norujukan]; + $lelongbid_true = $lelongbid_keyby_norujukan[$datagadai->norujukan]; + $ktlhbyr = $datagadai->hargajualan - $datagadai->bakihargajualan; + $sumcajlelong = $lelongbid_true->hargaasas * ($lelong->cajlelong / 100); + $cajlelongnew = round($sumcajlelong, 1, 1); + $totalbaki = $lelongbid_true->hargaasas - $lelongbid_true->pinjaman - $lelongbid_true->bakiupah - $cajlelongnew; + $customer['gadai'][$index2]['bakilelong'] = number_format($totalbaki, 2, '.', ','); + $customer['gadai'][$index2]['ktlhbyr'] = number_format($ktlhbyr, 2, '.', ','); + } + } + // dd($customer); + + } + + if($request->type == 'excel') + { + + return view('excel.listnotis_excel2',compact('customers','lelong_id','caw')); + + } + elseif($request->type == 'excelbysag') + { + + return view('excel.listnotis_excelbysag2',compact('gadai_all','lelong_id','caw')); + + } + + else + { + $pdf = PDF::loadView('pdf.listnotis2',compact('customers','lelong_id','caw')) + ->setPaper('a4', 'landscape'); + + return $pdf->download('Senarai Notis.pdf'); + } + } + Public function kemaskininotis(Request $request){ @@ -482,6 +645,521 @@ 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 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'); + +// $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'); + +// // $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'); +// } + + +// 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(); + +// $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(); +// } + +// // $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($getsurat as $index1=>$surats) +// { +// $senarai = Gadai::on($details) +// ->where('norujukan', $surats['norujukan']) +// ->get(); +// // dd($surats['tempoh']); + +// $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; +// } + +// // $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; +// } + +// if($bil_surat == 0) +// { +// return redirect()->route('notisperingatan.jananotisperingatan') +// ->with('failed','Tiada surat untuk di jana'); +// } + +// //create notis +// $notis = Notis::create([ +// 'tarikh_notis' => $tarikh_notis, +// 'daritempoh' => $jbg, +// 'hinggatempoh' => $jbg2, +// 'sts_notis' => 1, +// 'fasa' => $fasa +// ]); + +// foreach($sag_cawangans as $index=>$cawnotis){ + +// $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(); + +// $suratcaw = $cawnotis['data']; + +// $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); + +// } + +// } +// 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!"); + +// } + +// 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'); + +// 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 = []; + +// 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, +// ]); + +// $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' +// )); +// } + +// public function senarainotisall() +// { + +// $arrayinfo = []; + +// $notis = Notis::select('tarikh_notis') +// ->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); + +// array_push($arrayinfo, ['info'=> $info, 'detailsinfo'=>$detailsinfo]); + +// } + +// return view('notisperingatan.senarainotisall',compact('notis','arrayinfo')); +// } + +// public function shownotisperingatanall(Request $request, $tarikhnotis) +// { +// $tarikhnotis = $tarikhnotis; +// $notis = Notis::where('tarikh_notis','=',$tarikhnotis)->first(); + +// $cawangannotis = CawanganNotis::where('created_at','like', '%'.$tarikhnotis.'%')->get(); +// // dd($cawangannotis); + +// $arraydata = []; +// $arraycaw = []; +// $data = []; + +// $total_marhun = 0; +// $total_berat = 0; +// $total_nmarhun = 0; +// $total_pinjaman = 0; +// $total_upah = 0; +// $total_bakiupah = 0; +// $total_nilaimarhun = 0; + +// foreach($cawangannotis as $cawlel) +// { +// $cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first(); +// // $databid = LelongBid::join('cawangan_lelong','cawangan_lelong.caw_id','=','lelongbid.caw_id') + +// $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(); + +// $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; + +// foreach($databid as $index1=>$bid) +// { +// $berat = $berat + $bid['berat']; +// $nilai_marhun = $nilai_marhun + $bid['nilaimarhun']; +// $pinjaman =$pinjaman + $bid['pinjaman']; +// $bakiupah = $bakiupah + $bid['bakiupah']; +// } + +// 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'], +// ]); + +// $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; + +// $data = Notis::where('tarikh_notis','=',$tarikhnotis)->first(); +// } + +// return view('notisperingatan.shownotisperingatanall',compact( +// 'arraycaw', +// 'total_marhun', +// 'total_berat', +// 'total_nmarhun', +// 'total_pinjaman', +// 'total_upah', +// 'data', +// 'tarikhnotis', +// 'total_bakiupah', +// 'total_nilaimarhun' +// )); +// } + + + + + } \ No newline at end of file diff --git a/resources/views/excel/listnotis_excel2.blade.php b/resources/views/excel/listnotis_excel2.blade.php new file mode 100644 index 00000000..8af00788 --- /dev/null +++ b/resources/views/excel/listnotis_excel2.blade.php @@ -0,0 +1,133 @@ + + + + + + + + +
+ + {{--
+
+ PKB LOGO +
--}} + +
+

{{$caw['caw_name']}}
+ {{$caw['alamat1']}}
+ {{$caw['alamat2']}}
+ No Tel: {{$caw['notel']}}
+ No Faks: {{$caw['nofaks']}} +


+
+
+
+ + + + + + + + + + + + + + + + + + + + + @foreach($customers as $customer) + + + + + + + + + + + + + + + + @endforeach + + + + + + + + \ No newline at end of file diff --git a/resources/views/excel/listnotis_excelbysag.blade.php b/resources/views/excel/listnotis_excelbysag.blade.php index 9e1d75d3..ddf61c99 100644 --- a/resources/views/excel/listnotis_excelbysag.blade.php +++ b/resources/views/excel/listnotis_excelbysag.blade.php @@ -100,7 +100,7 @@ var table2excel = new Table2Excel(); table2excel.export(document.querySelectorAll("#customers"),'senarai_notis'); - setTimeout(function(){ window.close() }, 10); + setTimeout(function(){ window.close() }, 20); }); diff --git a/resources/views/excel/listnotis_excelbysag2.blade.php b/resources/views/excel/listnotis_excelbysag2.blade.php new file mode 100644 index 00000000..4ea81f44 --- /dev/null +++ b/resources/views/excel/listnotis_excelbysag2.blade.php @@ -0,0 +1,110 @@ + + + + + + + + +
+ + {{--
+
+ PKB LOGO +
--}} + +
+

{{$caw['caw_name']}}
+ {{$caw['alamat1']}}
+ {{$caw['alamat2']}}
+ No Tel: {{$caw['notel']}}
+ No Faks: {{$caw['nofaks']}} +


+
+
+
+ + +
NoNamaNo KPNo TelefonAlamat 1Alamat 2Alamat 3No RujukanTempohPembiayaan (RM)Keuntungan 6 Bulan (RM)Bayaran Telah Dibuat (RM)Baki Lelong (simulasi) (RM)
{{$loop->iteration}}{{$customer->nama}}{{$customer->kpbaru ? $customer->kpbaru : $customer->kplama}}{{$customer->telefon ? '6'.$customer->telefon : ""}}{{$customer->alamat1}}{{$customer->alamat2}}{{$customer->alamat3}}@foreach($customer['gadai'] as $data) + {{$data->norujukan}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->tempoh}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{number_format($data->bakipjm, 2, '.', ',')}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{number_format($data->bakiupah, 2, '.', ',')}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->ktlhbyr}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->bakilelong}}
+ @endforeach +
+
+ + + + + + + + + + + + + + + @foreach($gadai_all as $customer) + + {{-- dd($customer)}} --}} + + + + + + + + + + + + + @endforeach + + + + + + + + \ No newline at end of file diff --git a/resources/views/jananotis/senarainotis2.blade.php b/resources/views/jananotis/senarainotis2.blade.php new file mode 100644 index 00000000..03f5c0ad --- /dev/null +++ b/resources/views/jananotis/senarainotis2.blade.php @@ -0,0 +1,160 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
+ + + +
+ Senarai SAG Lelongan +
+
+
+ @if ($message = Session::get('success')) +
+

{{ $message }}

+
+ @endif +
+ {{-- --}} + + @csrf + + +
+
NoNo RujukanTempohNo KPNamaNo.TelefonPembiayaan (RM)Keuntungan 6 Bulan (RM)Bayaran Telah Dibuat (RM)Baki Lelong (simulasi) (RM)
{{$loop->iteration}}{{$customer->norujukan}}{{$customer->tempoh}}{{$customer->cust_info->nokp}}{{$customer->cust_info->nama}}{{$customer->cust_info->telefon ? '6'.$customer->cust_info->telefon : ""}}{{number_format($customer->bakipjm, 2, '.', ',')}}{{number_format($customer->bakiupah, 2, '.', ',')}}{{$customer->ktlhbyr}}{{$customer->bakilelong}}
+ + + + + + + + + + + + + + + + + + + @foreach($customers as $customer) + + + + + + + + + + + + + + + @endforeach + +
NoNo KPNo TelefonAlamat 1Alamat 2Alamat 3No RujukanTempohPembiayaan (RM)Keuntungan 6 Bulan (RM)Bayaran Telah Dibuat (RM)Baki Lelong (simulasi) (RM)
{{$loop->iteration}}{{$customer->kpbaru ? $customer->kpbaru : $customer->kplama}}{{$customer->telefon}}{{$customer->alamat1}}{{$customer->alamat2}}{{$customer->alamat3}}@foreach($customer['gadai'] as $data) + {{$data->norujukan}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->tempoh}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{number_format($data->bakipjm, 2, '.', ',')}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{number_format($data->bakiupah, 2, '.', ',')}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->ktlhbyr}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->bakilelong}}
+ @endforeach +
+
+
+ {{-- --}} + + + + + +@endsection diff --git a/resources/views/pdf/listnotis2.blade.php b/resources/views/pdf/listnotis2.blade.php new file mode 100644 index 00000000..5f1144e0 --- /dev/null +++ b/resources/views/pdf/listnotis2.blade.php @@ -0,0 +1,224 @@ + + + + + +{{-- +
+ +
+
{{$caw['caw_name']}}
+ {{$caw['alamat1']}}
+ {{$caw['alamat2']}}
+ No Tel: {{$caw['notel']}}
+ No Faks: {{$caw['nofaks']}} +
+
+
--}} + +
+
SENARAI LELONGAN MENGIKUT PELANGGAN
+
+ +
Batch Lelong: {{ $lelong_id }}
+ + + + + + + + + + + + + + + + + + + + + @foreach($customers as $customer) + + + + + + + + + + + + + + + @endforeach +
NoNo KpNo TelefonAlamat 1Alamat 2Alamat 3No RujukanJGBPembiayaan (RM)Keuntungan 6 Bulan (RM)Bayaran Telah Dibuat (RM)Baki Lelong (simulasi) (RM)
{{$loop->iteration}}{{$customer->kpbaru ? $customer->kpbaru : $customer->kplama}}{{$customer->telefon}}{{$customer->alamat1}}{{$customer->alamat2}}{{$customer->alamat3}}@foreach($customer['gadai'] as $data) + {{$data->norujukan}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->tempoh}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{number_format($data->bakipjm, 2, '.', ',')}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{number_format($data->bakiupah, 2, '.', ',')}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->ktlhbyr}}
+ @endforeach +
@foreach($customer['gadai'] as $data) + {{$data->bakilelong}}
+ @endforeach +
+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index d15b5214..4ad1c37f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -477,9 +477,9 @@ Route::group(['middleware' => ['permission:jananotis'],'prefix'=>'jananotis'], f Route::get('/pembida',['as'=>'jananotis.pembida','uses'=>'NotisController@pembida']); - Route::get('/senarainotis/{lelong_id}',['as'=>'jananotis.senarainotis','uses'=>'NotisController@senarainotis']); + Route::get('/senarainotis/{lelong_id}',['as'=>'jananotis.senarainotis','uses'=>'NotisController@senarainotis2']); Route::get('/jananotis/{lelong_id}',['as'=>'jananotis.jananotis','uses'=>'NotisController@jananotis2']); - Route::post('/listnotis',['as'=>'jananotis.listnotis','uses'=>'NotisController@listnotis']); + Route::post('/listnotis',['as'=>'jananotis.listnotis','uses'=>'NotisController@listnotis2']); Route::get('/send-email',['as'=>'jananotis.email','uses'=>'MailController@sendEmail']); Route::get('/kemaskininotis',['as'=>'jananotis.kemaskininotis','uses'=>'NotisController@kemaskininotis']); @@ -645,9 +645,9 @@ Route::group(['middleware' => ['permission:notisperingatan'], 'prefix' => 'notis Route::get('/senarainotisall',['as'=>'notisperingatan.senarainotisall','uses'=>'NotisController@senarainotisall']); Route::get('/shownotisperingatanall/{tarikhnotis}',['as'=>'notisperingatan.shownotisperingatanall','uses'=>'NotisController@shownotisperingatanall']); - // Route::get('/notisfasa1', ['as' => 'notisperingatan.notisfasa1', 'uses' => 'NotisController@notisfasa1']); - // 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('/notisfasa1', ['as' => 'notisperingatan.notisfasa1', 'uses' => 'NotisController@notisfasa1']); + 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('/sms', [SmsController::class, 'index']); \ No newline at end of file