This commit is contained in:
servdal
2025-08-27 15:29:56 +07:00
parent c7ecb66ba1
commit fef0acb867
10 changed files with 237 additions and 173 deletions
@@ -308,25 +308,34 @@ class ReportController extends Controller
}
}
public function genRekapAntibiotik(Request $request) {
$data = [];
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
$data = [];
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
if ($tahun == '' OR is_null($tahun)){
$getarray = explode('?', $bulan);
$bulan = $getarray[0] ?? date('m');
$tahun = $getarray[1] ?? date('Y');
$bulan = str_replace('bulan=', '', $bulan);
$tahun = str_replace('tahun=', '', $tahun);
}
$getarray = explode('?', $bulan);
$bulan = $getarray[0] ?? date('m');
$tahun = $getarray[1] ?? date('Y');
$bulan = str_replace('bulan=', '', $bulan);
$tahun = str_replace('tahun=', '', $tahun);
}
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
$orderbydate = Periksa::whereYear('daftar', $tahun)->get();
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
$orderbydate = Periksa::whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
} else {
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->get();
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
}
return view('admin.rekapantibiotik', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun'));
}
$orderIds = $orderbydate->pluck('id');
$allAntibiotics = RekapAntibiotik::whereIn('orderid', $orderIds)->get();
$masterAntibioticList = $allAntibiotics->pluck('resistance')->unique()->sort()->values();
$jsonantibiotik = $allAntibiotics->groupBy('orderid')->map(function ($items) {
return $items->pluck('interpretation', 'resistance');
});
return view('admin.rekapantibiotik', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun', 'masterAntibioticList'));
}
public function genGlassReport(Request $request) {
$data = [];
$bulan = $request->input('bulan');