fix seperate laporan ansuran pembiayaan
This commit is contained in:
@@ -492,7 +492,7 @@ class AkaunController extends Controller
|
||||
|
||||
return view('akaun.laporan_petibesi', compact('petibesi','cawangan_detail','tarikh_cetak','tebus_date','api_url','hutang'));
|
||||
}
|
||||
|
||||
|
||||
public function cetaklaporan_laporan_pendserahan(Request $request)
|
||||
{
|
||||
|
||||
@@ -1656,44 +1656,71 @@ class AkaunController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function cetakLaporanAnsuranRangeDate(Request $request){
|
||||
$api_url = $request->hostname;
|
||||
$auth_user = Auth::user();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
|
||||
if($request->datemula == null){
|
||||
$mula_date = $current->toDateString();
|
||||
}else{
|
||||
$split_date = explode('-',$request->datemula);
|
||||
$mula_date = $request->datemula;
|
||||
}
|
||||
|
||||
if($request->datehingga == null){
|
||||
$hingga_date = $current->toDateString();
|
||||
}else{
|
||||
$split_date2 = explode('-',$request->datehingga);
|
||||
$hingga_date = $request->datehingga;
|
||||
}
|
||||
$request->hostname = config('app.env') == 'production' ? 'http://apiujrah.arrahn' : $request->hostname;
|
||||
$tebus = Http::get($request->hostname. '/api/ansuranujrah/laporan/'. $request->kodcaw,['mula' => $mula_date,'akhir' => $hingga_date])->json();
|
||||
$cawangan=Http::get($request->hostname.'/api/cawangan/detail/'.$request->kodcaw)->json();
|
||||
$cawangan_detail=$cawangan[0];
|
||||
if(isset($request->jenis))
|
||||
{
|
||||
if($request->jenis == 'pdf')
|
||||
{
|
||||
$pdf = PDF::loadView('akaun.laporan_ansuran', compact('tebus','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url'))->setPaper('a4', 'potrait');
|
||||
return $pdf->download('laporan_ansuran_' . $request->kodcaw .'_'. $mula_date .'-'. $hingga_date .'.pdf');
|
||||
|
||||
}else{
|
||||
return view('akaun.laporan_ansuran', compact('tebus','cawangan_detail','tarikh_cetak','api_url','mula_date','hingga_date'));
|
||||
}
|
||||
}
|
||||
public function cetakLaporanAnsuranRangeDate(Request $request){
|
||||
$api_url = $request->hostname;
|
||||
$auth_user = Auth::user();
|
||||
$current = Carbon::now();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
|
||||
// Tarikh mula
|
||||
if ($request->datemula == null) {
|
||||
$mula_date = $current->toDateString();
|
||||
} else {
|
||||
$mula_date = $request->datemula;
|
||||
}
|
||||
|
||||
// Tarikh hingga
|
||||
if ($request->datehingga == null) {
|
||||
$hingga_date = $current->toDateString();
|
||||
} else {
|
||||
$hingga_date = $request->datehingga;
|
||||
}
|
||||
|
||||
// Tetapkan hostname ikut environment
|
||||
$request->hostname = config('app.env') == 'production' ? 'http://apiujrah.arrahn' : $request->hostname;
|
||||
|
||||
$response = Http::get($request->hostname . '/api/ansuranujrah/laporan/' . $request->kodcaw, [
|
||||
'mula' => $mula_date,
|
||||
'akhir' => $hingga_date,
|
||||
'jenis' => $request->laporanansuran
|
||||
]);
|
||||
|
||||
if ($response->failed() || !$response->json()) {
|
||||
$tebus = []; // fallback elak error di view
|
||||
} else {
|
||||
$tebus = $response->json();
|
||||
}
|
||||
|
||||
$cawangan = Http::get($request->hostname . '/api/cawangan/detail/' . $request->kodcaw)->json();
|
||||
$cawangan_detail = $cawangan[0] ?? ['nama' => 'Tiada data'];
|
||||
|
||||
// Tajuk laporan ikut jenis
|
||||
$reportTitles = [
|
||||
'online' => 'Laporan Ansuran Pembiayaan (Arrahn Pay)',
|
||||
'kaunter' => 'Laporan Ansuran Pembiayaan (Kaunter aros)',
|
||||
'all' => 'Laporan Ansuran Pembiayaan Semua'
|
||||
];
|
||||
|
||||
$jenisLaporan = $request->laporanansuran;
|
||||
$fileTitle = $reportTitles[$jenisLaporan] ?? 'Laporan_Tidak_Diketahui';
|
||||
|
||||
// PDF atau view biasa
|
||||
if (isset($request->jenis)) {
|
||||
if ($request->jenis == 'pdf') {
|
||||
$pdf = PDF::loadView('akaun.laporan_ansuran', compact(
|
||||
'tebus', 'cawangan_detail', 'tarikh_cetak', 'mula_date', 'hingga_date', 'api_url', 'jenisLaporan'
|
||||
))->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('laporan_ansuran_' . $request->kodcaw . '_' . $mula_date . '-' . $hingga_date . '.pdf');
|
||||
} else {
|
||||
return view('akaun.laporan_ansuran', compact(
|
||||
'tebus', 'cawangan_detail', 'tarikh_cetak', 'api_url', 'jenisLaporan', 'mula_date', 'hingga_date'
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function cetakLaporanPenebusanRangeDate(Request $request){
|
||||
$api_url = $request->hostname;
|
||||
$auth_user = Auth::user();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="rounded bg-white shadow p-6">
|
||||
<div class="pb-6">
|
||||
<label for="username" class="font-semibold text-gray-700 block pb-1">Tarikh</label>
|
||||
<div class="flex">
|
||||
<div class="flex flex-wrap mb-12">
|
||||
<input :value="jenisgenerate" type="hidden" name="jenis" />
|
||||
<input :value="$kodcaw" name="kodcaw" hidden/>
|
||||
<input :value="$hostname" name="hostname" hidden/>
|
||||
@@ -22,6 +22,23 @@
|
||||
<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"/>
|
||||
</div>
|
||||
<div class="flex justify-center mb-4">
|
||||
<div class="mx-2 radio">
|
||||
<input type="radio" id="arrahnpay" name="laporanansuran" value="arrahnpay" class="hidden focus:bg-gray-500" v-model="selected">
|
||||
<label for="arrahnpay" class="cursor-pointer text-gray-500 focus:bg-gray-500 hover:bg-gray-200 focus:bg-purple-500 focus:bg-purple-500 focus:outline-none border px-10 py-4 border-solid border-gray-500 rounded">Arrahn Pay</label>
|
||||
</div>
|
||||
|
||||
<div class="mx-2 radio cursor-pointer">
|
||||
<input type="radio" id="kaunter" name="laporanansuran" value="kaunter" class="hidden focus:bg-gray-500" v-model="selected">
|
||||
<label for="kaunter" class="cursor-pointer text-gray-500 focus:bg-gray-500 hover:bg-gray-200 focus:bg-purple-500 focus:outline-none border px-10 py-4 border-solid border-gray-500 rounded">Kaunter (aros)</label>
|
||||
</div>
|
||||
|
||||
<div class="mx-2 radio cursor-pointer">
|
||||
<input type="radio" id="all" name="laporanansuran" value="all" class="hidden focus:bg-gray-500" v-model="selected">
|
||||
<label for="all" class="cursor-pointer text-gray-500 focus:bg-gray-500 hover:bg-gray-200 focus:bg-purple-500 focus:outline-none border px-10 py-4 border-solid border-gray-500 rounded">Semua</label>
|
||||
</div>
|
||||
</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>
|
||||
@@ -34,14 +51,24 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.radio input:checked + label{
|
||||
border-color:#F6D860;
|
||||
background-color:#FFF1BD;
|
||||
outline:none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return{
|
||||
jenisgenerate:'none',
|
||||
kodcaw:''
|
||||
}
|
||||
},
|
||||
return {
|
||||
jenisgenerate: 'none',
|
||||
selected: '', // ini untuk radio button
|
||||
kodcaw: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async generatepdf(){
|
||||
await this.setJenis('pdf');
|
||||
|
||||
@@ -163,6 +163,16 @@
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
@php
|
||||
$reportNames = [
|
||||
'arrahnpay' => 'Laporan Ansuran Pembiayaan (Arrahn Pay)',
|
||||
'kaunter' => 'Laporan Ansuran Pembiayaan (Kaunter aros)',
|
||||
'all' => 'Laporan Ansuran Pembiayaan Semua'
|
||||
];
|
||||
|
||||
$displayJenisLaporan = $reportNames[$jenisLaporan] ?? 'Laporan Tidak Diketahui';
|
||||
@endphp
|
||||
|
||||
<table id="scan">
|
||||
<tr>
|
||||
@@ -171,10 +181,10 @@
|
||||
@endphp
|
||||
|
||||
@if(Str::contains($api_url, 'apiv3.arrahn'))
|
||||
<th colspan="5"><b>LAPORAN ANSURAN PEMBIAYAAN (arOSv3)</b></th>
|
||||
<th colspan="5"><b>{{ $displayJenisLaporan }} (arOSv3)</b></th>
|
||||
@else
|
||||
<th> </th>
|
||||
<th colspan ="5"><b>LAPORAN ANSURAN PEMBIAYAAN</b></thh>
|
||||
<th colspan ="5"><b>{{ $displayJenisLaporan }}</b></thh>
|
||||
@endif
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -233,6 +243,8 @@
|
||||
$totalbulansama = 0;
|
||||
@endphp
|
||||
@foreach($tebus as $index=>$item)
|
||||
{{-- @foreach($tebus as $index=>$item)
|
||||
@continue($item['teller'] === 'Online') --}}
|
||||
@php
|
||||
$tarikh_tebus = new DateTime($item['tarikh_bayaran']);
|
||||
$tarikh_gadai = new DateTime($item['t_gadai']);
|
||||
@@ -384,4 +396,13 @@
|
||||
<td colspan="2"><B>DI SAHKAN </B></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
function filterLaporan(jenis) {
|
||||
// Dapatkan tarikh mula dan hingga jika ada dalam form
|
||||
const mula = '{{ $mula_date }}';
|
||||
const hingga = '{{ $hingga_date }}';
|
||||
window.location.href = `?jenis=${jenis}&mula=${mula}&hingga=${hingga}`;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user