From 70879edd8ca711e15cbfdf7f787c9c3266b2eaba Mon Sep 17 00:00:00 2001 From: Nur Izzati Date: Wed, 27 Aug 2025 12:24:51 +0800 Subject: [PATCH] tambah baik laporan SA by sag --- app/Http/Controllers/KhazanahController.php | 23 +- .../excel/excel_stokauditkhasbysag.blade.php | 344 ++++++++++++++ .../pdf/pdf_stokauditkhasbysag.blade.php | 344 ++++++++++++++ .../laporan_stokauditkhasbysag.blade.php | 428 ++++++++++++++++++ 4 files changed, 1132 insertions(+), 7 deletions(-) create mode 100644 resources/views/excel/excel_stokauditkhasbysag.blade.php create mode 100644 resources/views/pdf/pdf_stokauditkhasbysag.blade.php create mode 100644 resources/views/print/laporan_stokauditkhasbysag.blade.php diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 916c9bc..15b2818 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -4121,9 +4121,13 @@ class KhazanahController extends Controller if($request->radaktif === 'aktif') { - $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'], + // $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'], + $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhasbynorujukan/aktif/'. $auth_user['cawangan'], ['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); - return view('print.laporan_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + $stokaudit = collect($stokaudit)->sortByDesc('norujukan')->values()->all(); + // dd($stokaudit); + // return view('print.laporan_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + return view('print.laporan_stokauditkhasbysag', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); } } @@ -4141,11 +4145,13 @@ class KhazanahController extends Controller $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(); - + // $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhasbynorujukan/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + $stokaudit = collect($stokaudit)->sortByDesc('norujukan')->values()->all(); if($request->type == 'excel') { - return view('excel.excel_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + // return view('excel.excel_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + return view('excel.excel_stokauditkhasbysag', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); } elseif($request->type == 'whatsapp') { @@ -4164,8 +4170,11 @@ class KhazanahController extends Controller } 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')); + // $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhasbynorujukan/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json(); + $stokaudit = collect($stokaudit)->sortByDesc('norujukan')->values()->all(); + // return view('pdf.pdf_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); + return view('pdf.pdf_stokauditkhasbysag', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info')); } } diff --git a/resources/views/excel/excel_stokauditkhasbysag.blade.php b/resources/views/excel/excel_stokauditkhasbysag.blade.php new file mode 100644 index 0000000..76f545f --- /dev/null +++ b/resources/views/excel/excel_stokauditkhasbysag.blade.php @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
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; + + // Sort ikut norujukan + $rekod = collect($stokaudit[0])->sortBy('norujukan')->values(); + @endphp + + @foreach ($rekod as $item) + @php + $status = $item['blasted'] == null ? 'Belum' : 'Selesai'; + $totalpinjaman += $item['pinjaman']; + @endphp + + + + + + + + + + + + + + + + @php $counter++; @endphp + @endforeach + + + + + + + + + +
BilNamaNo. KPNo. TelefonNorujukanTempohBeratNilai Marhun (RM)Pembiayaan Asal (RM)Baki Pembiayaan (RM)Keuntungan Belum Bayar (RM)
{{ $counter }}{{ $item['customer']['nama'] ?? '-' }}{{ $item['nokp'] }}{{ $item['customer']['telefon'] ?? '-' }}{{ $item['norujukan'] }}{{ $item['tempoh'] }}{{ $item['berat'] }}{{ number_format($item['nilaimarhun'], 2) }}{{ number_format($item['pinjaman'], 2) }}{{ number_format($item['bakipjm'], 2) }}{{ number_format($item['tunggakan'], 2) }}
Jumlah{{ number_format(collect($rekod)->sum('berat'), 2) }}{{ number_format(collect($rekod)->sum('nilaimarhun'), 2) }}{{ number_format(collect($rekod)->sum('pinjaman'), 2) }}{{ number_format(collect($rekod)->sum('bakipjm'), 2) }}{{ number_format(collect($rekod)->sum('tunggakan'), 2) }}
+ + + + + + + + diff --git a/resources/views/pdf/pdf_stokauditkhasbysag.blade.php b/resources/views/pdf/pdf_stokauditkhasbysag.blade.php new file mode 100644 index 0000000..749999c --- /dev/null +++ b/resources/views/pdf/pdf_stokauditkhasbysag.blade.php @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
Laporan Stok Audit Khas Tempoh : {{$daritempoh}} hingga tempoh : {{$hinggatempoh}} 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; + + // Sort ikut norujukan + $rekod = collect($stokaudit[0])->sortBy('norujukan')->values(); + @endphp + + @foreach ($rekod as $item) + @php + $status = $item['blasted'] == null ? 'Belum' : 'Selesai'; + $totalpinjaman += $item['pinjaman']; + @endphp + + + + + + + + + + + + + + + @php $counter++; @endphp + @endforeach + + + + + + + + + +
BilNamaNo. KPNo. TelefonNorujukanTempohBeratNilai Marhun (RM)Pembiayaan Asal (RM)Baki Pembiayaan (RM)Keuntungan Belum Bayar (RM)
{{ $counter }}{{ $item['customer']['nama'] ?? '-' }}{{ $item['nokp'] }}{{ $item['customer']['telefon'] ?? '-' }}{{ $item['norujukan'] }}{{ $item['tempoh'] }}{{ $item['berat'] }}{{ number_format($item['nilaimarhun'], 2) }}{{ number_format($item['pinjaman'], 2) }}{{ number_format($item['bakipjm'], 2) }}{{ number_format($item['tunggakan'], 2) }}
Jumlah{{ number_format(collect($rekod)->sum('berat'), 2) }}{{ number_format(collect($rekod)->sum('nilaimarhun'), 2) }}{{ number_format(collect($rekod)->sum('pinjaman'), 2) }}{{ number_format(collect($rekod)->sum('bakipjm'), 2) }}{{ number_format(collect($rekod)->sum('tunggakan'), 2) }}
+ + + + + + + + + diff --git a/resources/views/print/laporan_stokauditkhasbysag.blade.php b/resources/views/print/laporan_stokauditkhasbysag.blade.php new file mode 100644 index 0000000..e5b5397 --- /dev/null +++ b/resources/views/print/laporan_stokauditkhasbysag.blade.php @@ -0,0 +1,428 @@ +@extends('layouts.app') + + + + + + + + + + + + + + + + + + + + + +@section('content') +
+
+
+
+ + + +
+ +
+ {{-- Blast Whatsapp & SMS --}} + @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; + + // Sort ikut norujukan + $rekod = collect($stokaudit[0])->sortBy('norujukan')->values(); + @endphp + + @foreach ($rekod as $item) + @php + $status = $item['blasted'] == null ? 'Belum' : 'Selesai'; + $totalpinjaman += $item['pinjaman']; + @endphp + + + + + + + + + + + + + + + + @php $counter++; @endphp + @endforeach + + + + + + + + + +
BilNamaNo. KPNo. TelefonNorujukanTempohBeratNilai Marhun (RM)Pembiayaan Asal (RM)Baki Pembiayaan (RM)Keuntungan Belum Bayar (RM)
{{ $counter }}{{ $item['customer']['nama'] ?? '-' }}{{ $item['nokp'] }}{{ $item['customer']['telefon'] ?? '-' }}{{ $item['norujukan'] }}{{ $item['tempoh'] }}{{ $item['berat'] }}{{ number_format($item['nilaimarhun'], 2) }}{{ number_format($item['pinjaman'], 2) }}{{ number_format($item['bakipjm'], 2) }}{{ number_format($item['tunggakan'], 2) }}
Jumlah{{ number_format(collect($rekod)->sum('berat'), 2) }}{{ number_format(collect($rekod)->sum('nilaimarhun'), 2) }}{{ number_format(collect($rekod)->sum('pinjaman'), 2) }}{{ number_format(collect($rekod)->sum('bakipjm'), 2) }}{{ number_format(collect($rekod)->sum('tunggakan'), 2) }}
+ + + +
+
+{{-- + + + + + + + + + + + + + + +
.................................................................. ..................................................................
DI SEMAK DI SAHKAN
--}} +
+
+
+
+
+ + + +@endsection