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
+ |
+ |
+
+
+
+
+
+
+
+ | Bil |
+
+ Nama |
+ No. KP |
+ No. Telefon |
+ Norujukan |
+ Tempoh |
+ Berat |
+ Nilai Marhun (RM) |
+ Pembiayaan Asal (RM) |
+ Baki Pembiayaan (RM) |
+ Keuntungan Belum Bayar (RM) |
+
+ @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
+
+
+ | {{ $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) }} |
+
+ @php $counter++; @endphp
+ @endforeach
+
+
+ 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
+ |
+ |
+
+
+
+
+
+
+
+ | Bil |
+ Nama |
+ No. KP |
+ No. Telefon |
+ Norujukan |
+ Tempoh |
+ Berat |
+ Nilai Marhun (RM) |
+ Pembiayaan Asal (RM) |
+ Baki Pembiayaan (RM) |
+ Keuntungan Belum Bayar (RM) |
+
+ @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
+
+
+ | {{ $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) }} |
+
+ @php $counter++; @endphp
+ @endforeach
+
+
+ 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')
+