/** * Update the specified labtest in storage. * * @param int $id * @return Response */ public function update($id) { $labtest = Labtest::findOrFail($id); $data = Input::all(); if (Input::get('flag') != null) { $data['test_name'] = $labtest->test_name; $data['test_results'] = $labtest->test_results; } if (Auth::user()->role == 'Lab Manager') { $data['test_name'] = $labtest->test_name; } $validator = Validator::make($data, Labtest::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $data['patient_id'] = $labtest->patient_id; $labtest->update($data); if (Input::get('flag') != null) { $flag = Input::get('flag'); return Redirect::to('labtests?id=' . $data['appointment_id'] . '&flag=' . $flag); } return Redirect::to('labtests?id=' . $data['appointment_id']); }
public function print_test() { $id = Input::get('id'); $test = Labtest::findOrFail($id); $patient = $test->appointment->patient; $date = date('j F, Y', strtotime($test->appointment->date)); $time = date('H:i:s', strtotime($test->appointment->time)); $doctor_name = $test->appointment->employee->name; $html = "<html><body>" . " <img src='./images/logo_new1.jpg'/>\n <center>\n <h1><u> Lab Test Report </u></h1>\n </center>\n <table style='width: 80%; border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n\n <tr>\n <td height='20'><label>Patient Name:</label></td>\n <td><label> {$patient->name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Patient ID:</label></td>\n <td><label> {$patient->patient_id} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Visit Date:</label></td>\n <td><label> {$date} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Visit Time:</label></td>\n <td><label> {$time} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Doctor Name:</label></td>\n <td><label> {$doctor_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Test Name:</label></td>\n <td><label> {$test->test_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Description:</label></td>\n <td><label> {$test->test_description} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Test Results:</label></td>\n <td><label> {$test->test_results} </label></td>\n </tr>\n </table>" . "</body></html>"; return PDF::load($html, 'A4', 'portrait')->show($patient->name . ' Test Report'); }
$doctor_name = $prescription->appointment->employee->name; $patient = $prescription->appointment->patient; $medicines = []; foreach (explode(',', $prescription->medicines) as $id) { array_push($medicines, Medicine::find($id)); } return View::make('printables.prescription_print', compact('prescription', 'date', 'time', 'doctor_name', 'patient', 'medicines')); }); Route::get('app_test_print', function () { $appointments = Appointment::has('labtests')->get(); $flag = "test_print"; return View::make('appointment_based_data.appointments', compact('appointments', 'flag')); }); Route::get('test_print', function () { $id = Input::get('id'); $test = Labtest::findOrFail($id); $patient = $test->appointment->patient; $date = date('j F, Y', strtotime($test->appointment->date)); $time = date('H:i:s', strtotime($test->appointment->time)); $doctor_name = $test->appointment->employee->name; return View::make('printables.test_print', compact('test', 'date', 'time', 'doctor_name', 'patient')); }); Route::get('app_checkup_fee_print', function () { $appointments = Appointment::has('checkupfee')->get(); $flag = "checkup_invoice"; return View::make('appointment_based_data.appointments', compact('appointments', 'flag')); }); Route::get('checkup_invoice_print', function () { $id = Input::get('id'); $fee = Checkupfee::findOrFail($id); $patient = $fee->appointment->patient;