Merged in hotfix/laporanbrgkes (pull request #125)

add radio button utk report barangkes
This commit is contained in:
Ain Izazi Aziz
2025-10-12 03:35:46 +00:00
3 changed files with 225 additions and 125 deletions
+6 -6
View File
@@ -1939,9 +1939,9 @@ public function cetakLaporanAnsuranRangeDate(Request $request){
$hingga_date = $request->datehingga; $hingga_date = $request->datehingga;
} }
$barangkes = Http::get($request->hostname . '/api/barangkes/laporan/', ['kodcaw' => $request->kodcaw,'alasan' => $request->sltalasan,'tarikh_mula' => $mula_date,'tarikh_akhir' => $hingga_date])->json(); $status = $request->status ?? 'all';
// $barangkes = Http::get($request->hostname . '/api/barangkes/laporan/', ['kodcaw' => $request->kodcaw,'alasan' => $request->sltalasan,'tarikh_mula' => $mula_date,'tarikh_akhir' => $hingga_date, 'status' => $status,])->json();
$palsu = Http::get($request->hostname . '/api/palsu/laporan/', ['kodcaw' => $request->kodcaw,'tarikh_mula' => $mula_date,'tarikh_akhir' => $hingga_date])->json(); $palsu = Http::get($request->hostname . '/api/palsu/laporan/', ['kodcaw' => $request->kodcaw,'tarikh_mula' => $mula_date,'tarikh_akhir' => $hingga_date, 'status' => $status,])->json();
if (!is_array($palsu)) { if (!is_array($palsu)) {
$palsu = []; // utk nak tengok data tubik ke dok $palsu = []; // utk nak tengok data tubik ke dok
@@ -1957,14 +1957,14 @@ public function cetakLaporanAnsuranRangeDate(Request $request){
{ {
if($request->jenis == 'pdf') if($request->jenis == 'pdf')
{ {
$pdf = PDF::loadView('akaun.laporan_brgkes', compact('hostname','palsu','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url'))->setPaper('a4', 'potrait'); $pdf = PDF::loadView('akaun.laporan_brgkes', compact('hostname','palsu','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url','status'))->setPaper('a4', 'potrait');
return $pdf->download('laporan_brgkes' . $request->kodcaw .'_'. $mula_date .'_'. $hingga_date . '.pdf'); return $pdf->download('laporan_brgkes' . $request->kodcaw .'_'. $mula_date .'_'. $hingga_date . '.pdf');
}else{ }else{
return view('akaun.laporan_brgkes', compact('hostname','palsu','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url')); return view('akaun.laporan_brgkes', compact('hostname','palsu','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url','status'));
} }
} }
return view('akaun.laporan_brgkes', compact('hostname','cawangan_detail','mula_date','hingga_date','tarikh_cetak','api_url','palsu')); return view('akaun.laporan_brgkes', compact('hostname','cawangan_detail','mula_date','hingga_date','tarikh_cetak','api_url','palsu','palsu'));
} }
+187 -118
View File
@@ -1,120 +1,189 @@
<template> <template>
<div class="container"> <div class="container">
<div class="flex w-full">
<div class="flex w-full"> <div class="xl:w-2/3 2xl:w-1/2 p-8 mx-auto">
<div class="xl:w-2/3 2xl:w-1/2 p-8 mx-auto"> <!-- Tajuk -->
<div class="bg-yellow-600 text-gray-200 text-lg px-6 py-4 rounded-t-lg"> <div class="bg-yellow-600 text-gray-200 text-lg px-6 py-4 rounded-t-lg">
<router-link to="/akaunhome"> <router-link to="/akaunhome">
<i class="fas fa-backspace text-white"></i> <i class="fas fa-backspace text-white"></i>
</router-link> </router-link>
<span class="text-center mx-auto text-white font-bold">
<span class="text-center mx-auto text-white font-bold">Laporan Barang Kes</span> Laporan Barang Kes
</div> </span>
<form method="get" id="formringter" :action="Urlredirect()" target="_blank"> </div>
<div class="rounded bg-white shadow p-6">
<div class="pb-6"> <!-- Borang laporan -->
<div class="flex justify-center mb-4"> <form method="get" id="formringter" :action="Urlredirect()" target="_blank">
<input :value="jenisgenerate" type="hidden" name="jenis" /> <div class="rounded bg-white shadow p-6">
<input :value="$kodcaw" name="kodcaw" hidden/>
<input :value="$hostname" name="hostname" hidden/> <!-- Pilihan Tarikh -->
<span style="background-color: #F9FAFB" class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Mula</span> <div class="pb-6">
<input id="tarikhmula" name="datemula" class="border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2" type="date" min="2023-01-01" :max="maxDate"/> <div class="flex justify-center mb-4">
<span style="background-color: #F9FAFB" class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Hingga</span> <input :value="jenisgenerate" type="hidden" name="jenis" />
<input id="tarikhhingga" name="datehingga" class="border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2" type="date" min="2023-01-01" :max="maxDate"/> <input :value="$kodcaw" name="kodcaw" hidden />
</div> <input :value="$hostname" name="hostname" hidden />
<input type="hidden" name="status" :value="status" /> <!-- masih simpan status -->
</div>
<span style="background-color: #F9FAFB"
<div class="flex justify-end mt-10"> class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Mula</span>
<button @click.prevent="generatepdf" class=" mr-2 border border-yellow-600 text-yellow-600 font-montserrat py-2 px-8 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300"><i class="fas fa-file-pdf mr-2"></i>PDF</button> <input
<button @click.prevent="generateview" class="border border-yellow-600 text-yellow-600 font-montserrat py-2 px-8 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300"><i class="fas fa-eye mr-2"></i>View</button> id="tarikhmula"
</div> name="datemula"
</div> class="border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2"
</form> type="date"
</div> min="2023-01-01"
</div> :max="maxDate"
</div> />
</template>
<span style="background-color: #F9FAFB"
<script> class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Hingga</span>
import { <input
required, id="tarikhhingga"
minLength, name="datehingga"
between class="border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2"
} from 'vuelidate/lib/validators' type="date"
export default { min="2023-01-01"
data(){ :max="maxDate"
return{ />
jenisgenerate:'none', </div>
kodcaw:'', </div>
hostname:'',
maxDate: null, <!-- Pilihan Status -->
yesterday: null, <div class="flex flex-col items-center mb-6">
selectedalasan: '', <!-- <label class="font-semibold text-gray-700 mb-2">Status:</label> -->
jenisalasan: {} <div class="flex space-x-6">
} <label class="flex items-center space-x-2">
}, <input
mounted() { type="radio"
this.setMaxDate(); value="all"
}, v-model="status"
created() { class="text-yellow-600 focus:ring-yellow-500"
this.senaraiAlasan(); />
}, <span>Semua</span>
methods: { </label>
setMaxDate() { <label class="flex items-center space-x-2">
const today = new Date(); <input
today.setDate(today.getDate() - 1); type="radio"
this.yesterday = today.toISOString().split('T')[0]; value="belum-tuntut"
this.maxDate = this.yesterday; v-model="status"
}, class="text-yellow-600 focus:ring-yellow-500"
async generatepdf(){ />
await this.setJenis('pdf'); <span>Belum Tuntut</span>
</label>
<label class="flex items-center space-x-2">
Vue.swal({ <input
title: 'Memuatkan...', type="radio"
allowEscapeKey : false, value="dituntut"
allowOutsideClick: false, v-model="status"
showCancelButton: false, class="text-yellow-600 focus:ring-yellow-500"
showConfirmButton: false, />
timer: 8000, <span>Dah Tuntut</span>
}); </label>
</div>
document.getElementById("formringter").submit(); </div>
},
async generateview(){ <!-- Butang Action -->
await this.setJenis('view'); <div class="flex justify-end mt-10">
<button
@click.prevent="generatepdf"
Vue.swal({ class="mr-2 border border-yellow-600 text-yellow-600 font-montserrat py-2 px-8 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300"
title: 'Memuatkan...', >
allowEscapeKey : false, <i class="fas fa-file-pdf mr-2"></i>PDF
allowOutsideClick: false, </button>
showCancelButton: false, <button
showConfirmButton: false, @click.prevent="generateview"
timer: 8000, class="border border-yellow-600 text-yellow-600 font-montserrat py-2 px-8 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300"
}); >
<i class="fas fa-eye mr-2"></i>View
document.getElementById("formringter").submit(); </button>
}, </div>
Urlredirect: function() {
return window.route('cetak.laporanbarangkes') </div>
}, </form>
setJenis: function(value){ </div>
return this.jenisgenerate = value; </div>
}, </div>
senaraiAlasan: function () { </template>
this.axios.get(this.$hostname + '/api/lookupalasan').then(response => {
this.jenisalasan = response.data; <script>
}); import { required } from 'vuelidate/lib/validators'
},
export default {
}, data() {
validations: { return {
selectedalasan: { jenisgenerate: 'none',
required kodcaw: '',
} hostname: '',
} maxDate: null,
yesterday: null,
} selectedalasan: '',
</script> jenisalasan: {},
status: 'all', // default status
}
},
mounted() {
this.setMaxDate();
},
created() {
this.senaraiAlasan();
},
methods: {
setMaxDate() {
const today = new Date();
today.setDate(today.getDate() - 1);
this.yesterday = today.toISOString().split('T')[0];
this.maxDate = this.yesterday;
},
async generatepdf() {
await this.setJenis('pdf');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey: false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formringter").submit();
},
async generateview() {
await this.setJenis('view');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey: false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formringter").submit();
},
Urlredirect() {
return window.route('cetak.laporanbarangkes');
},
setJenis(value) {
this.jenisgenerate = value;
},
senaraiAlasan() {
this.axios.get(this.$hostname + '/api/lookupalasan').then(response => {
this.jenisalasan = response.data;
});
},
},
validations: {
selectedalasan: {
required
}
}
}
</script>
<style scoped>
select {
min-width: 180px;
}
input[type="radio"] {
accent-color: #eab308; /* warna kuning */
}
</style>
+32 -1
View File
@@ -246,7 +246,7 @@
</tr> </tr>
@endforeach @endforeach
</table> --}} </table> --}}
<table id="details"> {{-- <table id="details">
<tr> <tr>
<th>Bil</th> <th>Bil</th>
<th>Tarikh</th> <th>Tarikh</th>
@@ -274,6 +274,37 @@
<td>{{ number_format($item['untungcajlain'], 2) }}</td> <td>{{ number_format($item['untungcajlain'], 2) }}</td>
</tr> </tr>
@endforeach @endforeach
</table> --}}
<table id="details">
<tr>
<th>Bil</th>
<th>Tarikh</th>
<th>No Rujukan</th>
<th>Nota</th>
<th>Pembiayaan (RM)</th>
<th>Nilai Marhun (RM)</th>
<th>JBG</th>
<th>Untung (RM)</th>
<th>1% (RM)</th>
<th>Caj Lain (RM)</th>
</tr>
@php $bil = 1; @endphp
@foreach($palsu as $item)
<tr>
<td>{{ $bil++ }}</td>
<td>{{ $item['tarikh'] }}</td>
<td>{{ $item['norujukan'] }}</td>
<td>{{ $item['nota'] }}</td>
<td>{{ number_format($item['pembiayaan'], 2) }}</td>
<td>{{ number_format($item['nilaimarhun'], 2) }}</td>
<td>{{ number_format($item['jbg'], 2) }}</td>
<td>{{ number_format($item['untung'], 2) }}</td>
<td>{{ number_format($item['untungonepercent'], 2) }}</td>
<td>{{ number_format($item['untungcajlain'], 2) }}</td>
</tr>
@endforeach
</table> </table>
<br><br> <br><br>