diff --git a/app/Exports/LaporanKeseluruhan/StokAuditExport.php b/app/Exports/LaporanKeseluruhan/StokAuditExport.php
new file mode 100644
index 0000000..c1eb095
--- /dev/null
+++ b/app/Exports/LaporanKeseluruhan/StokAuditExport.php
@@ -0,0 +1,89 @@
+data = $data;
+ }
+
+ public function headings(): array
+ {
+ return [
+ 'Cawangan',
+ 'Jumlah Pinjaman',
+ 'Total Pinjaman',
+ 'Total Berat',
+ 'Total Nilai Marhun',
+ 'Total Baki Pinjaman',
+ 'Total Upah Belum Bayar',
+ 'Total Untung 1%',
+ 'Total Ujrah',
+ ];
+ }
+
+ public function array(): array
+ {
+ return $this->data;
+ }
+
+ public function startCell(): string
+ {
+ return 'B2';
+ }
+
+ public function map($data): array
+ {
+ return [
+ $data['cawangan'],
+ $data['jumlah_pinjaman'],
+ number_format($data['total_pinjaman'], 2),
+ number_format($data['total_berat'], 2),
+ number_format($data['total_nilai_marhun'], 2),
+ number_format($data['total_baki_pinjaman'], 2),
+ number_format($data['total_upah_belum_bayar'], 2),
+ number_format($data['total_utg_onepercent'], 2),
+ number_format($data['total_ujrah'], 2),
+ ];
+ }
+
+ public function columnFormats(): array
+ {
+ return [
+ 'C' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
+ 'D' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
+ 'E' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
+ 'F' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
+ 'G' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
+ 'H' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
+ 'I' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
+ ];
+ }
+
+ public function bindValue(Cell $cell, $value)
+ {
+ if (is_numeric($value)) {
+ $cell->setValueExplicit($value, DataType::TYPE_NUMERIC);
+
+ return true;
+ }
+
+ // else return default behavior
+ return parent::bindValue($cell, $value);
+ }
+}
diff --git a/app/Http/Controllers/Reports/StokAuditController.php b/app/Http/Controllers/Reports/StokAuditController.php
new file mode 100644
index 0000000..a135393
--- /dev/null
+++ b/app/Http/Controllers/Reports/StokAuditController.php
@@ -0,0 +1,65 @@
+hostname = config('api.url');
+ $current = new Carbon();
+
+ $month = $request->filled('month') ? $request->month : $current->month;
+ $year = $request->filled('year') ? $request->year : $current->year;
+
+ return view('reports.stok-audit.index', compact('month', 'year'));
+ }
+
+ public function show(Request $request)
+ {
+ $validated = $request->validate(
+ ['monthYear' => 'required'],
+ ['monthYear.required' => 'Sila isi tarikh sebelum hantar',
+ ]);
+
+ $current = Carbon::now();
+ $tarikh_cetak = $current->toDateString();
+ $tokens = explode('-', $validated['monthYear']);
+ $month = ltrim($tokens[0], '0');
+ $year = $tokens[1];
+
+ // Set the locale to Malaysian
+ App::setLocale('ms');
+
+ // Create a Carbon instance representing the date
+ $date = Carbon::createFromDate($year, $month, 1); // Set the day to 1st of the month
+
+ // Get the name of the month in Malaysian local
+ $monthName = $date->translatedFormat('F');
+
+ $request->hostname = config('api.url');
+
+ $stokAudit = Http::get($request->hostname . '/api/reports/stok-audit', [
+ 'month' => $month,
+ 'year' => $year,
+ ])->json();
+
+ $tebus_date = $monthName . ' ' . $year;
+ $file_title = sprintf("Laporan-StokAudit %s (%s - %s).xlsx", 'Semua cawanangan', $monthName, $year);
+
+ if ($request->generateType === 'pdf') {
+ return view('reports.stok-audit.show', compact('tebus_date', 'tarikh_cetak', 'stokAudit', 'month', 'year'));
+ } else {
+ return Excel::download(new StokAuditExport($stokAudit), $file_title);
+ }
+
+ }
+}
diff --git a/resources/js/app.js b/resources/js/app.js
index 371e3c1..9a57294 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -30,6 +30,8 @@ import VueFlatPickr from 'vue-flatpickr-component';
import 'flatpickr/dist/flatpickr.css';
import VueExcelXlsx from "vue-excel-xlsx";
+import flatpickr from "flatpickr";
+import monthSelect from "flatpickr/dist/plugins/monthSelect";
let ops = {
// global component name
@@ -271,3 +273,15 @@ const app = new Vue({
el: '#app',
store
});
+
+//flatpickr for report keseluruhan stok audit
+flatpickr( '#stock_audit_monthYear', {
+ maxDate: 'today',
+ plugins: [
+ new monthSelect({
+ shorthand: false, //defaults to false
+ dateFormat: "m-Y",
+ altFormat: "F Y", //defaults to "F Y"
+ })
+ ]
+});
diff --git a/resources/views/indexOverallReport.blade.php b/resources/views/indexOverallReport.blade.php
index 9876432..10d62b3 100644
--- a/resources/views/indexOverallReport.blade.php
+++ b/resources/views/indexOverallReport.blade.php
@@ -37,6 +37,12 @@
Ringkasan Harian
+
diff --git a/resources/views/reports/stok-audit/index.blade.php b/resources/views/reports/stok-audit/index.blade.php
new file mode 100644
index 0000000..37bbf22
--- /dev/null
+++ b/resources/views/reports/stok-audit/index.blade.php
@@ -0,0 +1,120 @@
+@extends('layouts.app')
+
+@section('content')
+
+
+
+
+
+
+
+
+
+
+ @if ($errors->any())
+
+
+
+
+ @foreach ($errors->all() as $error)
+ {{ $error }}
+ @endforeach
+
+
+
+ @endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @include('layouts.footer')
+
+
+@endsection
+
+@push('additional_scripts')
+
+@endpush
diff --git a/resources/views/reports/stok-audit/show.blade.php b/resources/views/reports/stok-audit/show.blade.php
new file mode 100644
index 0000000..36b137a
--- /dev/null
+++ b/resources/views/reports/stok-audit/show.blade.php
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Laporan Stok Audit |
+ |
+ |
+ Tarikh Cetak:
+ @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
+ $formattedweddingdate = $myDateTime->format('d-m-Y');
+ echo($formattedweddingdate)
+ @endphp
+ |
+ |
+
+
+ | TARIKH |
+ {{ $tebus_date }} |
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+ | Cawangan |
+ Jumlah Pinjaman |
+ Total Pinjaman |
+ Total Berat |
+ Total Nilai Marhun |
+ Total Baki Pinjaman |
+ Total Upah Belum Bayar |
+ Total Untung 1% Percent |
+ Total Ujrah |
+
+ @foreach($stokAudit as $item)
+
+ | {{$item['cawangan']}} |
+ {{ $item['jumlah_pinjaman'] }} |
+ {{ number_format($item['total_pinjaman'],2) }} |
+ {{ number_format($item['total_berat'],2) }} |
+ {{ number_format($item['total_nilai_marhun'],2) }} |
+ {{ number_format($item['total_baki_pinjaman'],2) }} |
+ {{ number_format($item['total_upah_belum_bayar'],2) }} |
+ {{ number_format($item['total_utg_onepercent'],2) }} |
+ {{ number_format($item['total_ujrah'],2) }} |
+
+ @endforeach
+
+
+
+
+
+
+ |
+ .................................................................. |
+ |
+ .................................................................. |
+ |
+
+
+ |
+ DI SEMAK |
+ |
+ DI SAHKAN |
+ |
+
+
diff --git a/routes/reports.php b/routes/reports.php
index 383323b..0748b1c 100644
--- a/routes/reports.php
+++ b/routes/reports.php
@@ -4,6 +4,7 @@ use App\Http\Controllers\Reports\GadaianController;
use App\Http\Controllers\Reports\PenebusanController;
use App\Http\Controllers\Reports\AnsuranController;
use App\Http\Controllers\Reports\RingkasanHarianController;
+use App\Http\Controllers\Reports\StokAuditController;
use Illuminate\Support\Facades\Route;
Route::middleware(['roleChecker:admin,akaun,operasi,kpo, null'])->group(function () {
@@ -16,4 +17,6 @@ Route::middleware(['roleChecker:admin,akaun,operasi,kpo, null'])->group(function
Route::get('ansuran/{kod_cawangan}', [AnsuranController::class, 'downloadAnsuranCawanganExcel'])->name('reports.ansuran.cawangan.excel');
Route::get('ringkasan-harian', [RingkasanHarianController::class, 'index'])->name('reports.ringkasan-harian.index');
Route::get('ringkasan-harian/{kod_cawangan}', [RingkasanHarianController::class, 'downloadRingkasanHarianPdf'])->name('reports.ringkasan-harian.cawangan.pdf');
+ Route::get('stok-audit', [StokAuditController::class, 'index'])->name('reports.stok-audit.index');
+ Route::get('stok-audit/view', [StokAuditController::class, 'show'])->name('reports.stok-audit.show');
});