/** * Contains the testing sample data for the TopUpController. * * @return void */ public function setVariables() { // Initial sample storage data $this->input = array('lab_section' => TestCategory::find(1)->id, 'commodity' => Commodity::find(1)->id, 'order_quantity' => '1000', 'remarks' => 'More quantity required'); // Edition sample data $this->inputUpdate = array('lab_section' => TestCategory::find(1)->id, 'commodity' => Commodity::find(1)->id, 'order_quantity' => '1000', 'remarks' => 'More quantity required'); }
/** * Tests the update function in the TestCategoryController * @param void * @return void */ public function testUpdate() { // Update the TestCategory Input::replace($this->testCategoryData); $testCategory = new TestCategoryController(); $testCategory->store(); $testCategorystored = TestCategory::orderBy('id', 'desc')->take(1)->get()->toArray(); Input::replace($this->testCategoryUpdate); $testCategory->update($testCategorystored[0]['id']); $testCategorySaved = TestCategory::find($testCategorystored[0]['id']); $this->assertEquals($testCategorySaved->name, $this->testCategoryUpdate['name']); $this->assertEquals($testCategorySaved->description, $this->testCategoryUpdate['description']); }
/** * 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()); }
if ($from != $to) { $subtitle = trans("messages.from") . ' ' . $from . ' ' . trans("messages.to") . ' ' . $to; } else { $subtitle = trans("messages.for") . ' ' . date('Y'); } if ($interval == 'M') { $subtitle .= ' (' . trans("messages.monthly") . ') '; } else { if ($interval == 'D') { $subtitle .= ' (' . trans("messages.daily") . ') '; } else { $subtitle .= ' (' . trans("messages.weekly") . ') '; } } if ($testCategory) { $subtitle .= ' - ' . TestCategory::find($testCategory)->name; } if ($testType) { $subtitle .= '(' . TestType::find($testType)->name . ')'; } echo '"' . $subtitle . '"'; ?> }, credits: { enabled: 'false' }, xAxis: { type: 'datetime', dateTimeLabelFormats: { month: '%e. %b', year: '%b'
/** * Remove the specified resource from storage (soft delete). * * @param int $id * @return Response */ public function delete($id) { //Soft delete the test category $testcategory = TestCategory::find($id); $testCategoryInUse = TestType::where('test_category_id', '=', $id)->first(); if (empty($testCategoryInUse)) { // The test category is not in use $testcategory->delete(); } else { // The test category is in use $url = Session::get('SOURCE_URL'); return Redirect::to($url)->with('message', trans('messages.failure-test-category-in-use')); } // redirect $url = Session::get('SOURCE_URL'); return Redirect::to($url)->with('message', trans('messages.success-deleting-test-category')); }