From 7263d5deb774dcf698d898651774ff4f103121dc Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 5 Mar 2024 16:19:39 +0800 Subject: [PATCH] merge stock audit backdate, add excel in stock audit backdate and ujrah and untung column added, also fix dashboard years --- app/Http/Controllers/AkaunController.php | 13 ++++++++-- resources/js/Akaun/StokAuditBackdate.vue | 26 +++++++++---------- resources/js/Dashboard/index.vue | 19 +++++++++++--- .../akaun/laporan_stokauditbackdate.blade.php | 6 +++++ 4 files changed, 45 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/AkaunController.php b/app/Http/Controllers/AkaunController.php index 5fb633e..dbe0733 100644 --- a/app/Http/Controllers/AkaunController.php +++ b/app/Http/Controllers/AkaunController.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Http; use Carbon\Carbon; use Barryvdh\DomPDF\Facade as PDF; -use Maatwebsite\Excel\Excel; +// use Maatwebsite\Excel\Excel; use DateTime; use App\Models\Lejeram; @@ -17,6 +17,9 @@ use App\Models\Cawangan; use App\Services\ImbangdugaServices as ImbanganDuga; use App\Services\RingkasanHarianServices; +use App\Exports\Laporan\StokAuditBackdateExport; +use Maatwebsite\Excel\Facades\Excel; + class AkaunController extends Controller { public function viewlejeram(Request $request) @@ -892,7 +895,13 @@ class AkaunController extends Controller $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokaudit/backdate',['kodcaw' => $kodcaw,'tahun'=>$tahun,'bulan'=>$bulan])->json(); - return view('akaun.laporan_stokauditbackdate', compact('stokaudit','cawangan_detail','tarikh_cetak','tebus_date','api_url')); + $file_title = sprintf("Laporan-StokAuditBackdate %s (%s - %s).xlsx", $kodcaw, $bulan, $tahun); + + if(isset($request->jenis)) + if($request->jenis == 'excel') + return Excel::download(new StokAuditBackdateExport($stokaudit['rekod']), $file_title); + else + return view('akaun.laporan_stokauditbackdate', compact('stokaudit','cawangan_detail','tarikh_cetak','tebus_date','api_url')); } diff --git a/resources/js/Akaun/StokAuditBackdate.vue b/resources/js/Akaun/StokAuditBackdate.vue index 09de831..81e0de0 100644 --- a/resources/js/Akaun/StokAuditBackdate.vue +++ b/resources/js/Akaun/StokAuditBackdate.vue @@ -28,7 +28,7 @@ Mula - + @@ -64,21 +64,21 @@ export default { } }, methods: { - // async generatepdf(){ - // await this.setJenis('pdf'); + async generateexcel(){ + await this.setJenis('excel'); - // Vue.swal({ - // title: 'Memuatkan...', - // allowEscapeKey : false, - // allowOutsideClick: false, - // showCancelButton: false, - // showConfirmButton: false, - // timer: 8000, - // }); + Vue.swal({ + title: 'Memuatkan...', + allowEscapeKey : false, + allowOutsideClick: false, + showCancelButton: false, + showConfirmButton: false, + timer: 8000, + }); - // document.getElementById("formringkasanharian").submit(); - // }, + document.getElementById("formstokauditbackdate").submit(); + }, async generateview(){ await this.setJenis('view'); diff --git a/resources/js/Dashboard/index.vue b/resources/js/Dashboard/index.vue index 5b0e0a0..0555579 100644 --- a/resources/js/Dashboard/index.vue +++ b/resources/js/Dashboard/index.vue @@ -5,8 +5,7 @@
TAHUN :
@@ -49,7 +48,7 @@ export default { data() { return { - selected: '2023', + selected: new Date().getFullYear().toString(), } }, created(){ @@ -67,5 +66,17 @@ export default { this.$refs.tahunan.getDataKeuntungan(); } }, + computed: { + availableYears() { + const currentYear = new Date().getFullYear(); + const years = []; + + for (let i = 0; i < 3; i++) { + years.push(currentYear - i); + } + + return years; + }, + }, } -> \ No newline at end of file + \ No newline at end of file diff --git a/resources/views/akaun/laporan_stokauditbackdate.blade.php b/resources/views/akaun/laporan_stokauditbackdate.blade.php index 3d9017d..743fb75 100644 --- a/resources/views/akaun/laporan_stokauditbackdate.blade.php +++ b/resources/views/akaun/laporan_stokauditbackdate.blade.php @@ -206,6 +206,8 @@ Kadar Upah Tempoh Belum Bayar Keuntungan Belum Bayar (RM) + Utg 1%(RM) + Ujrah(RM) Lanjutan @php $counter = 1;$totalpinjaman = 0; @endphp @@ -222,6 +224,8 @@ {{ number_format($item['kadarupah'],2) }} {{ number_format($item['tempohblmbyar'],2) }} {{ number_format($item['upahblmbyar'],2) }} + {{ number_format($item['utgonepercent'],2) }} + {{ number_format($item['ujrah'],2) }} {{$item['lanjutan']}} @php $counter++; @endphp @@ -235,6 +239,8 @@ {{ number_format($stokaudit['totaltunggakan'],2) }} + {{ (isset($stokaudit['totalonepercent'])) ? number_format($stokaudit['totalonepercent'],2) : 0 }} + {{ (isset($stokaudit['totalujrah'])) ? number_format($stokaudit['totalujrah'],2) : 0 }}