added laporan saghilang dalam admin

This commit is contained in:
Hafifie PKB
2025-01-14 11:56:24 +08:00
parent 49fa0a1d61
commit 6923efb66b
6 changed files with 452 additions and 1 deletions
+41
View File
@@ -1714,5 +1714,46 @@ class AkaunController extends Controller
}
public function cetak_laporansaghilang(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 = '2017-01-01';
}else{
$mula_date = $request->datemula;
}
if($request->datehingga == null){
$hingga_date = $current->toDateString();
}else{
$hingga_date = $request->datehingga;
}
$polis = Http::get($request->hostname . '/api/polis/laporan/',['kodcaw' => $request->kodcaw, 'alasan' => $request->sltalasan, 'tarikh_mula' => $mula_date, 'tarikh_akhir' => $hingga_date])->json();
$cawangan_info = Http::get($request->hostname . '/api/cawangan/'. $request->kodcaw)->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_saghilang', compact('polis','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url'))->setPaper('a4', 'potrait');
return $pdf->download('laporan_saghilang_' . $request->kodcaw .'_'. $mula_date .'_'. $hingga_date . '.pdf');
}else{
return view('akaun.laporan_saghilang', compact('polis','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url'));
}
}
return view('akaun.laporan_saghilang', compact('polis','cawangan_detail','mula_date','hingga_date','tarikh_cetak','api_url'));
}
}