fix tarikh di laporan sag hilang

This commit is contained in:
unknown
2024-10-14 10:53:39 +08:00
parent a5a4246b53
commit 91c7fa5934
3 changed files with 99 additions and 64 deletions
+24 -6
View File
@@ -3699,6 +3699,11 @@ class KhazanahController extends Controller
public function cetakLaporanSAGHilang(Request $request)
{
// return $request->all();
// $request->validate([
// 'mula_date' => 'required|date_format:Y-m-d',
// 'hingga_date' => 'required|date_format:Y-m-d|after_or_equal:mula_date',
// ]);
$api_url = config('api.url');
$auth_user = Auth::user();
@@ -3706,20 +3711,33 @@ class KhazanahController extends Controller
$current = new Carbon();
$tarikh_cetak = $current->toDateString();
if($request->datesaghilang == null){
$date = $current->toDateString();
// if($request->datesaghilang == null){
// $date = $current->toDateString();
// }else{
// $split_date = explode('-', $request->datesaghilang);
// $date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
// }
if($request->mula_date == null){
$mula_date = $current->toDateString();
}else{
$split_date = explode('-', $request->datesaghilang);
$date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
$split_date = explode('-', $request->mula_date);
$mula_date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
}
if($request->hingga_date == null){
$hingga_date = $current->toDateString();
}else{
$split_date = explode('-', $request->hingga_date);
$hingga_date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
}
$polis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/polis/laporan/',['kodcaw' => $auth_user['cawangan'], 'alasan' => $request->sltalasan, 'tarikh' => $date])->json();
$polis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/polis/laporan/',['kodcaw' => $auth_user['cawangan'], 'alasan' => $request->sltalasan, 'tarikh_mula' => $mula_date, 'tarikh_akhir' => $hingga_date])->json();
$cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json();
$cawangan_detail=$cawangan[0];
return view('print.laporan_saghilang', compact('polis','cawangan_detail','date','tarikh_cetak','api_url'));
return view('print.laporan_saghilang', compact('polis','cawangan_detail','mula_date','hingga_date','tarikh_cetak','api_url'));
}
public function NotisLelong()