public function showDiagnosisHistory(Request $request) { $input = $request->all(); $doctor = doctor::where('userId', Auth::user()->userId)->first(); $stats = $doctor->getDiagStats($input['year'] - 543, $input['month']); return view('doctor.showDiagnosisHistory')->with('stats', $stats)->with('year', $input['year'])->with('month', schedule::getMonthName($input['month']))->with('rawYear', $input['year'] - 543)->with('rawMonth', $input['month']); }
public function showDiagnosisHistoryPdf($year, $month) { $doctor = doctor::where('userId', Auth::user()->userId)->first(); $stats = $doctor->getDiagStats($year, $month); $data = ['month' => schedule::getMonthName($month), 'date' => schedule::formatDiagDate(Carbon::now()->format('Y-m-d')), 'doctorName' => $doctor->fullname(), 'department' => $doctor->department()->departmentName, 'diag' => $stats]; $pdf = PDF::loadView('doctor/showDiagnosisHistoryPdf', $data)->setOption('page-size', 'A4'); return $pdf->stream(); }
public static function formatDiagDate($value) { $date = explode('-', $value); $day = $date[2]; if ($day[0] == '0') { $day = $day[1]; } $BEyear = $date[0] + 543; return $day . ' ' . schedule::getMonthName($date[1]) . ' ' . $BEyear; }