adding akru bulan for selection year

This commit is contained in:
hafifierahman
2023-01-05 10:06:59 +08:00
parent 991e2d0341
commit 9bcd9c90b2
3 changed files with 108 additions and 87 deletions
+5 -4
View File
@@ -1149,16 +1149,17 @@ class AkaunController extends Controller
public function cetak_akru_bulanan(Request $request){
$auth_user = Auth::user();
$akrubulan = Http::get(config('api.url').'/admin/laporan/akrubulan',['year' => '2022'])->json();
$year = $request->year;
$akrubulan = Http::get(config('api.url').'/admin/laporan/akrubulan',['year' => $year])->json();
if(isset($request->jenis))
{
if($request->jenis == 'pdf')
{
$pdf = PDF::loadView('akaun.laporan_akrubulan',compact('akrubulan'))->setPaper('a4', 'potrait');
return $pdf->download('laporan_akrubulan' . '2022' . '.pdf');
$pdf = PDF::loadView('akaun.laporan_akrubulan',compact('akrubulan','year'))->setPaper('a4', 'potrait');
return $pdf->download('laporan_akrubulan' . $year . '.pdf');
}else{
return view('akaun.laporan_akrubulan',compact('akrubulan'));
return view('akaun.laporan_akrubulan',compact('akrubulan','year'));
}
}
+78 -65
View File
@@ -1,77 +1,90 @@
<template>
<div class="container">
<div class="container">
<div class="flex w-full">
<div class="xl:w-2/3 2xl:w-1/2 p-8 mx-auto">
<div class="bg-yellow-600 text-gray-200 text-lg px-6 py-4 rounded-t-lg">
<div class="flex w-full">
<div class="xl:w-2/3 2xl:w-1/2 p-8 mx-auto">
<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 Akru Bulanan</span>
</div>
<form method="get" id="formakru" :action="Urlredirect()" target="_blank">
<div class="rounded bg-white shadow p-6">
<input :value="jenisgenerate" type="hidden" name="jenis" />
<input :value="$kodcaw" name="kodcaw" hidden/>
<input :value="$hostname" name="hostname" hidden/>
<div class="flex justify-center 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>
</div>
</div>
</form>
<i class="fas fa-backspace text-white"></i>
</router-link>
<span class="text-center mx-auto text-white font-bold">Laporan Akru Bulanan</span>
</div>
<form method="get" id="formakru" :action="Urlredirect()" target="_blank">
<div class="rounded bg-white shadow p-6">
<input :value="jenisgenerate" type="hidden" name="jenis" />
<input :value="$kodcaw" name="kodcaw" hidden />
<input :value="$hostname" name="hostname" hidden />
<label for="year"
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Pilih Tahun</label>
<select name="year" id="year"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
<option selected disabled>Tahun</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
</select>
<div class="flex justify-center 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>
</div>
</div>
</form>
</div>
</div>
</div>
</template>
<script>
export default {
data(){
return{
jenisgenerate:'none',
kodcaw:''
export default {
data() {
return {
jenisgenerate: 'none',
kodcaw: ''
}
},
methods: {
async generatepdf() {
await this.setJenis('pdf');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey: false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formakru").submit();
},
async generateview() {
await this.setJenis('view');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey: false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formakru").submit();
},
Urlredirect: function () {
return window.route('cetak.akrubulan')
},
setJenis: function (value) {
return this.jenisgenerate = value;
}
}
},
methods: {
async generatepdf(){
await this.setJenis('pdf');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formakru").submit();
},
async generateview(){
await this.setJenis('view');
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formakru").submit();
},
Urlredirect: function() {
return window.route('cetak.akrubulan')
},
setJenis: function(value){
return this.jenisgenerate = value;
}
}
}
</script>
</script>
@@ -91,11 +91,18 @@
border-style: solid;
}
#details td, #details th {
#details td {
border-style: solid;
padding: 8px;
font-size:8px;
}
#details th {
border-style: solid;
font-weight:bolder;
text-transform: capitalize;
font-size:10px;
}
#details tr:nth-child(even){background-color: #ffffff;}
@@ -150,9 +157,9 @@
<th></th>
</tr>
<tr>
<td style="width:50px">
<td style="width:50px" colspan="2"><b>TAHUN JANAAN:{{ $year }} </b>
</td>
<td> </td>
<td></td>
<td> </td>
<td> </td>
<td> </td>
@@ -163,21 +170,21 @@
<br>
<table id="details">
<tr style="font-weight: bold">
<th>Cawangan</th>
<th>Januari</th>
<th>Februari</th>
<th>Mac</th>
<th>April</th>
<th>Mei</th>
<th>Jun</th>
<th>Julai</th>
<th>Ogos</th>
<th>September</th>
<th>Oktober</th>
<th>November</th>
<th>Disember</th>
<th>Jumlah</th>
<tr style="font-weight: bold;">
<th>CAWANGAN</th>
<th>JANUARI</th>
<th>FEBRUARI</th>
<th>MAC</th>
<th>APRIL</th>
<th>MEI</th>
<th>JUN</th>
<th>JULAI</th>
<th>OGOS</th>
<th>SEPTEMBER</th>
<th>OKTOBER</th>
<th>NOVEMBER</th>
<th>DISEMBER</th>
<th>JUMLAH</th>
</tr>
@foreach($akrubulan as $index=>$akru)
<tr>