/** * turnaroundTime() function returns the turnaround time blade with necessary contents * * @return Response */ public function turnaroundTime() { $today = date('Y-m-d'); $from = Input::get('start'); $to = Input::get('end'); if (!$to) { $to = $today; } $testCategory = Input::get('section_id'); $testType = Input::get('test_type'); $labSections = TestCategory::lists('name', 'id'); $interval = Input::get('period'); $error = null; if ($testCategory) { $testTypes = TestCategory::find($testCategory)->testTypes->lists('name', 'id'); } else { $testTypes = array("" => ""); } if ($from || $to) { if (strtotime($from) > strtotime($to) || strtotime($from) > strtotime($today) || strtotime($to) > strtotime($today)) { $error = trans('messages.check-date-range'); } else { $toPlusOne = date_add(new DateTime($to), date_interval_create_from_date_string('1 day')); Session::flash('fine', ''); } } $resultset = self::getTatStats($from, $to, $testCategory, $testType, $interval); return View::make('reports.tat.index')->with('labSections', $labSections)->with('testTypes', $testTypes)->with('resultset', $resultset)->with('testCategory', $testCategory)->with('testType', $testType)->with('interval', $interval)->with('error', $error)->withInput(Input::all()); }