diff --git a/app/Exports/GadaianDetailExport.php b/app/Exports/GadaianDetailExport.php
new file mode 100644
index 0000000..fa53486
--- /dev/null
+++ b/app/Exports/GadaianDetailExport.php
@@ -0,0 +1,60 @@
+kodcaw = $kodcaw;
+ $this->startDate = $startDate;
+ $this->endDate = $endDate;
+ }
+
+ public function view(): View
+ {
+ $hostname = config('api.url');
+ $gadaian = Http::get($hostname . '/api/reports/saringan/gadaian', [
+ 'startDate' => $this->startDate,
+ 'endDate' => $this->endDate,
+ ])->json();
+
+ $branch = collect($gadaian)->firstWhere('kodcaw', $this->kodcaw);
+
+ $details = collect($branch['details'] ?? [])
+ ->sort(function ($a, $b) {
+ $aTag = isset($a['taglel_lama']) && $a['taglel_lama'] == 1 ? 0 : 1;
+ $bTag = isset($b['taglel_lama']) && $b['taglel_lama'] == 1 ? 0 : 1;
+
+ if ($aTag !== $bTag) {
+ return $aTag <=> $bTag;
+ }
+
+
+ return ($a['t_gadai'] ?? '') <=> ($b['t_gadai'] ?? '');
+ })
+ ->values()
+ ->all();
+
+
+ $total_berat = collect($details)->sum('berat');
+ $total_nm = collect($details)->sum('nilaimarhun');
+ $total_pinjam = collect($details)->sum('pinjaman');
+
+ return view('reports.saringan-gadaian.excel', compact(
+ 'details',
+ 'total_berat',
+ 'total_nm',
+ 'total_pinjam',
+ 'branch'
+ ));
+ }
+}
diff --git a/app/Http/Controllers/SaringanGadaianController.php b/app/Http/Controllers/SaringanGadaianController.php
new file mode 100644
index 0000000..2ec6835
--- /dev/null
+++ b/app/Http/Controllers/SaringanGadaianController.php
@@ -0,0 +1,112 @@
+toDateString();
+ };
+
+ $request->hostname = config('api.url');
+
+ $startDate = $getReportDate($request->startDate);
+ $endDate = $getReportDate($request->endDate);
+
+
+ $gadaian = Http::get($request->hostname . '/api/reports/saringan/gadaian', [
+ 'startDate' => $startDate,
+ 'endDate' => $endDate,
+ ])->json();
+
+ return view('reports.saringan-gadaian.index', compact('gadaian', 'startDate', 'endDate'));
+ }
+
+ public function exportExcel(Request $request, $kodcaw)
+ {
+ $startDate = $request->startDate ?? now()->startOfMonth()->toDateString();
+ $endDate = $request->endDate ?? now()->endOfMonth()->toDateString();
+
+ $fileName = "Saringan_Gadaian_{$kodcaw}_{$startDate}_to_{$endDate}.xlsx";
+
+ return Excel::download(new GadaianDetailExport($kodcaw, $startDate, $endDate), $fileName);
+ }
+
+
+ /**
+ * Show the form for creating a new resource.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function create()
+ {
+ //
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\Response
+ */
+ public function store(Request $request)
+ {
+ //
+ }
+
+ /**
+ * Display the specified resource.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function show($id)
+ {
+ //
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function edit($id)
+ {
+ //
+ }
+
+ /**
+ * Update the specified resource in storage.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function update(Request $request, $id)
+ {
+ //
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function destroy($id)
+ {
+ //
+ }
+}
diff --git a/resources/views/indexOverallReport.blade.php b/resources/views/indexOverallReport.blade.php
index 70f93b4..6a5bc19 100644
--- a/resources/views/indexOverallReport.blade.php
+++ b/resources/views/indexOverallReport.blade.php
@@ -104,6 +104,12 @@
Transaksi Segera(By Masa)
+
diff --git a/resources/views/reports/saringan-gadaian/excel.blade.php b/resources/views/reports/saringan-gadaian/excel.blade.php
new file mode 100644
index 0000000..b5edd21
--- /dev/null
+++ b/resources/views/reports/saringan-gadaian/excel.blade.php
@@ -0,0 +1,39 @@
+
+
+
+ | Bil |
+ No Rujukan Tebus |
+ No Rujukan Gadai Balik |
+ No KP |
+ Berat (g) |
+ Nilai Marhun (RM) |
+ Pinjaman (RM) |
+ Tag Lelong |
+ Tarikh Gadai |
+
+
+
+ @foreach ($details as $i => $item)
+
+ | {{ $i + 1 }} |
+ {{ $item['norujukan_tebus'] }} |
+ {{ $item['norujukan_gadai_balik'] }} |
+ {{ $item['nokp'] }} |
+ {{ number_format($item['berat'], 2) }} |
+ {{ number_format($item['nilaimarhun'], 2) }} |
+ {{ number_format($item['pinjaman'], 2) }} |
+ {{ isset($item['taglel_lama']) && $item['taglel_lama'] == 1 ? 'Ya' : 'Tidak' }} |
+ {{ $item['t_gadai'] }} |
+
+ @endforeach
+
+
+
+ | Jumlah Keseluruhan |
+ {{ number_format($total_berat, 2) }} |
+ {{ number_format($total_nm, 2) }} |
+ {{ number_format($total_pinjam, 2) }} |
+ |
+
+
+
diff --git a/resources/views/reports/saringan-gadaian/index.blade.php b/resources/views/reports/saringan-gadaian/index.blade.php
new file mode 100644
index 0000000..0b9c059
--- /dev/null
+++ b/resources/views/reports/saringan-gadaian/index.blade.php
@@ -0,0 +1,185 @@
+@extends('layouts.app')
+
+@section('content')
+
+
+
+
+
+
+
+
+
+
+
+
+
Laporan Saringan Pembiayaan
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ No
+ |
+
+ Kod Cawangan
+ |
+
+ Cawangan
+ |
+
+ Bil Pembiayaan
+ |
+
+ Berat (g)
+ |
+
+ Nilai Marhun(RM)
+ |
+
+ Pinjaman(RM)
+ |
+
+ Action
+ |
+
+
+
+ @php
+ $totalbilgadai = 0;
+ $totalberat = 0;
+ $totalnm = 0;
+ $totalpinjaman = 0;
+ @endphp
+
+
+ @forelse ($gadaian as $gadai)
+ @php
+ $totalbilgadai += $gadai['total_gadai_balik'];
+ $totalberat += $gadai['sum_berat'];
+ $totalnm += $gadai['sum_nilai_marhun'];
+ $totalpinjaman += $gadai['sum_pinjaman'];
+ @endphp
+
+
+ |
+ {{ $loop->iteration }}
+ |
+
+ {{ $gadai['kodcaw'] }}
+ |
+
+ {{ $gadai['details_caw'] }}
+ |
+
+ {{ $gadai['total_gadai_balik'] }}
+ |
+
+ {{ number_format($gadai['sum_berat'], 2) }}
+ |
+
+ {{ number_format($gadai['sum_nilai_marhun'], 2) }}
+ |
+
+ {{ number_format($gadai['sum_pinjaman'], 2) }}
+ |
+
+
+ |
+
+ @empty
+
+ |
+ Data not available
+ |
+
+ @endforelse
+
+
+ |
+ Jumlah Keseluruhan
+ |
+
+ {{ $totalbilgadai }}
+ |
+
+ {{ number_format($totalberat, 2) }}
+ |
+
+ {{ number_format($totalnm, 2) }}
+ |
+
+ {{ number_format($totalpinjaman, 2) }}
+ |
+ |
+
+
+
+
+
+
+
+ @include('layouts.footer')
+
+@endsection
diff --git a/routes/reports.php b/routes/reports.php
index 29312eb..60e3404 100644
--- a/routes/reports.php
+++ b/routes/reports.php
@@ -13,6 +13,7 @@ use App\Http\Controllers\Reports\OutstandingController;
use App\Http\Controllers\Reports\PetibesiController;
use App\Http\Controllers\Reports\AnalisaController;
use App\Http\Controllers\Reports\BakiLelongController;
+use App\Http\Controllers\SaringanGadaianController;
use Illuminate\Support\Facades\Route;
Route::middleware(['roleChecker:admin,akaun,operasi,kpo,callcenter, null'])->group(function () {
@@ -45,4 +46,7 @@ Route::middleware(['roleChecker:admin,akaun,operasi,kpo,callcenter, null'])->gro
Route::get('gadaitebus', [GadaianController::class, 'gadaitebus'])->name('reports.gadaitebus.index');
Route::get('gadaitebusmasa', [GadaianController::class, 'gadaitebusmasa'])->name('reports.gadaitebusmasa.index');
Route::get('gadaitebusmasa/{kod_cawangan}', [GadaianController::class, 'downloadGadaiTebusMasaCawanganExcel'])->name('reports.gadaitebusmasa.cawangan.excel');
+
+ Route::get('saringan-gadaian-index', [SaringanGadaianController::class, 'index'])->name('reports.saringan-gadaian.index');
+ Route::get('saringan-gadaian-excel/{kodcaw}', [SaringanGadaianController::class, 'exportExcel'])->name('reports.gadaian.cawangan.excel');
});