public function show($referen) { $empresa = Session::get('empresa'); Checklist::where('chk_referen', $referen)->delete(); $documentos = \DB::connection('master')->table('mdb_tipodocum')->select('doc_clave', 'doc_nombre')->get(); foreach ($documentos as $doc) { $result = Result::where('res_referen', $referen)->first(); if (!empty($result)) { $validacion = Validation::where('attribute_id', 9)->where('id', $result->validations_id)->whereRaw('SUBSTRING_INDEX(val_data, "|", 1) = ' . $doc->doc_clave)->count(); if ($validacion > 0) { $imagen = \DB::connection('users')->table('opauimg')->where('pk_referencia', $referen)->where('imgtipodoc', $doc->doc_clave)->count(); if ($imagen > 0) { $check = 1; } else { $check = 0; } } else { $check = 2; } } else { $check = 0; } $data = ["chk_referen" => $referen, "chk_document" => $doc->doc_nombre, "chk_status" => $check, "chk_company" => $empresa]; Checklist::create($data); } $result = Checklist::where('chk_company', $empresa)->get(); return view('list_document')->with(['document' => $result, 'referen' => $referen]); }
public function sync() { $timecard_data = Input::get('timecard_data'); $inventory_data = Input::get('inventory_data'); $positions_modified = Input::get('positions_modified'); $users_modified = Input::get('users_modified'); $timecard_modified = Input::get('timecard_modified'); $checklists_modified = Input::get('checklists_modified'); $inventory_modified = Input::get('inventory_modified'); foreach ($inventory_data as $entry) { $record = \App\Inventory::findOrFail($entry["guid"]); $record->quantity_on_hand = $entry["quantity_on_hand"]; $record->updated_at = Carbon::createFromTimestamp($entry["last_modified"], 'America/Chicago'); $record->save(); $adj = new \App\InventoryAdjustment(); $adj->inventory_id = $record->id; $adj->quantity_on_hand = $record->quantity_on_hand; $adj->save(); } $stamp = ""; foreach ($timecard_data as $entry) { $stamp = date_default_timezone_get(); $record = \App\Timecard::where('guid', $entry["guid"])->first(); if ($record) { $record->guid = $entry["guid"]; $record->clock_in = Carbon::createFromTimestamp($entry["clock_in"], 'America/Chicago'); if ($entry["clock_out"] == '0') { $record->clock_out = null; } else { $record->clock_out = Carbon::createFromTimestamp($entry["clock_out"], 'America/Chicago'); } $record->save(); } else { $record = new \App\Timecard(); $record->guid = $entry["guid"]; $record->clock_in = Carbon::createFromTimestamp($entry["clock_in"], 'America/Chicago'); if ($entry["clock_out"] == '0') { $record->clock_out = null; } else { $record->clock_out = Carbon::createFromTimestamp($entry["clock_out"], 'America/Chicago'); } $record->user_id = $entry["user_id"]; $record->position_id = $entry["position_id"]; $record->save(); } } $users_last_modified = Carbon::createFromTimestamp($users_modified)->toDateTimeString(); $users = \App\User::where('updated_at', '>', $users_last_modified)->get(); $timecard_last_modified = Carbon::createFromTimestamp($timecard_modified)->toDateTimeString(); $timecards = \App\Timecard::where('updated_at', '>', $timecard_last_modified)->get(); $positions_last_modified = Carbon::createFromTimestamp($positions_modified)->toDateTimeString(); $positions = \App\Position::withTrashed()->where('updated_at', '>', $positions_last_modified)->get(); $checklists_last_modified = Carbon::createFromTimestamp($checklists_modified)->toDateTimeString(); $checklist = \App\Checklist::withTrashed()->where('updated_at', '>', $checklists_last_modified)->get(); $inventory_last_modified = Carbon::createFromTimestamp($inventory_modified)->toDateTimeString(); $inventory = \App\Inventory::withTrashed()->where('updated_at', '>', $inventory_last_modified)->get(); return Response::json(["users" => $users, "checklist" => $checklist, "inventory" => $inventory, "timecards" => $timecards, "positions" => $positions]); }
public function storeState(Request $request) { $checklist = Checklist::where('record_id', $request->get('record_id'))->where('name', $request->get('page_id'))->first(); $patient = Record::find($request->get('record_id')); $patient->update(['update_timestamp' => date('Y-m-d')]); $update_checklist = Checklist::where('record_id', $request->get('record_id'))->where('name', $request->get('page_id'))->update(['record_id' => $request->get('record_id'), 'name' => $request->get('page_id'), 'description' => $request->get('page_name'), 'value' => $request->get('task')]); return redirect()->back()->with('message', $request->get('page_name') . ' ' . 'status was successfully updated')->with('msg_type', 'success'); }
public function destroy($id) { Checklist::destroy($id); Session::flash('flash_message', 'check eliminada!'); return redirect()->back(); }
public static function showDemographics($record_id) { $record = Record::find($record_id); if (Auth::user()->status == 'IDLE') { Auth::user()->addStatus('BCW', $record->id); } // Check if there are checklist entries for this record if (count($record->checklist) != count($record->getList())) { // Delete first all related checklist Checklist::where('record_id', $record->id)->delete(); // Generate list for this record foreach ($record->getList() as $list) { $record->checklist()->save(new Checklist($list)); } } $dispositions = Disposition::all(); $record = Record::find($record->id); // Reinstantiate.. To reflect immediately the changes in checklist return view('admin.demographics', compact('record', 'dispositions')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $checklistItem = \App\Checklist::find($id); $checklistItem->delete(); }