diff --git a/app/Exports/GadaianDetailExport.php b/app/Exports/GadaianDetailExport.php new file mode 100644 index 0000000..2c12368 --- /dev/null +++ b/app/Exports/GadaianDetailExport.php @@ -0,0 +1,81 @@ +kodcaw = $kodcaw; + $this->startDate = $startDate; + $this->endDate = $endDate; + } + + public function view(): View +{ + $generatedAt = now()->format('d-m-Y'); + + $data = Http::get(config('api.url') . '/api/reports/saringan/gadaian', [ + 'startDate' => $this->startDate, + 'endDate' => $this->endDate, + ])->json(); + + $branch = collect($data)->firstWhere('kodcaw', $this->kodcaw); + $details = collect($branch['details'] ?? []); + + $tgb_lelong = $details->where('jenis', 'TGB_LELONG')->values(); + $tgb_biasa = $details->where('jenis', 'TGB_BIASA')->values(); + $gadai_biasa = $details->where('jenis', 'GADAI_BIASA')->values(); + + $subtotal = [ + 'tgb_lelong' => [ + 'berat' => $tgb_lelong->sum('berat'), + 'nilai' => $tgb_lelong->sum('nilaimarhun'), + 'pinjaman' => $tgb_lelong->sum('pinjaman'), + ], + 'tgb_biasa' => [ + 'berat' => $tgb_biasa->sum('berat'), + 'nilai' => $tgb_biasa->sum('nilaimarhun'), + 'pinjaman' => $tgb_biasa->sum('pinjaman'), + ], + 'gadai_biasa' => [ + 'berat' => $gadai_biasa->sum('berat'), + 'nilai' => $gadai_biasa->sum('nilaimarhun'), + 'pinjaman' => $gadai_biasa->sum('pinjaman'), + ], + ]; + + $grandTotal = [ + 'berat' => $subtotal['tgb_lelong']['berat'] + + $subtotal['tgb_biasa']['berat'] + + $subtotal['gadai_biasa']['berat'], + + 'nilai' => $subtotal['tgb_lelong']['nilai'] + + $subtotal['tgb_biasa']['nilai'] + + $subtotal['gadai_biasa']['nilai'], + + 'pinjaman' => $subtotal['tgb_lelong']['pinjaman'] + + $subtotal['tgb_biasa']['pinjaman'] + + $subtotal['gadai_biasa']['pinjaman'], + ]; + + return view('reports.saringan-gadaian.excel', compact( + 'branch', + 'generatedAt', + 'tgb_lelong', + 'tgb_biasa', + 'gadai_biasa', + 'subtotal', + 'grandTotal' + )); +} + +} diff --git a/app/Http/Controllers/SaringanGadaianController.php b/app/Http/Controllers/SaringanGadaianController.php new file mode 100644 index 0000000..4f4e14a --- /dev/null +++ b/app/Http/Controllers/SaringanGadaianController.php @@ -0,0 +1,115 @@ +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) + { + return Excel::download( + new GadaianDetailExport( + $kodcaw, + $request->startDate, + $request->endDate + ), + "Saringan_Gadaian_{$kodcaw}.xlsx" + ); + } + + + + /** + * 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/js/WTD/Rekod.vue b/resources/js/WTD/Rekod.vue index ae43e3a..68c2608 100644 --- a/resources/js/WTD/Rekod.vue +++ b/resources/js/WTD/Rekod.vue @@ -14,14 +14,35 @@
Jumlah WTD
:
-
RM {{ formattext(sb.baki) }}
+ +
+ RM{{ formattext(sb.baki) }} +
-
Tarikh Proses WTD +
Tahun Lelong +
+
:
+
{{ (sb.tahun) ? sb.tahun : 'Tiada' }}
+
+
+
Bulan Lelong +
+
:
+
{{ (sb.bulan) ? sb.bulan : 'Tiada' }}
+
+
+
Tarikh Proses
:
{{ (sb.t_jual) ? sb.t_jual : 'Tiada' }}
+
+
Tarikh Hantar +
+
:
+
{{ (sb.t_htr_ag) ? sb.t_htr_ag : 'Tiada' }}
+
Status
diff --git a/resources/js/WTD/SelectWTD.vue b/resources/js/WTD/SelectWTD.vue index 6a8a49c..77e623b 100644 --- a/resources/js/WTD/SelectWTD.vue +++ b/resources/js/WTD/SelectWTD.vue @@ -19,7 +19,7 @@
- + Batchno: {{ this.batchno }}
@@ -38,9 +38,9 @@ Tarikh Lelong - + Baki @@ -60,9 +60,9 @@ {{ bl.t_jual }} - + {{ formattext(bl.baki) }} @@ -103,7 +103,7 @@ export default { kodcaw: this.$kodcaw, } }).then(response => { - console.log(response); + //console.log(response); this.arraybakilelong = response.data; }) }, @@ -153,7 +153,7 @@ export default { if (boolkatalaluan == 1) { await this.$swal({ - title: 'Proses WTD?', + title: 'Serahan WTD?', text: "anda tidak boleh ulang kembali setelah di proses!", icon: 'warning', showCancelButton: true, @@ -165,16 +165,59 @@ export default { if (result.isConfirmed) { + //new added this.$swal({ - title: "Masukkan No Cek:", - // text: "Write something interesting:", - input: 'text', - showCancelButton: true - }).then((result) => { - if (result.value) { - this.proseswtd(result.value); - } - }); + title: 'Sila Isi Butiran Berikut', + html: ` +
+
+ + +
+ +
+ + +
+
+ `, + focusConfirm: false, + showCancelButton: true, + confirmButtonText: 'Simpan', + cancelButtonText: 'Batal', + + customClass: { + popup: 'swal-popup', + confirmButton: 'swal-confirm', + cancelButton: 'swal-cancel' + }, + + preConfirm: () => { + const noCek = document.getElementById('noCek').value.trim(); + const tarikhAG = document.getElementById('tarikhAG').value; + + if (!noCek || !tarikhAG) { + this.$swal.showValidationMessage( + 'Sila masukkan No Cek dan Tarikh Hantar ke AG' + ); + return false; + } + + return { noCek, tarikhAG }; + } +}).then((result) => { + if (result.isConfirmed) { + this.proseswtd(result.value.noCek, result.value.tarikhAG); + } +}); + + + //end new added } }); } else { @@ -197,11 +240,12 @@ export default { } }); }, - proseswtd: function (nocek) { + proseswtd: function (nocek,tarikhAG) { this.axios.post(this.$hostname + '/admin/wtd/process', { kodcaw: this.$kodcaw, batch: this.batchno, - nocek: nocek + nocek: nocek, + tarikhAG: tarikhAG }).then(response => { if (response.data == 'success') { 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)

+
+ +

Saringan Gadaian

+
+
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..364b613 --- /dev/null +++ b/resources/views/reports/saringan-gadaian/excel.blade.php @@ -0,0 +1,176 @@ + + + + + + + + + + + + + +
+ LAPORAN SARINGAN PEMBIAYAAN +
+ Cawangan : {{ $branch['details_caw'] ?? '-' }} ({{ $branch['kodcaw'] ?? '-' }}) +
+ Tempoh : {{ request()->startDate }} hingga {{ request()->endDate }} +
+ Tarikh Dijana : {{ $generatedAt }} +
+ +
+ + + + + + + + + + + + + + + + + + + + {{-- ================= TGB LELONG ================= --}} + + + + + @php + $bil = 1; + $subBerat = $subNM = $subPinjam = 0; + @endphp + + @foreach ($tgb_lelong as $item) + + + + + + + + + + + + + @php + $subBerat += $item['berat'] ?? 0; + $subNM += $item['nilaimarhun'] ?? 0; + $subPinjam += $item['pinjaman'] ?? 0; + @endphp + @endforeach + + + + + + + + + + {{-- ================= TGB BIASA ================= --}} + + + + + @php + $bil = 1; + $subBerat = $subNM = $subPinjam = 0; + @endphp + + @foreach ($tgb_biasa as $item) + + + + + + + + + + + + + @php + $subBerat += $item['berat'] ?? 0; + $subNM += $item['nilaimarhun'] ?? 0; + $subPinjam += $item['pinjaman'] ?? 0; + @endphp + @endforeach + + + + + + + + + + {{-- ================= GADAI BIASA ================= --}} + + + + + @php + $bil = 1; + $subBerat = $subNM = $subPinjam = 0; + @endphp + + @foreach ($gadai_biasa as $item) + + + + + + + + + + + + + @php + $subBerat += $item['berat'] ?? 0; + $subNM += $item['nilaimarhun'] ?? 0; + $subPinjam += $item['pinjaman'] ?? 0; + @endphp + @endforeach + + + + + + + + + + +
BilNo Rujukan TebusNo Rujukan Gadai BalikNo KPBerat (g)Nilai Marhun (RM)Pinjaman (RM)Tag LelongTarikh Gadai
TGB LELONG
{{ $bil++ }}{{ $item['norujukan_tebus'] ?? null }}{{ $item['norujukan_gadai_balik'] ?? null }}{{ $item['nokp'] ?? null }}{{ $item['berat'] ?? 0 }}{{ $item['nilaimarhun'] ?? 0 }}{{ $item['pinjaman'] ?? 0 }}Ya{{ $item['t_gadai'] ?? null }}
Subtotal{{ number_format($subBerat, 2) }}{{ number_format($subNM, 2) }}{{ number_format($subPinjam, 2) }}
TGB BIASA
{{ $bil++ }}{{ $item['norujukan_tebus'] ?? null }}{{ $item['norujukan_gadai_balik'] ?? null }}{{ $item['nokp'] ?? null }}{{ $item['berat'] ?? 0 }}{{ $item['nilaimarhun'] ?? 0 }}{{ $item['pinjaman'] ?? 0 }}Tidak{{ $item['t_gadai'] ?? null }}
Subtotal{{ number_format($subBerat, 2) }}{{ number_format($subNM, 2) }}{{ number_format($subPinjam, 2) }}
GADAI BIASA
{{ $bil++ }}{{ $item['norujukan_gadai_balik'] ?? null }}{{ $item['nokp'] ?? null }}{{ $item['berat'] ?? 0 }}{{ $item['nilaimarhun'] ?? 0 }}{{ $item['pinjaman'] ?? 0 }}{{ $item['t_gadai'] ?? null }}
Subtotal{{ number_format($subBerat, 2) }}{{ number_format($subNM, 2) }}{{ number_format($subPinjam, 2) }}
+ + + + JUMLAH KESELURUHAN + + + {{ number_format($grandTotal['berat'], 2) }} + + + {{ number_format($grandTotal['nilai'], 2) }} + + + {{ number_format($grandTotal['pinjaman'], 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..381b606 --- /dev/null +++ b/resources/views/reports/saringan-gadaian/index.blade.php @@ -0,0 +1,234 @@ +@extends('layouts.app') + +@section('content') + +
+
+ +
+ + + + +
+
+
+
Laporan Saringan Pembiayaan +
+
+
+
+
+ Mula + + Hingga + + +
+ +
+
+
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + @php + $totalbilgadai = 0; // jumlah semua surat + $total_tgb_lelong = 0; + $total_tgb_biasa = 0; + $total_gadai_biasa = 0; + $totalberat = 0; + $totalnm = 0; + $totalpinjaman = 0; + @endphp + + + @forelse ($gadaian as $gadai) + @php + // Jumlah semua surat + $totalbilgadai += $gadai['jumlah_surat'] ?? 0; + + // Jumlah per kategori + $total_tgb_lelong += $gadai['total_tgb_lelong'] ?? 0; + $total_tgb_biasa += $gadai['total_tgb_biasa'] ?? 0; + $total_gadai_biasa += $gadai['total_gadai_biasa'] ?? 0; + + // Jumlah nilai + $totalberat += $gadai['sum_berat'] ?? 0; + $totalnm += $gadai['sum_nilai_marhun'] ?? 0; + $totalpinjaman += $gadai['sum_pinjaman'] ?? 0; + @endphp + + + + + + + + + + + + + + + @empty + + + + @endforelse + + + + + + + + + + + + + + +
+ No + + Kod Cawangan + + Cawangan + + Jumlah Surat + + TGB Lelong + + TGB Biasa + + Gadai Biasa + + Berat (g) + + Nilai Marhun(RM) + + Pinjaman(RM) + + Action +
+
{{ $loop->iteration }}
+
+
{{ $gadai['kodcaw'] }}
+
+
{{ $gadai['details_caw'] }}
+
+
{{ $gadai['jumlah_surat'] }}
+
+
{{ $gadai['total_tgb_lelong'] }}
+
+
{{ $gadai['total_tgb_biasa'] }}
+
+
{{ $gadai['total_gadai_biasa'] }}
+
+
{{ number_format($gadai['sum_berat'], 2) }}
+
+
{{ number_format($gadai['sum_nilai_marhun'], 2) }}
+
+
{{ number_format($gadai['sum_pinjaman'], 2) }}
+
+ +
+ Data not available +
+ Jumlah Keseluruhan + + {{ $totalbilgadai }} + + {{ $total_tgb_lelong }} + + {{ $total_tgb_biasa }} + + {{ $total_gadai_biasa }} + + {{ number_format($totalberat, 2) }} + + {{ number_format($totalnm, 2) }} + + {{ number_format($totalpinjaman, 2) }} +
+ +
+
+
+ @include('layouts.footer') +
+@endsection diff --git a/resources/views/wtd/index.blade.php b/resources/views/wtd/index.blade.php index 7530aac..cfda47e 100644 --- a/resources/views/wtd/index.blade.php +++ b/resources/views/wtd/index.blade.php @@ -8,7 +8,7 @@
- +
diff --git a/resources/views/wtd/simulasi/show.blade.php b/resources/views/wtd/simulasi/show.blade.php index b27df15..011852b 100644 --- a/resources/views/wtd/simulasi/show.blade.php +++ b/resources/views/wtd/simulasi/show.blade.php @@ -32,7 +32,7 @@ - @dd($senaraiSimulasi); + {{-- @dd($senaraiSimulasi); --}} @foreach ($senaraiSimulasi as $index => $item) 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'); });