Esempio n. 1
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!');
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $user = \Auth::user();
     $extraction = Extraction::findOrFail($id);
     $POrecord = $extraction->POrecord;
     $POrecord->status = '';
     $POrecord->save();
     $project = $POrecord->project;
     $extraction->delete();
     return \Redirect::to('research/ngs/projects/show/' . $project->id)->with('message', 'Your Extraction has been deleted!');
 }