diff --git a/app/Http/Controllers/AkaunController.php b/app/Http/Controllers/AkaunController.php
index 02fa01d..8b08e16 100644
--- a/app/Http/Controllers/AkaunController.php
+++ b/app/Http/Controllers/AkaunController.php
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
use Barryvdh\DomPDF\Facade as PDF;
@@ -314,7 +315,7 @@ class AkaunController extends Controller
// return view('akaun.laporan_imbanduga',compact('tarikh_imbangan', 'tarikh_imbangan2','hartasemasa','untungrugifield','tanggungansemasa','totalhartasemasa','totaluntungrugi','totaltanggungansemasa','tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail'));
}
-
+////ainizazi
public function cetakLaporanGadai(Request $request){
$api_url = $request->hostname;
$auth_user = Auth::user();
@@ -337,10 +338,20 @@ class AkaunController extends Controller
}
// $gadai = Http::get($request->hostname. '/api/gadai/laporan/'. $request->kodcaw .'/'. $gadai_date)->json();
- $gadai = Http::get($request->hostname. '/api/gadailaporanRangeDate/'. $request->kodcaw,['mula' => $tarikh_mula,'akhir' => $tarikh_akhir])->json();
+ $reportGadai = Http::get($request->hostname. '/api/gadailaporanRangeDate/'. $request->kodcaw,['mula' => $tarikh_mula,'akhir' => $tarikh_akhir])->json();
+ $gadai = $reportGadai['gadai'];
+ // dd($reportsGadai);
+ $statistik =$reportGadai['statistik'];
+ $reportPembiayaan= $statistik['reportPembiayaan'];
+ $reportLoanAmount=$statistik['reportLoanAmount'];
+ $reportMarhunValue=$statistik['reportMarhunValue'];
+ $reportMarhunMargin=$statistik['reportMarhunMargin'];
+ $reportCustomerJob=$statistik['reportCustomerJob'];
+ $reportCustomerRace=$statistik['reportCustomerRace'];
+
$cawangan=Http::get($request->hostname.'/api/cawangan/detail/'.$request->kodcaw)->json();
- $cawangan_detail=$cawangan[0];
+ $cawangan_detail=$cawangan[0];
if(isset($request->jenis))
{
@@ -349,10 +360,9 @@ class AkaunController extends Controller
$pdf = PDF::loadView('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url'))->setPaper('a4', 'landscape');
return $pdf->download('laporan_gadaian_' . $request->kodcaw .'_'. $tarikh_mula .'-'. $tarikh_akhir .'.pdf');
}else{
- return view('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url'));
+ return view('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url','reportGadai','gadai','statistik','reportPembiayaan','reportLoanAmount','reportMarhunValue','reportMarhunMargin','reportCustomerJob','reportCustomerRace'));
}
- }
-
+ }
}
public function cetakLaporanPenebusan(Request $request){
@@ -416,8 +426,6 @@ class AkaunController extends Controller
return view('akaun.laporan_ansuran', compact('tebus','cawangan_detail','tarikh_cetak','tebus_date','api_url'));
}
}
-
-
}
diff --git a/app/Http/Controllers/StatistikController.php b/app/Http/Controllers/StatistikController.php
new file mode 100644
index 0000000..1d5ef03
--- /dev/null
+++ b/app/Http/Controllers/StatistikController.php
@@ -0,0 +1,105 @@
+toDateString();
+ };
+
+ $request->hostname = config('api.url');
+
+ $startDate = $getReportDate($request->startDate);
+ $endDate = $getReportDate($request->endDate);
+
+
+ $gadaian = Http::get($request->hostname . '/api/statistik', [
+ 'startDate' => $startDate,
+ 'endDate' => $endDate,
+ ])->json();
+ dd($gadaian);
+
+ return view('akaun.laporan_gadaian', compact('gadaian', 'startDate', 'endDate'));
+ }
+
+
+
+
+ /**
+ * 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/akaun/laporan_gadaian.blade.php b/resources/views/akaun/laporan_gadaian.blade.php
index a0e644d..8b06dc0 100644
--- a/resources/views/akaun/laporan_gadaian.blade.php
+++ b/resources/views/akaun/laporan_gadaian.blade.php
@@ -1,316 +1,346 @@
-
+ #header th {
+ padding-top: 12px;
+ padding-bottom: 12px;
+ text-align: left;
+ padding: 4px;
+ color: black;
+ }
+ /* Scan Table Styles */
+ #scan {
+ border-collapse: collapse;
+ width: 100%;
+ }
+ #scan td, #scan th {
+ padding: 8px;
+ font-size: 11px;
+ }
+ #scan tr:nth-child(even) {
+ background-color: #ffffff;
+ }
-
+ #details tr:hover {
+ background-color: #ddd;
+ }
+ #details th {
+ padding-top: 12px;
+ font-weight: bold;
+ padding-bottom: 12px;
+ text-align: left;
+ padding: 4px;
+ color: black;
+ }
-
-
-
-
-
-
-
+ #sign th {
+ padding-top: 12px;
+ padding-bottom: 12px;
+ text-align: left;
+ padding: 4px;
+ color: black;
+ }
+ /* Statistics Table Styles */
+ #statistik {
+ width: 100%;
+ border-collapse: collapse;
+ margin: 20px 0;
+ }
+ #statistik th, #statistik td {
+ border: 1px solid #ddd;
+ padding: 12px;
+ text-align: center;
+ }
+ #statistik th {
+ background-color: #f2f2f2;
+ font-weight: bold;
+ }
+ .header-row {
+ background-color: #e0e0e0;
+ font-size: 18px;
+ }
+ .bangsa { background-color: #fce4ec; }
+ .pekerjaan { background-color: #e8f5e9; }
+ .nilai { background-color: #e1f5fe; }
+ .pembiayaan-col { background-color: #ffe4d9; }
+ .jenis { background-color: #e8eaf6; }
+ .page-break {
+ page-break-after: always;
+ }
+ .section-title {
+ font-size: 20px;
+ font-weight: bold;
+ margin: 30px 0 20px 0;
+ padding: 10px;
+ background-color: #f0f0f0;
+ border-left: 5px solid #333;
+ }
+
+
+
+
-
+
@php
$api_url = request()->hostname;
- @endphp
+ @endphp
- @if(Str::contains($api_url, 'apiv3.arrahn'))
- | LAPORAN PEMBIAYAAN (arOSv3) |
- @else
- LAPORAN PEMBIAYAAN |
- @endif
- |
- |
-
- |
- |
-
-
- | Tarikh Mula: |
- @php
- $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_mula);
- $formattedweddingdate = $myDateTime->format('d-m-Y');
- echo($formattedweddingdate)
- @endphp |
- Tarikh Hingga: |
- @php
- $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_akhir);
- $formattedweddingdate = $myDateTime->format('d-m-Y');
- echo($formattedweddingdate)
- @endphp |
- Tarikh Cetak: |
- @php
- $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
- $formattedweddingdate = $myDateTime->format('d-m-Y');
- echo($formattedweddingdate)
- @endphp |
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
-
+ @if(Str::contains($api_url, 'api_arrahnv3.test'))
+ LAPORAN PEMBIAYAAN (arOSv3) |
+ @else
+ LAPORAN PEMBIAYAAN |
+ @endif
+ |
+ |
+ |
+ |
+
+
+ | Tarikh Mula: |
+
+ @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_mula);
+ $formattedweddingdate = $myDateTime->format('d-m-Y');
+ echo($formattedweddingdate)
+ @endphp
+ |
+ Tarikh Hingga: |
+
+ @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_akhir);
+ $formattedweddingdate = $myDateTime->format('d-m-Y');
+ echo($formattedweddingdate)
+ @endphp
+ |
+ Tarikh Cetak: |
+
+ @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
+ $formattedweddingdate = $myDateTime->format('d-m-Y');
+ echo($formattedweddingdate)
+ @endphp
+ |
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
-
- | Bil |
- Norujukan |
- Nama |
- Alamat |
- Tarikh Pembiayaan |
- No K/P |
- Masa |
- Berat |
- N Marhun |
- Pembiayaan |
- Caj-caj Lain |
- Keuntungan 1% |
- Keuntungan |
- Peratus (%) |
-
- @php
- $counter = 1;
- $totalpinjaman = 0;
- $totalberat = 0;
- $totalnm = 0;
- $totalupah = 0;
- $bil = 0;
- $full_total_ujrah = 0;
- $full_total_onepercent = 0;
- @endphp
- @foreach($gadai as $index=>$item)
- @php
- $ujrah = isset($item['ujrah']) ? $item['ujrah'] : 0;
- $onepercent = isset($item['onepercent']) ? $item['onepercent'] : 0;
+
+ | Bil |
+ Norujukan |
+ Nama |
+ Alamat |
+ Tarikh Pembiayaan |
+ No K/P |
+ Masa |
+ Berat |
+ N Marhun |
+ Pembiayaan |
+ Lain-Lain Caj |
+ Keuntungan 1% |
+ Keuntungan |
+ Peratus (%) |
+
+ @php
+ $counter = 1;
+ $totalpinjaman = 0;
+ $totalberat = 0;
+ $totalnm = 0;
+ $totalupah = 0;
+ $bil = 0;
+ $full_total_ujrah = 0;
+ $full_total_onepercent = 0;
+ @endphp
+ @foreach($gadai as $index=>$item)
+ @php
+ $ujrah = isset($item['ujrah']) ? $item['ujrah'] : 0;
+ $onepercent = isset($item['onepercent']) ? $item['onepercent'] : 0;
- $totalpinjaman += $item['pinjaman'];
- $totalberat += $item['berat'];
- $totalnm += $item['nilaimarhun'];
- $totalupah += $item['upah12'];
- $full_total_ujrah += $ujrah * 12;
- $full_total_onepercent += $onepercent * 12;
- @endphp
- @if($index > 0)
- @if($item['teller'] != $gadai[$index - 1]['teller'])
+ $totalpinjaman += $item['pinjaman'];
+ $totalberat += $item['berat'];
+ $totalnm += $item['nilaimarhun'];
+ $totalupah += $item['upah12'];
+ $full_total_ujrah += $ujrah * 12;
+ $full_total_onepercent += $onepercent * 12;
+ @endphp
+ @if($index > 0)
+ @if($item['teller'] != $gadai[$index - 1]['teller'])
+
+ | Teller : {{ $item['teller'] }} |
+
+ @php
+ $totalpinjamanteller = 0;
+ $totalnmteller = 0;
+ $totalberatteller = 0;
+ $totalujrah = 0;
+ $totalonepercent = 0;
+ @endphp
+ @endif
+ @else
| Teller : {{ $item['teller'] }} |
- @php
+ @php
$totalpinjamanteller = 0;
$totalnmteller = 0;
$totalberatteller = 0;
+ $totalupah12 = 0;
$totalujrah = 0;
- $totalonepercent = 0;
+ $totalonepercent= 0;
@endphp
@endif
- @else
- | Teller : {{ $item['teller'] }} |
+ {{ $counter }} |
+ {{$item['norujukan']}} |
+ {{ $item['nama'] }} |
+ {{ $item['alamat1'] }} |
+ {{ $item['t_gadai'] }} |
+ {{ $item['nokp'] }} |
+ {{ $item['masa'] }} |
+ {{ number_format($item['berat'],2) }} |
+ {{ number_format($item['nilaimarhun'],2) }} |
+ {{ number_format($item['pinjaman'],2) }} |
+ {{ number_format($ujrah*12,2) }} |
+ {{ number_format($onepercent*12,2) }} |
+ {{ number_format($item['upah12'],2) }} |
+ {{ $item['percentpinj'] }} |
+ @php $counter++; @endphp
@php
- $totalpinjamanteller = 0;
- $totalnmteller = 0;
- $totalberatteller = 0;
- $totalupah12 = 0;
- $totalujrah = 0;
- $totalonepercent= 0;
+ $totalpinjamanteller += $item['pinjaman'];
+ $totalnmteller += $item['nilaimarhun'];
+ $totalberatteller += $item['berat'];
+ $totalupah12 += $item['upah12'];
+ $totalujrah += $ujrah*12;
+ $totalonepercent += $onepercent*12;
@endphp
-
- @endif
-
- | {{ $counter }} |
- {{$item['norujukan']}} |
-
- {{ $item['nama'] }}
- |
- {{ $item['alamat1'] }} |
- {{ $item['t_gadai'] }} |
- {{ $item['nokp'] }} |
- {{ $item['masa'] }} |
- {{ number_format($item['berat'],2) }} |
- {{ number_format($item['nilaimarhun'],2) }} |
- {{ number_format($item['pinjaman'],2) }} |
- {{ number_format($ujrah*12,2) }} |
- {{ number_format($onepercent*12,2) }} |
- {{ number_format($item['upah12'],2) }} |
- {{ $item['percentpinj'] }} |
-
- @php $counter++; @endphp
- @php
- $totalpinjamanteller += $item['pinjaman'];
- $totalnmteller += $item['nilaimarhun'];
- $totalberatteller += $item['berat'];
- $totalupah12 += $item['upah12'];
- $totalujrah += $ujrah*12;
- $totalonepercent += $onepercent*12;
- @endphp
- @if($index+1 < sizeof($gadai))
- @if($item['teller'] != $gadai[$index + 1]['teller'])
- @php if($item['teller'] != '')$bil += ($counter-1); @endphp
+ @if($index+1 < sizeof($gadai))
+ @if($item['teller'] != $gadai[$index + 1]['teller'])
+ @php if($item['teller'] != '')$bil += ($counter-1); @endphp
+
+ | {{ $counter-1 }} Jumlah surat bagi teller : {{ $item['teller'] }} |
+ {{ number_format($totalberatteller,2) }} |
+ {{ number_format($totalnmteller,2) }} |
+ {{ number_format($totalpinjamanteller,2) }} |
+ {{ number_format($totalujrah,2) }} |
+ {{ number_format($totalonepercent,2) }} |
+ {{ number_format($totalupah12,2) }} |
+
+ @php
+ $counter = 1;
+ $totalupah12 = 0;
+ $totalpinjamanteller = 0;
+ $totalnmteller = 0;
+ $totalujrah = 0;
+ $totalonepercent = 0;
+ @endphp
+ @endif
+ @else
+ @php $bil += ($counter-1); @endphp
| {{ $counter-1 }} Jumlah surat bagi teller : {{ $item['teller'] }} |
{{ number_format($totalberatteller,2) }} |
@@ -319,77 +349,180 @@
{{ number_format($totalujrah,2) }} |
{{ number_format($totalonepercent,2) }} |
{{ number_format($totalupah12,2) }} |
-
- @php
- $counter = 1;
- $totalupah12 = 0;
- $totalpinjamanteller = 0;
- $totalnmteller = 0;
- $totalujrah = 0;
- $totalonepercent = 0;
- @endphp
@endif
- @else
- @php $bil += ($counter-1); @endphp
-
- | {{ $counter-1 }} Jumlah surat bagi teller : {{ $item['teller'] }} |
- {{ number_format($totalberatteller,2) }} |
- {{ number_format($totalnmteller,2) }} |
- {{ number_format($totalpinjamanteller,2) }} |
- {{ number_format($totalujrah,2) }} |
- {{ number_format($totalonepercent,2) }} |
- {{ number_format($totalupah12,2) }} |
-
-
- @endif
- @endforeach
+ @endforeach
+
-
- | JUMLAH BILANGAN = {{ $bil }} |
- Berat (g/m) |
- Nilai Marhun (RM) |
- Pembiayaan (RM) |
- Caj-caj Lain (RM) |
- Keuntungan 1% (RM) |
- Keuntungan (RM) |
-
-
- | JUMLAH KESELURUHAN |
- {{ number_format($totalberat,2) }} |
- {{ number_format($totalnm,2) }} |
- {{ number_format($totalpinjaman,2) }} |
- {{ number_format($full_total_ujrah,2) }} |
- {{ number_format($full_total_onepercent,2) }} |
- {{ number_format($totalupah,2) }} |
-
+
+ | JUMLAH BILANGAN = {{ $bil }} |
+ Berat (g/m) |
+ Nilai Marhun (RM) |
+ Pembiayaan (RM) |
+ Caj-caj Lain (RM) |
+ Keuntungan 1% (RM) |
+ Keuntungan (RM) |
+
+
+ | JUMLAH KESELURUHAN |
+ {{ number_format($totalberat,2) }} |
+ {{ number_format($totalnm,2) }} |
+ {{ number_format($totalpinjaman,2) }} |
+ {{ number_format($full_total_ujrah,2) }} |
+ {{ number_format($full_total_onepercent,2) }} |
+ {{ number_format($totalupah,2) }} |
+
-{{-- JUMLAH KESELURUHAN GADAIAN : RM {{ number_format($totalpinjaman,2) }}
--}}
-
-
-
+
-
- |
- .................................................................. |
- |
- .................................................................. |
- |
-
-
- |
- DI SEMAK |
- |
- DI SAHKAN |
- |
-
+
+ |
+ .................................................................. |
+ |
+ .................................................................. |
+ |
+
+
+ |
+ DI SEMAK |
+ |
+ DI SAHKAN |
+ |
+
+
+
+
+STATISTIK JENIS PEMBIAYAAN
+
+
+
+
+ | Jenis |
+ Bil |
+ Jenis |
+ Bil |
+ RM |
+ Bil |
+ RM |
+ Bil |
+ % |
+ Bil |
+ Jenis |
+ Bil |
+
+
+
+ @php
+ // Get all arrays from statistik
+ $bangsaData = $statistik['reportCustomerRace'];
+ $pekerjaanData = $statistik['reportCustomerJob'];
+ $marhunData = $statistik['reportMarhunValue'];
+ $pembiayaanData = $statistik['reportLoanAmount'];
+ $marginData = $statistik['reportMarhunMargin'];
+ $jenisPembiayaanData = $statistik['reportPembiayaan'];
+
+ // Get maximum rows needed
+ $maxRows = max(
+ count($bangsaData),
+ count($pekerjaanData),
+ count($marhunData),
+ count($pembiayaanData),
+ count($marginData),
+ count($jenisPembiayaanData)
+ );
+
+ // Convert to indexed arrays (preserving order)
+ $bangsaKeys = array_keys($bangsaData);
+ $bangsa = array_values($bangsaData);
+
+ $pekerjaanKeys = array_keys($pekerjaanData);
+ $pekerjaan = array_values($pekerjaanData);
+
+ $marhunKeys = array_keys($marhunData);
+ $marhun = array_values($marhunData);
+
+ $pembiayaanKeys = array_keys($pembiayaanData);
+ $pembiayaan = array_values($pembiayaanData);
+
+ $marginKeys = array_keys($marginData);
+ $margin = array_values($marginData);
+
+ $jenisPembiayaanKeys = array_keys($jenisPembiayaanData);
+ $jenisPembiayaan = array_values($jenisPembiayaanData);
+
+ // Labels for jenis pembiayaan
+ $jenisLabels = [
+ 'pembiayaanbaru' => 'Pembiayaan Baru',
+ 'pembiayaansemula' => 'Pembiayaan Semula',
+ 'lelongan' => 'Lelongan'
+ ];
+
+ // Check if there's any data at all
+ $hasAnyData = count($bangsaData) > 0 || count($pekerjaanData) > 0 ||
+ count($marhunData) > 0 || count($pembiayaanData) > 0 ||
+ count($marginData) > 0 || count($jenisPembiayaanData) > 0;
+ @endphp
+
+ @if($hasAnyData)
+ @for($i = 0; $i < $maxRows; $i++)
+
+ {{-- Bangsa: Nama | Jumlah --}}
+ | {{ $bangsaKeys[$i] ?? '-' }} |
+ {{ $bangsa[$i] ?? '-' }} |
+
+ {{-- Pekerjaan: Jenis | Jumlah --}}
+ {{ $pekerjaanKeys[$i] ?? '-' }} |
+ {{ $pekerjaan[$i] ?? '-' }} |
+
+ {{-- Nilai Marhun: RM | Berat (g) --}}
+ {{ $marhunKeys[$i] ?? '-' }} |
+ {{ isset($marhun[$i]) ? number_format($marhun[$i]) : '-' }} |
+
+ {{-- Pembiayaan: RM | Bil --}}
+ {{ $pembiayaanKeys[$i] ?? '-' }} |
+ {{ isset($pembiayaan[$i]) ? number_format($pembiayaan[$i]) : '-' }} |
+
+ {{-- Pembiayaan Margin: RM | % --}}
+ {{ $marginKeys[$i] ?? '-' }} |
+ {{ isset($margin[$i]) ? number_format($margin[$i]) : '-' }} |
+
+ {{-- Jenis Pembiayaan: Jenis | Bil --}}
+
+ @if(isset($jenisPembiayaanKeys[$i]))
+ {{ $jenisLabels[$jenisPembiayaanKeys[$i]] ?? ucfirst($jenisPembiayaanKeys[$i]) }}
+ @else
+ -
+ @endif
+ |
+ {{ $jenisPembiayaan[$i] ?? '-' }} |
+
+ @endfor
+ @else
+ {{-- Show "Not Available" if no data at all --}}
+
+ |
+ Not Available
+ |
+
+ @endif
+
+
+
+