From 457df3f35c5561bc66a9ccfe84a91053515964d1 Mon Sep 17 00:00:00 2001 From: nishaMuhd Date: Mon, 15 Jan 2024 13:29:55 +0800 Subject: [PATCH] function cetak notis jbg --- app/Http/Controllers/CallCenterController.php | 26 +- .../callcenter/bycawdetailnotisjbg2.blade.php | 22 +- .../pdfbycawdetailnotisjbg2.blade.php | 400 ++++++++++++++++++ routes/web.php | 2 +- 4 files changed, 437 insertions(+), 13 deletions(-) create mode 100644 resources/views/callcenter/pdfbycawdetailnotisjbg2.blade.php diff --git a/app/Http/Controllers/CallCenterController.php b/app/Http/Controllers/CallCenterController.php index 012be90..0d0126c 100644 --- a/app/Http/Controllers/CallCenterController.php +++ b/app/Http/Controllers/CallCenterController.php @@ -793,9 +793,33 @@ class CallCenterController extends Controller $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $kodcaw)->json(); $bysagnotisjbg = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/arcc/bysagnotisjbg2/'.$kodcaw.'/'.$notisid.'/'.$nokp)->json(); $bysagnotisjbgCustomer = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/arcc/bysagnotisjbgcustomer2/'.$kodcaw.'/'.$notisid.'/'.$nokp)->json(); - // dd($bysagnotisjbg); return view('callcenter.callnotisjbg2',compact('cawangan_info','bysagnotisjbg','bysagnotisjbgCustomer','kodcaw','notisid','nokp','api_url')); } + public function printnotiscall($kodcaw,$notisid,Request $request) + { + $current = Carbon::now(); + $current = new Carbon(); + $tarikh_cetak = $current->toDateString(); + $auth_user = Auth::user(); + $api_url = config('api.url'); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $kodcaw)->json(); + $bycawnotisjbg = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/bycawnotisjbg2/'.$kodcaw.'/'.$notisid)->json(); + + if($request->type == 'pdflist') + { + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $kodcaw)->json(); + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$kodcaw)->json(); + $cawangan_detail=$cawangan[0]; + $bycawnotisjbg = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/bycawnotisjbg2/'.$kodcaw.'/'.$notisid)->json(); + return view('callcenter.pdfbycawdetailnotisjbg2', compact('cawangan_info','bycawnotisjbg','kodcaw','notisid','cawangan_detail','tarikh_cetak')); + + //baru + $pdf=PDF::loadView('callcenter.pdfbycawdetailnotisjbg2', compact('cawangan_info','bycawnotisjbg','kodcaw','notisid','cawangan_detail','tarikh_cetak'))->setPaper('A4','landscape'); + return $pdf->download('senarai notis jbg_'.$tarikh_cetak.''.$kodcaw.'.pdf'); + + } + return view('callcenter.bycawdetailnotisjbg2',compact('cawangan_info','bycawnotisjbg','kodcaw','notisid','api_url')); + } } diff --git a/resources/views/callcenter/bycawdetailnotisjbg2.blade.php b/resources/views/callcenter/bycawdetailnotisjbg2.blade.php index 3422817..1843f7d 100644 --- a/resources/views/callcenter/bycawdetailnotisjbg2.blade.php +++ b/resources/views/callcenter/bycawdetailnotisjbg2.blade.php @@ -122,8 +122,8 @@ @endif
- -
+ + @csrf @@ -288,16 +288,16 @@ // // window.open("_blank"); // } // }, - // { - // className: 'btn btn-outline-danger pl-4 pr-4 btn-sm export', - // titleAttr: 'Export to PDF', - // text: 'PDF', - // action: function ( e, dt, node, config ) { - // $('#typedonwload').val('pdf'); - // $("#exportpdf").submit(); - // } + { + className: 'btn btn-outline-danger pl-4 pr-4 btn-sm export', + titleAttr: 'Cetak Senarai', + text: 'Cetak Senarai', + action: function ( e, dt, node, config ) { + $('#typedonwload').val('pdflist'); + $("#exportpdf").submit(); + } - // }, + } // { // className: 'btn btn-outline-info pl-4 pr-4 btn-sm export', // target: "_blank", diff --git a/resources/views/callcenter/pdfbycawdetailnotisjbg2.blade.php b/resources/views/callcenter/pdfbycawdetailnotisjbg2.blade.php new file mode 100644 index 0000000..339e74f --- /dev/null +++ b/resources/views/callcenter/pdfbycawdetailnotisjbg2.blade.php @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
Senarai Notis JBG (Panggilan) Tarikh Cetak: + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak); + $formattedweddingdate = $myDateTime->format('d-m-Y'); + echo($formattedweddingdate) + @endphp +
+ + + + + + + + + + + + + + + + + + + + + + + + @php + $counter = 1; + $totalpinjaman = 0; + @endphp + + @foreach ($bycawnotisjbg['rekod'] as $index => $item) + @php + $totalpinjaman += $item['listsag'][0]['pinjaman']; + + if ($item['listnotis'][0]['statuscall'] == 0) { + $status = 'Belum Hubungi'; + } elseif ($item['listnotis'][0]['statuscall'] == 1) { + $status = 'Berjaya Hubungi'; + } else { + $status = 'Tidak Dapat Hubungi'; + } + + $nota = $item['listnotis'][0]['remark1']; + $caller = $item['listnotis'][0]['caller']; + @endphp + + + + + @php + $nokp = $item['info']['kpbaru'] ?? $item['info']['kplama']; + @endphp + + + + + + + + + + + + + + + + @php $counter++; @endphp + @endforeach +
BilStatusNamaNo. KPNo. TelefonNorujukanTempohBaki Pembiayaan (RM)Keuntungan 6Bulan (RM)Amaun Telah Bayar (RM)Keuntungan Semasa (RM)Tarikh MatangTarikh Tamat KontrakTarikh PanggilanPemanggilNota
{{ $loop->iteration }}{{ $status ?? '-' }}{{ $item['info']['nama'] ?? '-' }}{{ $nokp }}{{ $item['info']['telefon'] ?? '-' }}@foreach($item['listsag'] as $item1){{ $item1['norujukan']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['jbg']}}
@endforeach
@foreach($item['listsag'] as $item1){{number_format($item1['bakipjm'], 2, '.', ',')}}
@endforeach
@foreach($item['listsag'] as $item1){{number_format($item1['bakiupah'], 2, '.', ',')}}
@endforeach
@foreach($item['listsag'] as $item1){{number_format($item1['hargajualan']-$item1['bakihargajualan'], 2, '.', ',')}}
@endforeach
@foreach($item['listsag'] as $item1){{number_format($item1['keuntungan'], 2, '.', ',')}}
@endforeach
@foreach($item['listsag'] as $item1) + @if($item1['t_matang'] == null) + + @else + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $item1['t_matang']); + $formattedtmatang = $myDateTime->format('d-m-Y'); + echo($formattedtmatang); + @endphp + @endif +
+ @endforeach +
+
@foreach($item['listsag'] as $item1) + @if($item1['t_matang1'] == null) + + @else + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $item1['t_matang1']); + $formattedtmatang1 = $myDateTime->format('d-m-Y'); + echo($formattedtmatang1); + @endphp + @endif +
+ @endforeach +
+
@foreach($item['listnotis'] as $item1) + @if($item1['tarikhcall1'] == null) + + @else + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $item1['tarikhcall1']); + $formattedweddingdate = $myDateTime->format('d-m-Y'); + echo($formattedweddingdate); + @endphp + @endif +
+ @endforeach +
+
{{ $caller ?? ' ' }}{{ $nota ?? ' ' }}
+ + + + + + + + diff --git a/routes/web.php b/routes/web.php index 0882f4e..7d211e8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -449,7 +449,7 @@ Route::get('/bycawnotisjbg/{kodcaw}/{notisid}',['as'=>'arcc.bycawnotisjbg','uses Route::get('/detsagcallbyjbg/{kodcaw}/{notisid}/{id}',['as'=>'arcc.detsagcallbyjbg','uses'=>'CallCenterController@detsagcallbyjbg'])->middleware('auth','callcenter'); Route::get('/bycawnotisjbg2/{kodcaw}/{notisid}',['as'=>'arcc.bycawnotisjbg2','uses'=>'CallCenterController@bycawnotisjbg2'])->middleware('auth','callcenter'); Route::get('/detsagcallbyjbg2/{kodcaw}/{notisid}/{nokp}',['as'=>'arcc.detsagcallbyjbg2','uses'=>'CallCenterController@detsagcallbyjbg2'])->middleware('auth','callcenter'); - +Route::post('/printnotiscall/{kodcaw}/{notisid}',['as'=>'arcc.printnotiscall','uses'=>'CallCenterController@printnotiscall'])->middleware('auth','callcenter'); Route::get('supports/driver/mykad-reader',['as'=>'mykadreader.driver', function(){ return view('supports.driver.mykad-reader.download');