From c54f0b21b5b8850e875af99a0bdde2dbcf80e56e Mon Sep 17 00:00:00 2001 From: BTMS1 Date: Mon, 20 Nov 2023 08:50:06 +0800 Subject: [PATCH] tambah function stok audit excel pdf dan job blast wasap --- app/Http/Controllers/KhazanahController.php | 98 ++++ .../views/excel/excel_stokauditkhas.blade.php | 346 ++++++++++++++ .../views/khazanah/laporan/index.blade.php | 3 + .../khazanah/laporan/stokauditkhas.blade.php | 151 ++++++ .../views/pdf/pdf_stokauditkhas.blade.php | 350 ++++++++++++++ .../print/laporan_stokauditkhas.blade.php | 434 ++++++++++++++++++ routes/web.php | 5 + 7 files changed, 1387 insertions(+) create mode 100644 resources/views/excel/excel_stokauditkhas.blade.php create mode 100644 resources/views/khazanah/laporan/stokauditkhas.blade.php create mode 100644 resources/views/pdf/pdf_stokauditkhas.blade.php create mode 100644 resources/views/print/laporan_stokauditkhas.blade.php diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 13638e4..6011318 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -4176,4 +4176,102 @@ class KhazanahController extends Controller return view('print.laporan_imbangduga-akru',compact('tarikh_imbangan', 'tarikh_imbangan2','hartasemasa','tanggungansemasa','totalhartasemasa','totaltanggungansemasa','tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail')); } + public function laporanStokAuditKhas(){ + $auth_user = Auth::user(); + $api_url = config('api.url'); + + + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/gadai/cawangan/'. $auth_user['cawangan'])->json(); + + return view('khazanah.laporan.stokauditkhas',compact('cawangan_info','api_url')); + } + + public function cetakLaporanStokAuditKhas(Request $request){ + $api_url = config('api.url'); + $auth_user = Auth::user(); + $current = Carbon::now(); + $current = new Carbon(); + $tarikh_cetak = $current->toDateString(); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + // if($request->datetimepicker1 == null){ + // $tebus_date = $current->toDateString(); + // }else{ + // $split_date = explode('-',$request->datetimepicker1); + // $tebus_date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0]; + // } + + $cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); + $cawangan_detail=$cawangan[0]; + + if($request->radaktif === 'aktif') + { + $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + // dd($stokaudit); + return view('print.laporan_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + } + // else{ + // $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/takaktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + // return view('print.laporan_stokauditkhasbelumaktif', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url')); + // } + + + // dd($gadai); + } + + public function cetakExportLaporanStokAuditKhas(Request $request){ + // dd($request->all()); + $api_url = config('api.url'); + $auth_user = Auth::user(); + $current = Carbon::now(); + $current = new Carbon(); + $tarikh_cetak = $current->toDateString(); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + + $cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); + $cawangan_detail=$cawangan[0]; + + $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + + if($request->type == 'excel') + { + return view('excel.excel_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + } + elseif($request->type == 'whatsapp') + { + + $blastwhatsapp = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/blastwasap/'.$auth_user['cawangan'], + ['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh, 'namapengguna' => $auth_user['name'],])->json(); + // dd($blastwhatsapp); + if($blastwhatsapp == 'success'){ + return redirect()->route('laporan.stokauditkhas') + ->with('success','Blast Whatsapp Dalam Proses.'); + } + elseif($blastwhatsapp == 'failed'){ + return redirect()->route('laporan.stokauditkhas') + ->with('failed','Blast Whatsapp Tidak Berjaya, Sila Semak Semula Rekod Blasted.'); + } + + // return view('excel.excel_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + } + else + { + $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + return view('pdf.pdf_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + + // $pdf = PDF::loadView('pdf.pdf_stokauditkhas',compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')) + // ->setPaper('a4', 'potrait'); + + // return $pdf->download('Stok Audit Khas.pdf'); + + } + + + // dd($gadai); + } + } diff --git a/resources/views/excel/excel_stokauditkhas.blade.php b/resources/views/excel/excel_stokauditkhas.blade.php new file mode 100644 index 0000000..8b048df --- /dev/null +++ b/resources/views/excel/excel_stokauditkhas.blade.php @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
Laporan Stok Audit 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 + {{-- {{dd($stokaudit['rekod'])}} --}} + @foreach ($stokaudit['rekod'] as $index => $item) + @php + if ($item['listsag'][0]['hargajualan'] == null) { + $totalpinjaman += $item['listsag'][0]['pinjaman']; + } else { + $totalpinjaman += $item['listsag'][0]['bakipjm']; + } + @endphp + + + + + + + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + + @php $counter++; @endphp + @endforeach + + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + +
BilNamaNo. KPNo. TelefonNorujukanTempohBeratNilai Marhun (RM)Pembiayaan Asal (RM)Baki Pembiayaan (RM)Kadar UpahTempoh Belum BayarKeuntungan Belum Bayar (RM)Lanjutan
{{ $counter }}{{ $item['info']['nama'] ?? '-' }}'{{ $item['nokp'] }}6{{ $item['info']['telefon'] ?? '' }}@foreach($item['listsag'] as $item1){{ $item1['norujukan']}},
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['tempoh']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['berat']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['nilaimarhun']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['pinjaman']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['bakipjm']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['kadarupah']}}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['tempoh'] - $item1['tempohbayar'], 2) }}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['tunggakan'], 2) }}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['lelong_tawarruq']}}
@endforeach
Jumlah{{ number_format($stokaudit['totalberat'], 2) }}{{ number_format($stokaudit['totalnilaimarhun'], 2) }}{{ number_format($stokaudit['totalpinjaman'], 2) }}{{ number_format($stokaudit['totalbakipjm'], 2) }}{{ number_format($stokaudit['totaltunggakan'], 2) }}
+ + + + + + + + diff --git a/resources/views/khazanah/laporan/index.blade.php b/resources/views/khazanah/laporan/index.blade.php index 5f124b3..b24cf1c 100644 --- a/resources/views/khazanah/laporan/index.blade.php +++ b/resources/views/khazanah/laporan/index.blade.php @@ -82,6 +82,9 @@
Serah Marhun Tebus
+
+ SA(Blast Wasap) +
diff --git a/resources/views/khazanah/laporan/stokauditkhas.blade.php b/resources/views/khazanah/laporan/stokauditkhas.blade.php new file mode 100644 index 0000000..fda0e8f --- /dev/null +++ b/resources/views/khazanah/laporan/stokauditkhas.blade.php @@ -0,0 +1,151 @@ +@extends('layouts.app') + + +@section('content') +
+
+
+
+ + +
+
+
+
+
+
+
+ @if ($message = Session::get('success')) +
+

