Merge branch 'amirah' into 'main'

laporan gadai by range date

See merge request online-sistem1/admin-portal!54
This commit is contained in:
arrahn pkb
2023-04-12 01:17:17 +00:00
3 changed files with 130 additions and 29 deletions
+16 -6
View File
@@ -315,13 +315,23 @@ class AkaunController extends Controller
$current = new Carbon();
$tarikh_cetak = $current->toDateString();
if($request->datetarikh == null){
$gadai_date = $current->toDateString();
$tarikh_mula = $current->toDateString();
}else{
$split_date = explode('-',$request->datetarikh);
// $gadai_date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
$gadai_date = $request->datetarikh;
$tarikh_mula = $request->datetarikh;
}
$gadai = Http::get($request->hostname. '/api/gadai/laporan/'. $request->kodcaw .'/'. $gadai_date)->json();
if($request->datehingga == null){
$tarikh_akhir = $current->toDateString();
}else{
$split_date2 = explode('-',$request->datehingga);
$tarikh_akhir = $request->datehingga;
}
// $gadai = Http::get($request->hostname. '/api/gadai/laporan/'. $request->kodcaw .'/'. $gadai_date)->json();
$gadai = Http::get($request->hostname. '/api/gadailaporanRangeDate/'. $request->kodcaw,['mula' => $tarikh_mula,'akhir' => $tarikh_akhir])->json();
$cawangan=Http::get($request->hostname.'/api/cawangan/detail/'.$request->kodcaw)->json();
$cawangan_detail=$cawangan[0];
@@ -329,10 +339,10 @@ class AkaunController extends Controller
{
if($request->jenis == 'pdf')
{
$pdf = PDF::loadView('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','gadai_date','api_url'))->setPaper('a4', 'landscape');
return $pdf->download('laporan_gadaian_' . $request->kodcaw .'_'. $gadai_date . '.pdf');
$pdf = PDF::loadView('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url'))->setPaper('a4', 'landscape');
return $pdf->download('laporan_gadaian_' . $request->kodcaw .'_'. $tarikh_mula .'-'. $tarikh_akhir .'.pdf');
}else{
return view('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','gadai_date','api_url'));
return view('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url'));
}
}
+102 -20
View File
@@ -18,9 +18,14 @@
<input :value="$hostname" name="hostname" hidden/>
<input :value="jenisgenerate" type="hidden" name="jenis" />
<span style="background-color: #F9FAFB" class="text-gray-600 border border-2 rounded-l px-4 py-2 whitespace-no-wrap">Mula</span>
<input id="tarikhmula" name="datetarikh" class="border border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2" type="date" />
<input id="tarikhmula" name="datetarikh" @change="dateChecking()" class="border border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2" type="date" />
<span style="background-color: #F9FAFB" class="text-gray-600 border border-2 rounded-l px-4 py-2 whitespace-no-wrap">Hingga</span>
<input id="tarikhhingga" name="datehingga" @change="dateChecking()" class="border border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2" type="date"/>
<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>
</div>
<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>
</div>
</div>
@@ -44,38 +49,115 @@ export default {
async generatepdf(){
await this.setJenis('pdf');
var tarikhMula = document.getElementById("tarikhmula");
var tarikhHingga = document.getElementById("tarikhhingga");
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
var tarikh1 = new Date(tarikhMula.value);
var tarikh2 = new Date(tarikhHingga.value);
var Difference_In_Time = tarikh2.getTime() - tarikh1.getTime();
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24) + 1;
document.getElementById("formgadaian").submit();
if(Difference_In_Days > 62){
Vue.swal({
text: 'Sila Pilih Tarikh Kurang Dari 2 Bulan',
icon: 'error',
allowEscapeKey : false,
showCancelButton: false,
showConfirmButton: true,
});
} else{
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formgadaian").submit();
}
},
async generateview(){
await this.setJenis('view');
var tarikhMula = document.getElementById("tarikhmula");
var tarikhHingga = document.getElementById("tarikhhingga");
var tarikh1 = new Date(tarikhMula.value);
var tarikh2 = new Date(tarikhHingga.value);
var Difference_In_Time = tarikh2.getTime() - tarikh1.getTime();
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24) + 1;
if(Difference_In_Days > 62){
Vue.swal({
text: 'Sila Pilih Tarikh Kurang Dari 2 Bulan',
icon: 'error',
allowEscapeKey : false,
showCancelButton: false,
showConfirmButton: true,
});
} else{
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formgadaian").submit();
}
Vue.swal({
title: 'Memuatkan...',
allowEscapeKey : false,
allowOutsideClick: false,
showCancelButton: false,
showConfirmButton: false,
timer: 8000,
});
document.getElementById("formgadaian").submit();
},
Urlredirect: function() {
return window.route('cetak.gadaian')
},
setJenis: function(value){
return this.jenisgenerate = value;
},
dateChecking(){
var tarikhMula = document.getElementById("tarikhmula");
var tarikhHingga = document.getElementById("tarikhhingga");
var tarikh1 = new Date(tarikhMula.value);
var tarikh2 = new Date(tarikhHingga.value);
var Difference_In_Time = tarikh2.getTime() - tarikh1.getTime();
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24) + 1;
if(Difference_In_Days > 62){
Vue.swal({
text: 'Sila Pilih Tarikh Kurang Dari 2 Bulan',
icon: 'error',
allowEscapeKey : false,
showCancelButton: false,
showConfirmButton: true,
});
}
}
}
@@ -174,19 +174,26 @@
<th></th>
</tr>
<tr>
<td><b> Tarikh:</b></td>
<td style="width:100px"><b> Tarikh Mula: </b></td>
<td style="text-align:left;"> @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $gadai_date);
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_mula);
$formattedweddingdate = $myDateTime->format('d-m-Y');
echo($formattedweddingdate)
@endphp</td>
<td style="width:10px"> <b>Tarikh Cetak</b></td>
<td style="width:100px"><b> Tarikh Hingga: </b></td>
<td style="text-align:left;"> @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_akhir);
$formattedweddingdate = $myDateTime->format('d-m-Y');
echo($formattedweddingdate)
@endphp</td>
<td style="width:100px"> <b>Tarikh Cetak: </b></td>
<td style="text-align:left;">@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
$formattedweddingdate = $myDateTime->format('d-m-Y');
echo($formattedweddingdate)
@endphp</td>
</tr>
<tr>
<td style="width:50px">
</td>
@@ -206,6 +213,7 @@
<th>Norujukan</th>
<th>Nama</th>
<th>Alamat</th>
<th>Tarikh Gadai</th>
<th>No K/P</th>
<th>Masa</th>
<th>Berat</th>
@@ -238,6 +246,7 @@
{{ $item['nama'] }}
</td>
<td>{{ $item['alamat1'] }}</td>
<td>{{ $item['t_gadai'] }}</td>
<td>{{ $item['nokp'] }}</td>
<td>{{ $item['masa'] }}</td>
<td>{{ number_format($item['berat'],2) }}</td>