add radio button utk report barangkes

This commit is contained in:
Ain Izazi
2025-10-12 11:33:08 +08:00
committed by Nur Izzati
parent 769384518f
commit d99db3011a
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;
}
$barangkes = Http::get($request->hostname . '/api/barangkes/laporan/', ['kodcaw' => $request->kodcaw,'alasan' => $request->sltalasan,'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])->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, 'status' => $status,])->json();
if (!is_array($palsu)) {
$palsu = []; // utk nak tengok data tubik ke dok
@@ -1957,14 +1957,14 @@ public function cetakLaporanAnsuranRangeDate(Request $request){
{
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');
}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'));
}
+108 -39
View File
@@ -1,34 +1,103 @@
<template>
<div class="container">
<div class="flex w-full">
<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">
<router-link to="/akaunhome">
<i class="fas fa-backspace text-white"></i>
</router-link>
<span class="text-center mx-auto text-white font-bold">Laporan Barang Kes</span>
<span class="text-center mx-auto text-white font-bold">
Laporan Barang Kes
</span>
</div>
<!-- Borang laporan -->
<form method="get" id="formringter" :action="Urlredirect()" target="_blank">
<div class="rounded bg-white shadow p-6">
<!-- Pilihan Tarikh -->
<div class="pb-6">
<div class="flex justify-center mb-4">
<input :value="jenisgenerate" type="hidden" name="jenis" />
<input :value="$kodcaw" name="kodcaw" hidden/>
<input :value="$hostname" name="hostname" hidden/>
<span style="background-color: #F9FAFB" class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Mula</span>
<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"/>
<span style="background-color: #F9FAFB" class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Hingga</span>
<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 />
<input :value="$hostname" name="hostname" hidden />
<input type="hidden" name="status" :value="status" /> <!-- masih simpan status -->
<span style="background-color: #F9FAFB"
class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Mula</span>
<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"
/>
<span style="background-color: #F9FAFB"
class="text-gray-600 border-2 rounded-l px-4 py-2 whitespace-no-wrap">Hingga</span>
<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"
/>
</div>
</div>
<!-- Pilihan Status -->
<div class="flex flex-col items-center mb-6">
<!-- <label class="font-semibold text-gray-700 mb-2">Status:</label> -->
<div class="flex space-x-6">
<label class="flex items-center space-x-2">
<input
type="radio"
value="all"
v-model="status"
class="text-yellow-600 focus:ring-yellow-500"
/>
<span>Semua</span>
</label>
<label class="flex items-center space-x-2">
<input
type="radio"
value="belum-tuntut"
v-model="status"
class="text-yellow-600 focus:ring-yellow-500"
/>
<span>Belum Tuntut</span>
</label>
<label class="flex items-center space-x-2">
<input
type="radio"
value="dituntut"
v-model="status"
class="text-yellow-600 focus:ring-yellow-500"
/>
<span>Dah Tuntut</span>
</label>
</div>
</div>
<!-- Butang Action -->
<div class="flex justify-end mt-10">
<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>
<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>
<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>
<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>
</div>
</div>
</form>
</div>
@@ -37,21 +106,19 @@
</template>
<script>
import {
required,
minLength,
between
} from 'vuelidate/lib/validators'
import { required } from 'vuelidate/lib/validators'
export default {
data(){
return{
jenisgenerate:'none',
kodcaw:'',
hostname:'',
data() {
return {
jenisgenerate: 'none',
kodcaw: '',
hostname: '',
maxDate: null,
yesterday: null,
selectedalasan: '',
jenisalasan: {}
jenisalasan: {},
status: 'all', // default status
}
},
mounted() {
@@ -67,54 +134,56 @@
this.yesterday = today.toISOString().split('T')[0];
this.maxDate = this.yesterday;
},
async generatepdf(){
async generatepdf() {
await this.setJenis('pdf');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowEscapeKey: false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formringter").submit();
},
async generateview(){
async generateview() {
await this.setJenis('view');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowEscapeKey: false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formringter").submit();
},
Urlredirect: function() {
return window.route('cetak.laporanbarangkes')
Urlredirect() {
return window.route('cetak.laporanbarangkes');
},
setJenis: function(value){
return this.jenisgenerate = value;
setJenis(value) {
this.jenisgenerate = value;
},
senaraiAlasan: function () {
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>
@endforeach
</table> --}}
<table id="details">
{{-- <table id="details">
<tr>
<th>Bil</th>
<th>Tarikh</th>
@@ -274,6 +274,37 @@
<td>{{ number_format($item['untungcajlain'], 2) }}</td>
</tr>
@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>
<br><br>