public function index()
 {
     return response()->json(['shipment_methods' => Shipment::all()]);
 }
Пример #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     //
     $rules = array('speices' => 'required', 'classify' => 'required', 'type' => 'required', 'condition' => 'required', 'SampleExtration' => 'required', 'ribosomalDepletion' => 'required', 'operator' => 'required', 'sender' => 'required', 'sampleNum' => 'required', 'shippingCondition' => 'required', 'salesman' => 'required_with:salesmanGetDate', 'labman' => 'required_with:labmanGetDate', 'salesmanGetDate' => 'date|required_without:labmanGetDate|required_with:salesman|before:tomorrow', 'labmanGetDate' => 'date|required_without:salesmanGetDate|required_with:labman|before:tomorrow');
     if (empty($request->get('salesmanGetDate'))) {
         $rules['sampleGetDate'] = 'required|date|before:labmanGetDate';
     } elseif (empty($request->get('labmanGetDate'))) {
         $rules['sampleGetDate'] = 'required|date|before:salesmanGetDate';
     } else {
         if ($request->get('salesmanGetDate') > $request->get('labmanGetDate')) {
             $rules['sampleGetDate'] = 'required|date|before:labmanGetDate';
         } else {
             $rules['sampleGetDate'] = 'required|date|before:salesmanGetDate';
         }
     }
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return back()->withErrors($validator)->withInput();
     }
     $extraction = Extraction::findOrFail($id);
     $extraction->update(['speices' => $request->get('speices'), 'classify' => $request->get('classify'), 'type' => $request->get('type'), 'condition' => $request->get('condition'), 'is_treatRNase' => $request->get('is_treatRNase'), 'RNAisolationMethod' => $request->get('RNAisolationMethod'), 'note' => $request->get('note'), 'SampleExtration' => $request->get('SampleExtration'), 'ribosomalDepletion' => $request->get('ribosomalDepletion'), 'operator' => $request->get('operator'), 'create_at' => $request->get('create_at')]);
     $operator = User::findOrFail($request->get('operator'));
     $extraction->operator()->associate($operator);
     $POrecord = POcase::findOrFail($request->get('POrecord_id'));
     $extraction->POrecord()->associate($POrecord);
     $Shipment = new Shipment(array('sender' => $request->get('sender'), 'sampleGetDate' => $request->get('sampleGetDate'), 'sampleNum' => $request->get('sampleNum'), 'salesman' => $request->get('salesman'), 'salesmanGetDate' => $request->get('salesmanGetDate'), 'shippingCondition' => $request->get('shippingCondition'), 'labman' => $request->get('labman'), 'labmanGetDate' => $request->get('labmanGetDate')));
     $user = User::find(\Auth::id());
     $Shipment->creater()->associate($user);
     $Shipment->extraction()->associate($extraction);
     $Shipment->save();
     $extraction->Shipment_id = $Shipment->id;
     $extraction->save();
     $POrecord->save();
     return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Extraction has been updated!');
 }
Пример #3
0
 public function storeStatus(Request $request)
 {
     //
     $qualityControl = qualityControl::find($request->get('qualityControl_id'));
     $qualityControl->update(['status' => $request->get('status'), 'status_note' => $request->get('status_note')]);
     $qualityControl->touch();
     if ($request->get('status') == '完成') {
         $selectMeasureTool = explode("|", $qualityControl->measureTool);
         $QC_Samples = QC_Samples::where('qualityControl_id', '=', $qualityControl->id)->get()->toArray();
         $POrecord = $qualityControl->POrecord;
         $customersJoinQuery = DB::table('customers')->select(DB::raw('id AS c_id'), 'institute', 'department', 'c_name', 'address');
         $usersJoinQuery = DB::table('users')->select(DB::raw('id AS u_id'), 'name');
         $project = DB::table('projects')->leftJoin(DB::raw('(' . $customersJoinQuery->toSql() . ') i'), function ($join) {
             $join->on('projects.Customer_id', '=', 'i.c_id');
         })->leftJoin(DB::raw('(' . $usersJoinQuery->toSql() . ') j'), function ($join) {
             $join->on('projects.salesman', '=', 'u_id');
         })->where('projects.id', $POrecord->project->id)->first();
         $extraction = Extraction::where('POrecord_id', '=', $POrecord->id)->first();
         $shipment = Shipment::find($extraction->shipment_id);
         $mytime = Carbon::now();
         $timeStamp = $mytime->format('Y') . $mytime->format('m') . $mytime->format('d') . $mytime->format('H') . $mytime->format('i');
         if ($qualityControl->QCtype == 'DNA') {
             $data = \View::make('research.qualityControl.dnaqc_report')->with('project', $project)->with('extraction', $extraction)->with('shipment', $shipment)->with('selectMeasureTool', $selectMeasureTool)->with('POrecord', $POrecord)->with('qualityControl', $qualityControl)->with('QC_Samples', $QC_Samples);
             $filepath = base_path() . '/storeFiles/ngs/dnaqc_report/' . $qualityControl->id . '-' . $timeStamp . '.pdf';
             $pdf = \PDF::loadHTML($data)->setPaper('a4')->setOption('disable-smart-shrinking', null)->save($filepath);
         } elseif ($qualityControl->QCtype == 'RNA') {
             $data = \View::make('research.qualityControl.rnaqc_report')->with('project', $project)->with('extraction', $extraction)->with('shipment', $shipment)->with('selectMeasureTool', $selectMeasureTool)->with('POrecord', $POrecord)->with('qualityControl', $qualityControl)->with('QC_Samples', $QC_Samples);
             $filepath = base_path() . '/storeFiles/ngs/rnaqc_report/' . $qualityControl->id . '-' . $timeStamp . '.pdf';
             if (\File::exists($filepath)) {
                 \File::delete($filepath);
             }
             $pdf = \PDF::loadHTML($data)->setPaper('a4')->setOption('disable-smart-shrinking', null)->save($filepath);
         }
     }
     return \Redirect::to('research/ngs/projects/show/' . $qualityControl->POrecord->project->id)->with('message', 'Your Quality Control has been updated!');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \App\Shipment::create(['title' => '1 hour delivery', 'description' => 'We\'ll drop by in 1 hour and deliver your package!', 'price_incl' => 6.05, 'price_excl' => 5.0, 'tax_rate' => 0.21]);
 }