update excel excel by sag dan pdf senarai notis lelong

This commit is contained in:
Nur Izzati Zulkifli
2023-04-03 15:52:47 +08:00
parent 43d6ba991f
commit 9dc9d370e4
7 changed files with 1313 additions and 8 deletions
+679 -1
View File
@@ -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'
// ));
// }
}