Exemple #1
0
 public function store(Request $request)
 {
     if (Auth::check()) {
         $staff_id = Auth::user()->id;
         $sfname = Auth::user()->fname;
         $slname = Auth::user()->lname;
     } else {
         return redirect('auth/login');
     }
     $inquiry_id = $request->input('inquiry_id');
     $datedoc = Carbon::now(-6);
     $yr = $datedoc->year;
     $mo = $datedoc->month;
     $dom = $datedoc->day;
     $doy = $datedoc->dayOfYear;
     $ice = new Ice();
     $ice->fname = $request->input('fname');
     $ice->lname = $request->input('lname');
     $ice->callerfname = $request->input('callerfname');
     $ice->callerlname = $request->input('callerlname');
     $ice->staff_id = $staff_id;
     $ice->sfname = $sfname;
     $ice->slname = $slname;
     $ice->isalias = 0;
     //$ice->aliasfname = "";
     // $ice->aliaslname = "";
     $ice->poc = $request->input('poc');
     $ice->precipevent = $request->input('precipevent');
     $ice->inquiry_id = $inquiry_id;
     $ice->dob = $request->input('dob');
     $ice->callerhphone = $request->input('callerhphone');
     $ice->callercphone = $request->input('callercphone');
     $ice->hphone = $request->input('hphone');
     $ice->cphone = $request->input('cphone');
     $morechks = array('eie', 'dss');
     foreach ($morechks as $morechk) {
         $ice->setAttribute($morechk, Input::has($morechk) ? true : false);
     }
     $ice->client_id = 0;
     // need to make this populate from ICE.
     $ice->datedoc = $datedoc;
     $ice->mrn = 0;
     $ice->mo = $mo;
     $ice->dom = $dom;
     $ice->yr = $yr;
     $ice->doy = $doy;
     $ice->save();
     $episode_id = $ice->id;
     return redirect()->route('inquiryview', $inquiry_id);
 }
Exemple #2
0
 public function store(Request $request)
 {
     if (Auth::check()) {
         $staff_id = Auth::user()->id;
         $sfname = Auth::user()->fname;
         $slname = Auth::user()->lname;
     } else {
         return redirect('auth/login');
     }
     $datedoc = Carbon::now(-6);
     $yr = $datedoc->year;
     $mo = $datedoc->month;
     $dom = $datedoc->day;
     $doy = $datedoc->dayOfYear;
     //==== first we are going to create the record in ice in order to get the episode id
     $fname = $request->input('fname');
     $lname = $request->input('lname');
     $existingcount = DB::table('inquiries')->where('eie', '!=', '1')->where('fname', '=', $fname)->where('lname', '=', $lname)->count();
     if ($existingcount > 0) {
         return redirect()->back()->withInput()->with('status', 'There is already an Inquiry using this name!');
     }
     $ice = new Ice();
     $ice->fname = $request->input('fname');
     $ice->lname = $request->input('lname');
     $ice->callerfname = $request->input('callerfname');
     $ice->callerlname = $request->input('callerlname');
     $ice->staff_id = $staff_id;
     $ice->sfname = $sfname;
     $ice->slname = $slname;
     $ice->isalias = 0;
     //$ice->aliasfname = "";
     // $ice->aliaslname = "";
     $ice->poc = $request->input('poc');
     $ice->precipevent = $request->input('precipevent');
     $ice->dob = $request->input('dob');
     $ice->callerhphone = $request->input('callerhphone');
     $ice->callercphone = $request->input('callercphone');
     $ice->hphone = $request->input('hphone');
     $ice->cphone = $request->input('cphone');
     $morechks = array('eie', 'dss');
     foreach ($morechks as $morechk) {
         $ice->setAttribute($morechk, Input::has($morechk) ? true : false);
     }
     $ice->client_id = 0;
     // need to make this populate from ICE.
     $ice->datedoc = $datedoc;
     $ice->mrn = 0;
     $ice->mo = $mo;
     $ice->dom = $dom;
     $ice->yr = $yr;
     $ice->doy = $doy;
     $ice->save();
     $episode_id = $ice->id;
     //================
     $inquiry = new Inquiry();
     $inquiry->fname = $request->input('fname');
     $inquiry->lname = $request->input('lname');
     $inquiry->callerfname = $request->input('callerfname');
     $inquiry->callerlname = $request->input('callerlname');
     $inquiry->staff_id = $staff_id;
     $inquiry->sfname = $sfname;
     $inquiry->slname = $slname;
     $inquiry->isalias = 0;
     //$inquiry->aliasfname = "";
     //  $inquiry->aliaslname = "";
     $inquiry->poc = $request->input('poc');
     $inquiry->precipevent = $request->input('precipevent');
     $inquiry->dob = $request->input('dob');
     $inquiry->callerhphone = $request->input('callerhphone');
     $inquiry->callercphone = $request->input('callercphone');
     $inquiry->hphone = $request->input('hphone');
     $inquiry->cphone = $request->input('cphone');
     $morechks = array('eie', 'dss');
     foreach ($morechks as $morechk) {
         $inquiry->setAttribute($morechk, Input::has($morechk) ? true : false);
     }
     $inquiry->client_id = 0;
     // need to make this populate from ICE.
     $inquiry->episode_id = $episode_id;
     $inquiry->datedoc = $datedoc;
     $inquiry->mrn = 0;
     $inquiry->recordstatus_id = 1;
     //we'll say that one means active.
     $inquiry->mo = $mo;
     $inquiry->dom = $dom;
     $inquiry->yr = $yr;
     $inquiry->doy = $doy;
     $inquiry->save();
     $inquiry_id = $inquiry->id;
     $updateresult = DB::table('ice')->where('id', '=', $episode_id)->update(['inquiry_id' => $inquiry_id]);
     return redirect()->route('inquiryview', $inquiry_id);
     //return view('inquiry/index')->with('inquiry',$inquiry);
 }