{{ $message }}

+
+ @elseif ($message = Session::get('failed')) +
+

{{ $message }}

+
+ @endif + +
+
+
+
+ @csrf +
+
+ Dari Tempoh +
+ +
+ +
+
+
+
+ Hingga Tempoh +
+ + +
+
+ +
+

+
+
+ + {{-- --}} +
+ +
+ +
+ +
+
+
+
+
+ +@endsection + diff --git a/resources/views/pdf/pdf_stokauditkhas.blade.php b/resources/views/pdf/pdf_stokauditkhas.blade.php new file mode 100644 index 0000000..1284c53 --- /dev/null +++ b/resources/views/pdf/pdf_stokauditkhas.blade.php @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
Laporan Stok Audit 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 + {{-- {{dd($stokaudit['rekod'])}} --}} + @foreach ($stokaudit['rekod'] as $index => $item) + @php + if ($item['listsag'][0]['hargajualan'] == null) { + $totalpinjaman += $item['listsag'][0]['pinjaman']; + } else { + $totalpinjaman += $item['listsag'][0]['bakipjm']; + } + @endphp + + + + + + + + + + + + {{-- --}} + {{-- --}} + + {{-- --}} + + @php $counter++; @endphp + @endforeach + + + + + + + {{-- + --}} + + {{-- --}} + +
BilNamaNo. KPNo. TelefonNorujukanTempohBeratNilai Marhun (RM)Pembiayaan Asal (RM)Baki Pembiayaan (RM)Kadar UpahTempoh Belum BayarKeuntungan Belum Bayar (RM)Lanjutan
{{ $counter }}{{ $item['info']['nama'] ?? '-' }}{{ $item['nokp'] }}{{ $item['info']['telefon'] ?? '-' }}@foreach($item['listsag'] as $item1){{ $item1['norujukan']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['tempoh']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['berat']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['nilaimarhun']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['pinjaman']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['bakipjm']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['kadarupah']}}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['tempoh'] - $item1['tempohbayar'], 2) }}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['tunggakan'], 2) }}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['lelong_tawarruq']}}
@endforeach
Jumlah{{ number_format($stokaudit['totalberat'], 2) }}{{ number_format($stokaudit['totalnilaimarhun'], 2) }}{{ number_format($stokaudit['totalpinjaman'], 2) }}{{ number_format($stokaudit['totalbakipjm'], 2) }}{{ number_format($stokaudit['totaltunggakan'], 2) }}
+ + + + + + + + diff --git a/resources/views/print/laporan_stokauditkhas.blade.php b/resources/views/print/laporan_stokauditkhas.blade.php new file mode 100644 index 0000000..f8c389d --- /dev/null +++ b/resources/views/print/laporan_stokauditkhas.blade.php @@ -0,0 +1,434 @@ +@extends('layouts.app') + + + + + + + + + + + + + + + + + + + + + +@section('content') +
+
+
+
+ + + +
+ +
+ @csrf + + + + + + + + + + + + + + + + +
Laporan Stok Audit Khas (Blast Whatsapp) Tarikh Cetak: + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak); + $formattedweddingdate = $myDateTime->format('d-m-Y'); + echo $formattedweddingdate; + @endphp +
Dari Tempoh: {{$daritempoh}} hingga Tempoh: {{$hinggatempoh}}
+ +
+ + + + + + + + + + + + + + {{-- --}} + {{-- --}} + + {{-- --}} + + @php + $counter = 1; + $totalpinjaman = 0; + @endphp + + @foreach ($stokaudit['rekod'] as $index => $item) + @php + if ($item['listsag'][0]['hargajualan'] == null) { + $totalpinjaman += $item['listsag'][0]['pinjaman']; + } else { + $totalpinjaman += $item['listsag'][0]['bakipjm']; + } + + if ($item['blasted'] == null) { + $status = 'Belum'; + } else { + $status = 'Selesai'; + } + @endphp + + + + + + + + + + + + + + {{-- --}} + {{-- --}} + + {{-- --}} + + @php $counter++; @endphp + @endforeach + + + + + + + {{-- + --}} + + {{-- --}} + +
BilStatusNamaNo. KPNo. TelefonNorujukanTempohBeratNilai Marhun (RM)Pembiayaan Asal (RM)Baki Pembiayaan (RM)Kadar UpahTempoh Belum BayarKeuntungan Belum Bayar (RM)Lanjutan
{{ $counter }}{{ $status ?? '-' }}{{ $item['info']['nama'] ?? '-' }}{{ $item['nokp'] }}{{ $item['info']['telefon'] ?? '-' }}@foreach($item['listsag'] as $item1){{ $item1['norujukan']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['tempoh']}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['berat']}}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['nilaimarhun'], 2)}}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['pinjaman'], 2)}}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['bakipjm'], 2)}}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['kadarupah']}}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['tempoh'] - $item1['tempohbayar'], 2) }}
@endforeach
@foreach($item['listsag'] as $item1){{ number_format($item1['tunggakan'], 2) }}
@endforeach
@foreach($item['listsag'] as $item1){{ $item1['lelong_tawarruq']}}
@endforeach
Jumlah{{ number_format($stokaudit['totalberat'], 2) }}{{ number_format($stokaudit['totalnilaimarhun'], 2) }}{{ number_format($stokaudit['totalpinjaman'], 2) }}{{ number_format($stokaudit['totalbakipjm'], 2) }}{{ number_format($stokaudit['totaltunggakan'], 2) }}
+ +
+
+{{-- + + + + + + + + + + + + + + +
.................................................................. ..................................................................
DI SEMAK DI SAHKAN
--}} +
+
+
+
+
+ + + +@endsection diff --git a/routes/web.php b/routes/web.php index 4c4acfa..cdc1cfd 100644 --- a/routes/web.php +++ b/routes/web.php @@ -279,6 +279,11 @@ Route::post('/laporan/auditcustomer/cetak',['as'=>'laporan.auditcustomercetak',' Route::get('/laporanscantebusbarcode',['as'=>'laporanscantebusbarcode','uses'=>'KhazanahController@LaporanTebusBarcode'])->middleware('auth','khazanah'); +//stokauditkhas +Route::get('laporan/stokauditkhas',['as'=>'laporan.stokauditkhas','uses'=>'KhazanahController@laporanStokAuditKhas'])->middleware('auth','khazanah'); +Route::get('laporan/stokauditkhas/cetak',['as'=>'stokaudit.laporancetakkhas','uses'=>'KhazanahController@cetakLaporanStokAuditKhas'])->middleware('auth','khazanah'); +Route::post('laporan/stokauditkhas/cetakexport',['as'=>'stokaudit.exportlaporancetakkhas','uses'=>'KhazanahController@cetakExportLaporanStokAuditKhas'])->middleware('auth','khazanah'); + //Resit Ansurans Route::get('/resit/{id}',['as'=>'resit.ansuran','uses'=>'GadaianController@resit'])->middleware('auth','teller'); Route::get('/resitansurans/{id}',['as'=>'resit.ansurans','uses'=>'GadaianController@resitansurans'])->middleware('auth','teller');