Пример #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $topupRequest = TopupRequest::find($id);
     $commodities = Commodity::has('receipts')->lists('name', 'id');
     $sections = TestCategory::all()->lists('name', 'id');
     return View::make('topup.edit')->with('topupRequest', $topupRequest)->with('sections', $sections)->with('commodities', $commodities);
 }
Пример #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $issue = Issue::find($id);
     $commodities = Commodity::all()->lists('name', 'id');
     $batches = Receipt::all()->lists('batch_no', 'id');
     $users = User::where('id', '!=', Auth::user()->id)->lists('name', 'id');
     $sections = TestCategory::all()->lists('name', 'id');
     //To DO:create function for this
     $available = $issue->topupRequest->commodity->available();
     return View::make('issue.edit')->with('commodities', $commodities)->with('available', $available)->with('users', $users)->with('sections', $sections)->with('issue', $issue)->with('batches', $batches);
 }
Пример #3
0
 /**
  * Display a test((un)grouped) and specimen((un)grouped) counts.
  *
  */
 public function countReports()
 {
     $date = date('Y-m-d');
     $from = Input::get('start');
     if (!$from) {
         $from = date('Y-m-01');
     }
     $to = Input::get('end');
     if (!$to) {
         $to = $date;
     }
     $toPlusOne = date_add(new DateTime($to), date_interval_create_from_date_string('1 day'));
     $counts = Input::get('counts');
     //	Begin grouped test counts
     if ($counts == trans('messages.grouped-test-counts')) {
         $testCategories = TestCategory::all();
         $testTypes = TestType::all();
         $ageRanges = array('0-5', '5-15', '15-120');
         //	Age ranges - will definitely change in configurations
         $gender = array(Patient::MALE, Patient::FEMALE);
         //	Array for gender - male/female
         $perAgeRange = array();
         // array for counts data for each test type and age range
         $perTestType = array();
         //	array for counts data per testype
         if (strtotime($from) > strtotime($to) || strtotime($from) > strtotime($date) || strtotime($to) > strtotime($date)) {
             Session::flash('message', trans('messages.check-date-range'));
         }
         foreach ($testTypes as $testType) {
             $countAll = $testType->groupedTestCount(null, null, $from, $toPlusOne->format('Y-m-d H:i:s'));
             $countMale = $testType->groupedTestCount([Patient::MALE], null, $from, $toPlusOne->format('Y-m-d H:i:s'));
             $countFemale = $testType->groupedTestCount([Patient::FEMALE], null, $from, $toPlusOne->format('Y-m-d H:i:s'));
             $perTestType[$testType->id] = ['countAll' => $countAll, 'countMale' => $countMale, 'countFemale' => $countFemale];
             foreach ($ageRanges as $ageRange) {
                 $maleCount = $testType->groupedTestCount([Patient::MALE], $ageRange, $from, $toPlusOne->format('Y-m-d H:i:s'));
                 $femaleCount = $testType->groupedTestCount([Patient::FEMALE], $ageRange, $from, $toPlusOne->format('Y-m-d H:i:s'));
                 $perAgeRange[$testType->id][$ageRange] = ['male' => $maleCount, 'female' => $femaleCount];
             }
         }
         return View::make('reports.counts.groupedTestCount')->with('testCategories', $testCategories)->with('ageRanges', $ageRanges)->with('gender', $gender)->with('perTestType', $perTestType)->with('perAgeRange', $perAgeRange)->withInput(Input::all());
     } else {
         if ($counts == trans('messages.ungrouped-specimen-counts')) {
             if (strtotime($from) > strtotime($to) || strtotime($from) > strtotime($date) || strtotime($to) > strtotime($date)) {
                 Session::flash('message', trans('messages.check-date-range'));
             }
             $ungroupedSpecimen = array();
             foreach (SpecimenType::all() as $specimenType) {
                 $rejected = $specimenType->countPerStatus([Specimen::REJECTED], $from, $toPlusOne->format('Y-m-d H:i:s'));
                 $accepted = $specimenType->countPerStatus([Specimen::ACCEPTED], $from, $toPlusOne->format('Y-m-d H:i:s'));
                 $total = $rejected + $accepted;
                 $ungroupedSpecimen[$specimenType->id] = ["total" => $total, "rejected" => $rejected, "accepted" => $accepted];
             }
             // $data = $data->groupBy('test_type_id')->paginate(Config::get('kblis.page-items'));
             return View::make('reports.counts.ungroupedSpecimenCount')->with('ungroupedSpecimen', $ungroupedSpecimen)->withInput(Input::all());
         } else {
             if ($counts == trans('messages.grouped-specimen-counts')) {
                 $ageRanges = array('0-5', '5-15', '15-120');
                 //	Age ranges - will definitely change in configurations
                 $gender = array(Patient::MALE, Patient::FEMALE);
                 //	Array for gender - male/female
                 $perAgeRange = array();
                 // array for counts data for each test type and age range
                 $perSpecimenType = array();
                 //	array for counts data per testype
                 if (strtotime($from) > strtotime($to) || strtotime($from) > strtotime($date) || strtotime($to) > strtotime($date)) {
                     Session::flash('message', trans('messages.check-date-range'));
                 }
                 $specimenTypes = SpecimenType::all();
                 foreach ($specimenTypes as $specimenType) {
                     $countAll = $specimenType->groupedSpecimenCount([Patient::MALE, Patient::FEMALE], null, $from, $toPlusOne->format('Y-m-d H:i:s'));
                     $countMale = $specimenType->groupedSpecimenCount([Patient::MALE], null, $from, $toPlusOne->format('Y-m-d H:i:s'));
                     $countFemale = $specimenType->groupedSpecimenCount([Patient::FEMALE], null, $from, $toPlusOne->format('Y-m-d H:i:s'));
                     $perSpecimenType[$specimenType->id] = ['countAll' => $countAll, 'countMale' => $countMale, 'countFemale' => $countFemale];
                     foreach ($ageRanges as $ageRange) {
                         $maleCount = $specimenType->groupedSpecimenCount([Patient::MALE], $ageRange, $from, $toPlusOne->format('Y-m-d H:i:s'));
                         $femaleCount = $specimenType->groupedSpecimenCount([Patient::FEMALE], $ageRange, $from, $toPlusOne->format('Y-m-d H:i:s'));
                         $perAgeRange[$specimenType->id][$ageRange] = ['male' => $maleCount, 'female' => $femaleCount];
                     }
                 }
                 return View::make('reports.counts.groupedSpecimenCount')->with('specimenTypes', $specimenTypes)->with('ageRanges', $ageRanges)->with('gender', $gender)->with('perSpecimenType', $perSpecimenType)->with('perAgeRange', $perAgeRange)->withInput(Input::all());
             } else {
                 if (strtotime($from) > strtotime($to) || strtotime($from) > strtotime($date) || strtotime($to) > strtotime($date)) {
                     Session::flash('message', trans('messages.check-date-range'));
                 }
                 $ungroupedTests = array();
                 foreach (TestType::all() as $testType) {
                     $pending = $testType->countPerStatus([Test::PENDING, Test::STARTED], $from, $toPlusOne->format('Y-m-d H:i:s'));
                     $complete = $testType->countPerStatus([Test::COMPLETED, Test::VERIFIED], $from, $toPlusOne->format('Y-m-d H:i:s'));
                     $ungroupedTests[$testType->id] = ["complete" => $complete, "pending" => $pending];
                 }
                 // $data = $data->groupBy('test_type_id')->paginate(Config::get('kblis.page-items'));
                 return View::make('reports.counts.ungroupedTestCount')->with('ungroupedTests', $ungroupedTests)->withInput(Input::all());
             }
         }
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //Get the testtype
     $testtype = TestType::find($id);
     $measures = Measure::all();
     $measuretype = MeasureType::all()->sortBy('id');
     $specimentypes = SpecimenType::orderBy('name')->get();
     $testcategory = TestCategory::all();
     $organisms = Organism::orderBy('name')->get();
     //Open the Edit View and pass to it the $testtype
     return View::make('testtype.edit')->with('testtype', $testtype)->with('testcategory', $testcategory)->with('measures', $measures)->with('measuretype', $measuretype)->with('specimentypes', $specimentypes)->with('organisms', $organisms);
 }