Merge branch 'atie' into 'main'

update excel excel by sag dan pdf senarai notis lelong

See merge request online-sistem1/lelong!431
This commit is contained in:
Nur Izzati Zulkifli
2023-04-03 07:55:50 +00:00
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'
// ));
// }
}
@@ -0,0 +1,133 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="{{ asset('js/table2excel.js') }}"></script>
<style>
.letter{
font-family:'Times New Roman', Times, serif;
}
.row::after {
content: "";
clear: both;
display: table;
}
.first-prgph{
float: left;
width: 10%;
padding: 2px;
}
.first-prgph1{
float: left;
width: 30%;
padding-left: 50px;
}
.page-break {
page-break-before: always;
}
.name{
padding-top: 40px;
}
</style>
<body>
<div class = "letter">
{{-- <div class="row">
<div class="first-prgph">
<img src="{{ asset('img/icon_pkb.png') }}" alt="PKB LOGO" width="100" height="100">
</div> --}}
<div class="first-prgph1">
<p> {{$caw['caw_name']}}<br>
{{$caw['alamat1']}}<br>
{{$caw['alamat2']}}<br>
No Tel: {{$caw['notel']}}<br>
No Faks: {{$caw['nofaks']}}
</p><br>
</div>
<br>
</div>
<table width="100%" height="168" id="customers">
<thead>
<tr>
<th align="left">No</th>
<th align="left">Nama</th>
<th align="left">No KP</th>
<th align="left">No Telefon</th>
<th align="left">Alamat 1</th>
<th align="left">Alamat 2</th>
<th align="left">Alamat 3</th>
<th align="left">No Rujukan</th>
<th>Tempoh</th>
<th>Pembiayaan (RM)</th>
<th>Keuntungan 6 Bulan (RM)</th>
<th>Bayaran Telah Dibuat (RM)</th>
<th>Baki Lelong (simulasi) (RM)</th>
</tr>
</thead>
@foreach($customers as $customer)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$customer->nama}}</td>
<td>{{$customer->kpbaru ? $customer->kpbaru : $customer->kplama}}</td>
<td>{{$customer->telefon ? '6'.$customer->telefon : ""}}</td>
<td>{{$customer->alamat1}}</td>
<td>{{$customer->alamat2}}</td>
<td>{{$customer->alamat3}}</td>
<td style="white-space: nowrap;">@foreach($customer['gadai'] as $data)
{{$data->norujukan}}<br>
@endforeach
</td>
<td>@foreach($customer['gadai'] as $data)
{{$data->tempoh}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{number_format($data->bakipjm, 2, '.', ',')}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{number_format($data->bakiupah, 2, '.', ',')}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{$data->ktlhbyr}}<br>
@endforeach
</td>
<td align = "right"><b>@foreach($customer['gadai'] as $data)
{{$data->bakilelong}}<br>
@endforeach
</b>
</td>
</tr>
@endforeach
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
var table2excel = new Table2Excel();
table2excel.export(document.querySelectorAll("#customers"),'senarai_notis');
setTimeout(function(){ window.close() }, 10);
});
</script>
@@ -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);
});
@@ -0,0 +1,110 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="{{ asset('js/table2excel.js') }}"></script>
<style>
.letter{
font-family:'Times New Roman', Times, serif;
}
.row::after {
content: "";
clear: both;
display: table;
}
.first-prgph{
float: left;
width: 10%;
padding: 2px;
}
.first-prgph1{
float: left;
width: 30%;
padding-left: 50px;
}
.page-break {
page-break-before: always;
}
.name{
padding-top: 40px;
}
</style>
<body>
<div class = "letter">
{{-- <div class="row">
<div class="first-prgph">
<img src="{{ asset('img/icon_pkb.png') }}" alt="PKB LOGO" width="100" height="100">
</div> --}}
<div class="first-prgph1">
<p> {{$caw['caw_name']}}<br>
{{$caw['alamat1']}}<br>
{{$caw['alamat2']}}<br>
No Tel: {{$caw['notel']}}<br>
No Faks: {{$caw['nofaks']}}
</p><br>
</div>
<br>
</div>
<table width="100%" height="168" id="customers">
<thead>
<tr>
<th align="left">No</th>
<th align="left">No Rujukan</th>
<th align="left">Tempoh</th>
<th align="left">No KP</th>
<th align="left">Nama</th>
<th align="left">No.Telefon</th>
<th align="right">Pembiayaan (RM)</th>
<th align="right">Keuntungan 6 Bulan (RM)</th>
<th align="right">Bayaran Telah Dibuat (RM)</th>
<th align="right">Baki Lelong (simulasi) (RM)</th>
</tr>
</thead>
@foreach($gadai_all as $customer)
<tr>
{{-- dd($customer)}} --}}
<td >{{$loop->iteration}}</td>
<td>{{$customer->norujukan}}</td>
<td>{{$customer->tempoh}}</td>
<td>{{$customer->cust_info->nokp}}</td>
<td>{{$customer->cust_info->nama}}</td>
<td>{{$customer->cust_info->telefon ? '6'.$customer->cust_info->telefon : ""}}</td>
<td align="right">{{number_format($customer->bakipjm, 2, '.', ',')}}</td>
<td align="right">{{number_format($customer->bakiupah, 2, '.', ',')}}</td>
<td align="right">{{$customer->ktlhbyr}}</td>
<td align="right">{{$customer->bakilelong}}</td>
</tr>
@endforeach
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
var table2excel = new Table2Excel();
table2excel.export(document.querySelectorAll("#customers"),'senarai_notis');
setTimeout(function(){ window.close() }, 20);
});
</script>
@@ -0,0 +1,160 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card">
<div class="card-header header-style">
<a href="{{ route('jananotis.notislelong') }}" class="header-style-icon">
<i class="fas fa-arrow-left"></i>
</a>
<div class="header-style-title">
Senarai SAG Lelongan
</div>
</div>
<div class="card-body">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<form id="exportpdf" action="{{route('jananotis.listnotis')}}" method="POST">
{{-- <form id="exportexcel" action="{{route('jananotis.listnotis_excel')}}" method="POST"> --}}
@csrf
<input type="hidden" name="type" id="typedonwload" value="">
<input type="hidden" name="lelong_id" value="{{ $lelong_id}}">
<div style = "overflow-x:auto">
<table class="table table-bordered"" id="notis" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th align="left">No KP</th>
<th align="left">No Telefon</th>
<th align="left">Alamat 1</th>
<th align="left">Alamat 2</th>
<th align="left">Alamat 3</th>
<th align="left">No Rujukan</th>
<th>Tempoh</th>
<th>Pembiayaan (RM)</th>
<th>Keuntungan 6 Bulan (RM)</th>
<th>Bayaran Telah Dibuat (RM)</th>
<th>Baki Lelong (simulasi) (RM)</th>
</tr>
</thead>
<tbody>
@foreach($customers as $customer)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$customer->kpbaru ? $customer->kpbaru : $customer->kplama}}</td>
<td>{{$customer->telefon}}</td>
<td>{{$customer->alamat1}}</td>
<td>{{$customer->alamat2}}</td>
<td>{{$customer->alamat3}}</td>
<td style="white-space: nowrap;">@foreach($customer['gadai'] as $data)
{{$data->norujukan}}<br>
@endforeach
</td>
<td>@foreach($customer['gadai'] as $data)
{{$data->tempoh}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{number_format($data->bakipjm, 2, '.', ',')}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{number_format($data->bakiupah, 2, '.', ',')}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{$data->ktlhbyr}}<br>
@endforeach
</td>
<td align="right"><b>@foreach($customer['gadai'] as $data)
{{$data->bakilelong}}<br>
@endforeach
</b>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
{{-- <div class="modal-footer" style="margin-top:2%;">
<a href="{{ route('jananotis.notislelong') }}" class="btn btn-primary">Kembali</a>
</div> --}}
</div>
</div>
</div>
<script>
var tablelelongbid= $('#notis').DataTable( {
"columnDefs": [
{
"targets": 0,
"target": '_blank',
"orderable": false
},
{
"targets": 5,
"orderable": false
}
],
// order: [[1, 'asc']],
// // "ordering": false,
"info": false,
"lengthChange": false,
"pageLength": 9999999,
"bPaginate": false,
dom: 'Bfrtip',
buttons: [
{
className: 'btn btn-outline-success pl-4 pr-4 btn-sm export',
target: "_blank",
titleAttr: 'Export to Excel',
text: '<h8><b>EXCEL</b></h8>',
action: function ( e, dt, node, config ) {
$('#typedonwload').val('excel');
$("#exportpdf").submit();
// window.open("_blank");
}
},
{
className: 'btn btn-outline-info pl-4 pr-4 btn-sm export',
target: "_blank",
titleAttr: 'Export to Excel by SAG',
text: '<h8><b>EXCEL By SAG</b></h8>',
action: function ( e, dt, node, config ) {
$('#typedonwload').val('excelbysag');
$("#exportpdf").submit();
// window.open("_blank");
}
},
{
className: 'btn btn-outline-danger pl-4 pr-4 btn-sm export',
titleAttr: 'Export to PDF',
text: '<h8><b>PDF</b></h8>',
action: function ( e, dt, node, config ) {
$('#typedonwload').val('pdf');
$("#exportpdf").submit();
}
}
]
});
$('.export').tooltip();
$( '.export').removeClass('dt-button');
</script>
@endsection
+224
View File
@@ -0,0 +1,224 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style>
#sim {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:10px;
border-collapse: collapse;
width: 100%;
}
#sim td {padding:3px 5px 3px 5px; padding-right:10px;}, #sim th {
border: 0px solid;
padding: 1px;
text-align: left;
}
#sim tr:nth-child(even){}
#sim tr {
border-bottom: 1px black;
}
#sim th {
border: 1px black;
text-align: center;
}
#sim2 th {
text-align: center;
border: 0px solid ;
table-layout:auto;
color: black;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
.row {
margin-right:-5px;
margin-right:-5px;
}
.column {
float: right;
width: 100%;
padding: 5px;
}
/* Clearfix (clear floats) */
.row::after {
content: "";
clear: both;
display: table;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 200%;
border: 0px solid #ddd;
}
td {
/* text-align: right; */
padding: 16px;
border: 1px solid;
}
th{
text-align: center;
padding: 16px;
}
tr:nth-child(even) {
}
.font{
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:12px;
}
</style>
<style>
/** Define now the real margins of every page in the PDF **/
body {
margin-top: 1cm;
/* margin-left: 2cm; */
/* margin-right: 2cm; */
margin-bottom: 2cm;
}
/** Define the header rules **/
header {
position: fixed;
top: -1cm;
left: 0cm;
right: 0cm;
height: 0cm;
/** Extra personal styles **/
/* background-color: #eaeaea; */
color: black;
text-align: center;
line-height: 1.5cm;
}
/** Define the footer rules **/
footer {
position: fixed;
bottom: 0cm;
left: 0cm;
right: 0cm;
height: 2cm;
/** Extra personal styles **/
/* background-color: #eaeaea; */
color: black;
text-align: center;
line-height: 1.5cm;
}
footer .pagenum:before {
content: counter(page);
}
.font{
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:12px;
}
</style>
{{--
<div>
<div class="first-prgph1">
<h5> {{$caw['caw_name']}}<br>
{{$caw['alamat1']}}<br>
{{$caw['alamat2']}}<br>
No Tel: {{$caw['notel']}}<br>
No Faks: {{$caw['nofaks']}}
</h5>
</div>
</div>--}}
<body>
<header>
<div class="font"><u><b><h5>SENARAI LELONGAN MENGIKUT PELANGGAN</h5></b></u></div>
</header>
<footer>
<div class="pagenum-container"><span class="pagenum"></span></div>
</footer>
<div class="font">Batch Lelong: {{ $lelong_id }} </div>
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
<thead>
<tr>
<th>No</th>
<th align="left">No Kp</th>
<th align="left">No Telefon</th>
<th align="left">Alamat 1</th>
<th align="left">Alamat 2</th>
<th align="left">Alamat 3</th>
<th align="left">No Rujukan</th>
<th>JGB</th>
<th>Pembiayaan (RM)</th>
<th>Keuntungan 6 Bulan (RM)</th>
<th>Bayaran Telah Dibuat (RM)</th>
<th>Baki Lelong (simulasi) (RM)</th>
</tr>
</thead>
@foreach($customers as $customer)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$customer->kpbaru ? $customer->kpbaru : $customer->kplama}}</td>
<td>{{$customer->telefon}}</td>
<td>{{$customer->alamat1}}</td>
<td>{{$customer->alamat2}}</td>
<td>{{$customer->alamat3}}</td>
<td style="white-space: nowrap;">@foreach($customer['gadai'] as $data)
{{$data->norujukan}}<br>
@endforeach
</td>
<td>@foreach($customer['gadai'] as $data)
{{$data->tempoh}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{number_format($data->bakipjm, 2, '.', ',')}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{number_format($data->bakiupah, 2, '.', ',')}}<br>
@endforeach
</td>
<td align = "right">@foreach($customer['gadai'] as $data)
{{$data->ktlhbyr}}<br>
@endforeach
</td>
<td align = "right"><b>@foreach($customer['gadai'] as $data)
{{$data->bakilelong}}<br>
@endforeach
</b>
</td>
</tr>
@endforeach
</table>
</div>
</tbody>
</table>
</body>
+6 -6
View File
@@ -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']);