public function index() { $person = new Person(); $report = new Report(); $item = new Item(); $role = session('user.role'); $data = ['total_users' => 0, 'total_report' => 0, 'total_item' => 0]; if ($role == 'U') { //get data on report and item only } else { if ($role == 'M') { $response = $person->getAssignedPersons(session('user.id')); if (!empty($response)) { //get total reports or their assigned users $data['total_users'] = $response['totalRecords']; foreach ($response['data'] as $row) { $reports = $report->getReportsByPerson($row['id']); if (!empty($reports['data'])) { $data['total_report'] += $reports['totalRecords']; //get item of the report foreach ($reports['data'] as $srow) { $items = $item->getItemsByReport($srow['id']); $data['total_item'] += $items['totalRecords']; } } } //get current user's report $response = $report->getReportsByPerson(session('user.id')); if (!empty($response['data'])) { $data['total_report'] += $response['totalRecords']; //get item of the report foreach ($response['data'] as $row) { $items = $item->getItemsByReport($row['id']); $data['total_item'] += $items['totalRecords']; } } } } else { //admin $response = $person->all([]); if (!empty($response)) { //get total reports or their assigned users $data['total_users'] = $response['totalRecords']; foreach ($response['data'] as $row) { $reports = $report->getReportsByPerson($row['id']); if (isset($reports['data']) && !empty($reports['data'])) { $data['total_report'] += $reports['totalRecords']; //get item of the report foreach ($reports['data'] as $srow) { $items = $item->getItemsByReport($srow['id']); $data['total_item'] += $items['totalRecords']; } } } } } } return view('dashboard', $data); }
/** * @param Request $request * @return mixed */ public function store(Request $request) { $data = $request->json()->all(); $report = new Report(); $report->shortdesc = $data['shortdesc']; $report->description = $data['description']; $report->area = $data['area']; $report->save(); }
public function getResultsTable(Report $report) { $rawResults = Result::whereHas('report', function ($query) use($report) { $query->where('id', $report->id); })->get(); $headers = array('indicators' => array(), 'components' => array()); foreach ($report['indicators'] as $indicator) { array_push($headers['indicators'], array('name' => $indicator->name, 'description' => $indicator->description, 'visible' => $indicator->pivot->show_value || $indicator->pivot->show_points, 'colspan' => $indicator->pivot->show_value && $indicator->pivot->show_points ? 2 : 1)); array_push($headers['components'], array('id' => $indicator->id, 'type' => 'value', 'displayName' => 'Wartość', 'visible' => $indicator->pivot->show_value)); array_push($headers['components'], array('id' => $indicator->id, 'type' => 'points', 'displayName' => 'Punkty', 'visible' => $indicator->pivot->show_points)); } $results = []; $resultsByIndicator = []; foreach ($rawResults as $result) { $userId = $result->user_id; if (!array_key_exists($userId, $results)) { $results[$userId] = array('displayName' => $result->user->name . ' ' . $result->user->surname, 'indicators' => [], 'sum' => 0); } $indicatorId = $result->indicator_id; $results[$userId]['indicators'][$indicatorId] = array('value' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_value, 'data' => $result->value), 'points' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_points, 'data' => $result->points)); if ($report->indicators()->find($indicatorId)->pivot->show_points) { $results[$userId]['sum'] += $result->points; } // results by indicator if (!array_key_exists($indicatorId, $resultsByIndicator)) { $resultsByIndicator[$indicatorId] = []; } $resultsByIndicator[$indicatorId][$userId] = $result; } $results = array_values($results); $statistics = array('min' => array('indicators' => [], 'sum' => min(array_map(function ($user) { return $user['sum']; }, $results))), 'max' => array('indicators' => [], 'sum' => max(array_map(function ($user) { return $user['sum']; }, $results))), 'avg' => array('indicators' => [], 'sum' => array_sum(array_map(function ($user) { return $user['sum']; }, $results)) / count($results))); foreach ($resultsByIndicator as $indicatorId => $indicatorResults) { $statistics['min']['indicators'][$indicatorId] = array('value' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_value, 'data' => min(array_map(function ($result) { return $result->value; }, $indicatorResults))), 'points' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_points, 'data' => min(array_map(function ($result) { return $result->points; }, $indicatorResults)))); $statistics['max']['indicators'][$indicatorId] = array('value' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_value, 'data' => max(array_map(function ($result) { return $result->value; }, $indicatorResults))), 'points' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_points, 'data' => max(array_map(function ($result) { return $result->points; }, $indicatorResults)))); $statistics['avg']['indicators'][$indicatorId] = array('value' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_value, 'data' => array_sum(array_map(function ($result) { return $result->value; }, $indicatorResults)) / count($indicatorResults)), 'points' => array('visible' => $report->indicators()->find($indicatorId)->pivot->show_points, 'data' => array_sum(array_map(function ($result) { return $result->value; }, $indicatorResults)) / count($indicatorResults))); } return array('headers' => $headers, 'results' => $results, 'statistics' => $statistics); }
/** * Execute the job. * * @return void */ public function handle(GitHubManager $github) { $github->authenticate($this->user->token, 'http_token'); $issues = new Collection(); foreach ($this->issues as $issue) { $i = explode('/', $issue); $issues->push((object) $github->issues()->show($i[0], $i[1], $i[2])); } if ($report = Report::findByUser($this->user)) { $report->issues = array_merge($report->issues, $issues); } else { $report = new Report(['user_id' => $this->user->id, 'issues' => $issues->sortByDesc('number')]); } return $report->save(); }
/** * Display a report for the given phone number. * @param Int $number * @return \Illuminate\Http\Response */ public function phoneNumbers($number) { $dates = $this->retrieveDates(); $report = Report::generateAllCalls($number, $dates); $data = ['report' => $report, 'dates' => $this->formatDates()]; return view('report.phone_numbers', $data); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $notify_report = false; for ($i = 0; $i < count($request->all()); $i++) { if ($request->input($i . '.include')) { $this->validate($request, [$i . '.id' => 'required', $i . '.member.id' => 'required|numeric', $i . '.position_id' => 'required|numeric', $i . '.project_id' => 'required|numeric', $i . '.target_id' => 'required|numeric', $i . '.output' => 'required|numeric', $i . '.date_start' => 'required|date', $i . '.date_end' => 'required|date', $i . '.hours_worked' => 'required|numeric', $i . '.daily_work_hours' => 'required|numeric', $i . '.output_error' => 'required|numeric']); // check if a report is already created if (!$notify_report) { $admin = User::where('role', 'admin')->first(); $report = Report::where('id', $request->input($i . '.report_id'))->first(); // create a notification $notification = new Notification(); $notification->message = 'updated a '; $notification->sender_user_id = $request->user()->id; $notification->receiver_user_id = $admin->id; $notification->subscriber = 'admin'; $notification->state = 'main.weekly-report'; $notification->event_id = $report->id; $notification->event_id_type = 'report_id'; $notification->seen = false; $notification->save(); $notify = DB::table('reports')->join('users', 'users.id', '=', 'reports.user_id')->join('projects', 'projects.id', '=', 'reports.project_id')->join('notifications', 'notifications.event_id', '=', 'reports.id')->select('reports.*', 'users.*', DB::raw('LEFT(users.first_name, 1) as first_letter'), 'projects.*', 'notifications.*')->where('notifications.id', $notification->id)->first(); // foreach ($query as $key => $value) { // $notify = $value; // } event(new ReportSubmittedBroadCast($notify)); $activity_type = ActivityType::where('action', 'update')->first(); $activity = new Activity(); $activity->report_id = $report->id; $activity->user_id = $request->user()->id; $activity->activity_type_id = $activity_type->id; $activity->save(); // report $create_report = true; } $old_performance = Performance::where('id', $request->input($i . '.id'))->first(); // record history of the performance $performance_history = new PerformanceHistory(); $performance_history->activity_id = $activity->id; $performance_history->performance_id = $old_performance->id; $performance_history->report_id = $old_performance->report_id; $performance_history->member_id = $old_performance->member_id; $performance_history->position_id = $old_performance->position_id; $performance_history->department_id = $old_performance->department_id; $performance_history->project_id = $old_performance->project_id; $performance_history->target_id = $old_performance->target_id; $performance_history->date_start = $old_performance->date_start; $performance_history->date_end = $old_performance->date_end; $performance_history->daily_work_hours = $old_performance->daily_work_hours; $performance_history->output = $old_performance->output; $performance_history->hours_worked = $old_performance->hours_worked; $performance_history->output_error = $old_performance->output_error; $performance_history->average_output = $old_performance->average_output; $performance_history->productivity = $old_performance->productivity; $performance_history->quality = $old_performance->quality; $performance_history->quadrant = $old_performance->quadrant; $performance_history->save(); } } }
public function isDoctorVisited($doctorId, $date) { $visited = Report::where('mr_id', \Auth::user()->id)->where('doctor_id', $doctorId)->where('date', '>=', $date)->count(); if ($visited > 0) { return true; } }
public function doSearch(SalesSearchRequest $request) { $searchResult = []; $from = $request->date_from; $to = $request->date_to; $products = $request->products; $MRs = $request->mrs; $allSearchedReport = Report::select('sold_products')->where('date', '>=', $from)->where('date', '<=', $to)->whereIn('mr_id', $MRs)->where('sold_products', '<>', 'NULL')->get(); foreach ($allSearchedReport as $singleReport) { foreach (json_decode($singleReport) as $soldProducts) { foreach (json_decode($soldProducts) as $singleProduct => $quantity) { $productName = Product::findOrFail($singleProduct)->name; if (in_array($singleProduct, $products)) { if (isset($searchResult[$productName])) { $searchResult[$productName] += $quantity; } else { $searchResult[$productName] = $quantity; } } } } } $dataView = ['searchResult' => $searchResult]; return view('am.search.sales.result', $dataView); }
public function doSearch(SalesSearchRequest $request) { $productSales = []; $from = date('Y-m-d', strtotime($request->date_from)); $to = date('Y-m-d', strtotime($request->date_to)); $product = $request->product; $doctor = $request->doctor; $allSearchedReport = Report::select('id')->where('date', '>=', $from)->where('date', '<=', $to); if (!empty($MR)) { $allSearchedReport = $allSearchedReport->where('mr_id', \Auth::user()->id); } if (!empty($doctor)) { $allSearchedReport = $allSearchedReport->where('doctor_id', $doctor); } $searchResult = ReportSoldProduct::whereIn('report_id', $allSearchedReport->get()); if (!empty($product)) { $searchResult->where('product_id', $product); } foreach ($searchResult->get() as $singleResult) { if (isset($productSales[$singleResult->product->name])) { $productSales[$singleResult->product->name] += $singleResult->quantity; } else { $productSales[$singleResult->product->name] = $singleResult->quantity; } } $dataView = ['searchResult' => $productSales]; \Session::flash('date_from', $from); \Session::flash('date_to', $to); \Session::flash('productSales', $productSales); return view('mr.search.sales.result', $dataView); }
public function single($mr, $currentMonth) { $actualVisits = []; $MonthlyCustomerProducts = []; $MRLine = []; $doctors = Customer::where('mr_id', $mr)->get(); foreach ($doctors as $singleDoctor) { $actualVisits[$singleDoctor->id] = Report::where('mr_id', $mr)->where('month', $currentMonth)->where('doctor_id', $singleDoctor->id)->count(); $MonthlyCustomerProducts[$singleDoctor->id] = Customer::monthlyProductsBought([$singleDoctor->id])->toArray(); } $products = Product::where('line_id', Employee::findOrFail($mr)->line_id)->get(); $coverageStats = Employee::coverageStats($mr, $currentMonth); $allManagers = Employee::yourManagers($mr); $totalProducts = Employee::monthlyDirectSales($mr, $currentMonth); $totalSoldProductsSales = $totalProducts['totalSoldProductsSales']; $totalSoldProductsSalesPrice = $totalProducts['totalSoldProductsSalesPrice']; $currentMonth = \Carbon\Carbon::parse($currentMonth); $lines = MrLines::select('line_id', 'from', 'to')->where('mr_id', $mr)->get(); foreach ($lines as $line) { $lineFrom = \Carbon\Carbon::parse($line->from); $lineTo = \Carbon\Carbon::parse($line->to); if (!$currentMonth->lte($lineTo) && $currentMonth->gte($lineFrom)) { $MRLine = MrLines::where('mr_id', $mr)->where('line_id', $line->line_id)->get(); } } $dataView = ['doctors' => $doctors, 'MonthlyCustomerProducts' => $MonthlyCustomerProducts, 'actualVisits' => $actualVisits, 'products' => $products, 'totalVisitsCount' => $coverageStats['totalVisitsCount'], 'actualVisitsCount' => $coverageStats['actualVisitsCount'], 'totalMonthlyCoverage' => $coverageStats['totalMonthlyCoverage'], 'allManagers' => $allManagers, 'totalSoldProductsSales' => $totalSoldProductsSales, 'totalSoldProductsSalesPrice' => $totalSoldProductsSalesPrice, 'MRLines' => $MRLine]; return view('am.line.single', $dataView); }
public static function transformMany($reports) { foreach ($reports as $k => $v) { $reports[$k] = Report::transform($v); } return $reports; }
public function project($report_id) { $report = Report::where('id', $report_id)->first(); $project = DB::table('projects')->where('id', $report->project_id)->first(); $project->positions = DB::table('positions')->where('project_id', $report->project_id)->get(); $project->beginner_productivity = array(); $project->moderately_experienced_productivity = array(); $project->experienced_productivity = array(); $project->beginner_quality = array(); $project->moderately_experienced_quality = array(); $project->experienced_quality = array(); foreach ($project->positions as $key => $value) { /* Productivity */ $beginner_productivity_query = Target::where('position_id', $value->id)->where('type', 'Productivity')->where('experience', 'Beginner')->where('created_at', '<=', $report->date_end)->orderBy('created_at', 'desc')->first(); if ($beginner_productivity_query) { $beginner_productivity = $beginner_productivity_query->value; } else { $beginner_productivity = Target::where('position_id', $value->id)->where('type', 'Productivity')->where('experience', 'Beginner')->orderBy('created_at', 'desc')->first()->value; } $moderately_experienced_productivity_query = Target::where('position_id', $value->id)->where('type', 'Productivity')->where('experience', 'Moderately Experienced')->where('created_at', '<=', $report->date_end)->orderBy('created_at', 'desc')->first(); if ($moderately_experienced_productivity_query) { $moderately_experienced_productivity = $moderately_experienced_productivity_query->value; } else { $moderately_experienced_productivity = Target::where('position_id', $value->id)->where('type', 'Productivity')->where('experience', 'Moderately Experienced')->orderBy('created_at', 'desc')->first()->value; } $experienced_productivity_query = Target::where('position_id', $value->id)->where('type', 'Productivity')->where('experience', 'Experienced')->where('created_at', '<=', $report->date_end)->orderBy('created_at', 'desc')->first(); if ($experienced_productivity_query) { $experienced_productivity = $experienced_productivity_query->value; } else { $experienced_productivity = Target::where('position_id', $value->id)->where('type', 'Productivity')->where('experience', 'Experienced')->orderBy('created_at', 'desc')->first()->value; } /* Quality */ $beginner_quality_query = Target::where('position_id', $value->id)->where('type', 'Quality')->where('experience', 'Beginner')->where('created_at', '<=', $report->date_end)->orderBy('created_at', 'desc')->first(); if ($beginner_quality_query) { $beginner_quality = $beginner_quality_query->value; } else { $beginner_quality = Target::where('position_id', $value->id)->where('type', 'Quality')->where('experience', 'Beginner')->orderBy('created_at', 'desc')->first()->value; } $moderately_experienced_quality_query = Target::where('position_id', $value->id)->where('type', 'Quality')->where('experience', 'Moderately Experienced')->where('created_at', '<=', $report->date_end)->orderBy('created_at', 'desc')->first(); if ($moderately_experienced_quality_query) { $moderately_experienced_quality = $moderately_experienced_quality_query->value; } else { $moderately_experienced_quality = Target::where('position_id', $value->id)->where('type', 'Quality')->where('experience', 'Moderately Experienced')->orderBy('created_at', 'desc')->first()->value; } $experienced_quality_query = Target::where('position_id', $value->id)->where('type', 'Quality')->where('experience', 'Experienced')->where('created_at', '<=', $report->date_end)->orderBy('created_at', 'desc')->first(); if ($experienced_quality_query) { $experienced_quality = $experienced_quality_query->value; } else { $experienced_quality = Target::where('position_id', $value->id)->where('type', 'Quality')->where('experience', 'Experienced')->orderBy('created_at', 'desc')->first()->value; } array_push($project->beginner_productivity, $beginner_productivity); array_push($project->moderately_experienced_productivity, $moderately_experienced_productivity); array_push($project->experienced_productivity, $experienced_productivity); array_push($project->beginner_quality, $beginner_quality); array_push($project->moderately_experienced_quality, $moderately_experienced_quality); array_push($project->experienced_quality, $experienced_quality); } return response()->json($project); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // $data['fee'] = $request->get('fee'); $data['flag_id'] = 2; Report::find($id)->update($data); return back(); }
public function createReport() { $validator = \Validator::make(\Input::all(), array('phone_number' => 'required', 'message' => 'required', 'category' => 'required', 'mobile_network' => 'required')); if ($validator->fails()) { return \Response::json(['data' => $validator->messages()], 403); } else { $report = Report::create(\Input::all()); return Report::find($report->id); } }
public function singleReport($id, $type) { $singleReport = Report::findOrFail($id); \Excel::create('report-' . $singleReport->date, function ($excel) use($singleReport) { $excel->sheet('report', function ($sheet) use($singleReport) { $sheet->setAllBorders('thin'); $sheet->loadView('mr.export.single_report')->with('singleReport', $singleReport); }); })->export($type); }
public function run() { DB::table('reporttrackers')->delete(); $users = User::where('app', 'staff')->where('role_id', '!=', 20)->get(); $reports = Report::where('is_required', 1)->get(); for ($u = 3; $u < count($users); $u++) { for ($r = 1; $r < count($reports); $r++) { Reporttracker::create(['report_id' => $r, 'user_id' => $u, 'cnt_warned' => rand(0, 15), 'cnt_alerted' => rand(0, 15), 'made_required' => Carbon::now()->subDay(rand(11, 140)), 'last_acknowledged' => Carbon::now()->subDay(rand(0, 10))]); } } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Report::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
/** * Creates an excel document with a report of all numbers called * and account codes used. */ public function report() { Excel::create(time() . '_report', function ($excel) { $excel->sheet('persons', function ($sheet) { $dates = self::retrieveDates(); $persons = Report::getAccountCodesUsed($dates); $sheet->fromArray($persons); }); $excel->sheet('numbers', function ($sheet) { $dates = self::retrieveDates(); $numbers = Report::getNumbersCalled($dates); $sheet->fromArray($numbers); }); })->export('xlsx'); }
public function getDashboard() { $reports = new Report(); $totalProducts = $reports->getTotalProducts(); $totalImports = $reports->getTotalImports(); $totalSales = $reports->getTotalSalesToday(); $totalPurchase = $reports->getTotalPurchaseToday(); $accountsBalance = $reports->getAccountBalances(); $accountBalanceTransfers = $reports->getBalanceTransferFullReport(); $stocksBranch = $reports->getStocksBranch(); $stockRequisitions = StockRequisition::orderBy('id', 'desc')->take(3)->get(); $latestTransactions = Transaction::orderBy('id', 'desc')->take(5)->get(); $register = Transaction::where('payment_method', '=', 'check')->where('type', '=', 'Receive')->where('cheque_status', '=', 0)->orderBy('id', 'desc')->get(); $purchaseregister = Transaction::where('payment_method', '=', 'check')->where('type', '=', 'Payment')->where('cheque_status', '=', 0)->orwhere('type', '=', 'Expense')->where('cheque_status', '=', 0)->orderBy('id', 'desc')->get(); //var_dump($stockRequisitions); return view('Users.dashboard')->with('latestTransactions', $latestTransactions)->with('totalProducts', $totalProducts)->with('totalSales', $totalSales)->with('stockRequisitions', $stockRequisitions)->with('stocksBranch', $stocksBranch)->with('accountsBalance', $accountsBalance)->with('accountBalanceTransfers', $accountBalanceTransfers)->with('totalPurchase', $totalPurchase)->with('totalImports', $totalImports)->with('register', $register)->with('purchaseregister', $purchaseregister); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('reports', function (Blueprint $table) { $table->string('board_uri', 32)->nullable()->change(); }); Report::with('post')->chunk(100, function ($reports) { foreach ($reports as $report) { $report->board_uri = $report->global ? null : $report->post->board_uri; $report->save(); } }); Schema::table('reports', function (Blueprint $table) { $table->dropColumn('global'); }); }
public function singleReport($level, $id, $type) { if ($level == 'sm') { $singleReport = SMReport::findOrFail($id); } elseif ($level == 'am') { $singleReport = AMReport::findOrFail($id); } elseif ($level == 'mr') { $singleReport = Report::findOrFail($id); } \Excel::create('report-' . $level . '-' . $singleReport->emp->name . '-' . $singleReport->date, function ($excel) use($singleReport) { $excel->sheet('report', function ($sheet) use($singleReport) { $sheet->setAllBorders('thin'); $sheet->loadView('admin.export.single_report')->with('singleReport', $singleReport); }); })->export($type); }
public function run() { DB::table('reports')->delete(); Report::create(['report' => 'Activity Detail', 'rptPath' => 'actdet', 'is_required' => 1]); Report::create(['report' => 'Customer Budget', 'rptPath' => 'cusbud', 'is_required' => 1]); Report::create(['report' => 'Account Reconcilliation', 'rptPath' => 'accrecon', 'is_required' => 1]); Report::create(['report' => 'Loan Management', 'rptPath' => 'lnman', 'is_required' => 0]); /* Revenue Summary Report */ Report::create(['report' => 'Activity Summary', 'rptPath' => 'actsum', 'is_required' => 0]); Report::create(['report' => 'Available Credit', 'rptPath' => 'avcred', 'is_required' => 0]); Report::create(['report' => 'Cash Flow & (Risk)/Margin', 'rptPath' => 'cfarm', 'is_required' => 0]); Report::create(['report' => 'Farmer History', 'rptPath' => 'fmrhis', 'is_required' => 0]); Report::create(['report' => 'Crop Mix', 'rptPath' => 'crpmix', 'is_required' => 1]); Report::create(['report' => 'Committee Approval', 'rptPath' => 'comapp', 'is_required' => 0]); Report::create(['report' => 'Committee Comment', 'rptPath' => 'comcom', 'is_required' => 0]); Report::create(['report' => 'Audit Trail', 'rptPath' => 'usradt', 'is_required' => 0]); }
public function report(Request $request) { $data = []; $data['code'] = 200; $validator = Validator::make($request->all(), ['district' => 'required', 'municipality' => 'required', 'candidate' => 'required', 'message' => 'required', 'file' => 'required']); if ($validator->fails()) { $data['code'] = 403; $data['errors'] = $validator->errors()->first(); return response()->json($data); } $file_filename = ''; $file_filename .= str_random(20) . '.' . $request->file->getClientOriginalExtension(); $destinationPath = public_path('uploads/'); $request->file->move($destinationPath, $file_filename); $report = Report::create(['district' => $request->district, 'municipality' => $request->municipality, 'candidate' => $request->candidate, 'message' => $request->message, 'file' => $file_filename]); $data['results'] = $report; return response()->json($data); }
public function doSearch(CoverageSearchRequest $request) { $searchResult = null; $from = $request->date_from; $to = $request->date_to; $MR = $request->mr; $class = $request->class; $specialty = $request->specialty; $allReportsInRange = Report::where('date', '>=', $from)->where('date', '<=', $to)->where('report.mr_id', $MR); if (!empty($class)) { $allReportsInRange->join('customer', 'report.doctor_id', '=', 'customer.id')->where('class', $class); } if (!empty($specialty)) { $allReportsInRange->where('specialty', $specialty); } $searchResult = $allReportsInRange->get(); $dataView = ['searchResult' => $searchResult]; return view('sm.search.coverage.result', $dataView); }
/** * Execute the console command. * * @return mixed */ public function handle() { // $employees = Employee::all(); $rules = ['employee_id' => 'unique_with:reports,months']; foreach ($employees as $employees) { // $report=new Report(); $report['employee_id'] = $employees->id; // $report['months']='2015-08-01'; $report['months'] = Carbon::now()->firstOfMonth(); $report['months_string'] = $report['months']; $report['fee'] = 0; $report['flag_id'] = 1; $v = \Validator::make($report, $rules); if ($v->fails()) { } else { $r = Report::create($report); } } }
public function update(Request $request, $id) { $report = Report::find($id); $report->user_id = $request->user_id; $report->student_id = $request->student_id; $report->category_id = $request->category_id; $report->class01 = $request->class01; $report->class02 = $request->class02; $report->class03 = $request->class03; $report->class04 = $request->class04; $report->class05 = $request->class05; $report->class06 = $request->class06; $report->class07 = $request->class07; $report->class08 = $request->class08; $report->class09 = $request->class09; $report->class10 = $request->class10; $report->class11 = $request->class11; $report->class12 = $request->class12; $report->class13 = $request->class13; $report->class14 = $request->class14; $report->class15 = $request->class15; $report->class16 = $request->class16; $report->class17 = $request->class17; $report->class18 = $request->class18; $report->class19 = $request->class19; $report->class20 = $request->class20; $report->class21 = $request->class21; $report->class22 = $request->class22; $report->class23 = $request->class23; $report->class24 = $request->class24; $report->class25 = $request->class25; $report->class26 = $request->class26; $report->class27 = $request->class27; $report->class28 = $request->class28; $report->class29 = $request->class29; $report->class30 = $request->class30; $report->save(); return view('reports.index')->with('report', $report); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::table('results')->delete(); $faker = Faker::create(); foreach (Report::all() as $report) { $coefficients = array(); $organizationIndicators = $report->owner->organization->indicators; foreach ($organizationIndicators as $organizationIndicator) { $coefficients[$organizationIndicator->id] = $organizationIndicator->pivot->coefficient; } foreach ($report->users as $user) { foreach ($report->indicators as $indicator) { $value = $indicator->type == 'value' ? $faker->randomNumber(3) : $faker->randomFloat(3, 0, 1); $points = $value * $coefficients[$indicator->id]; Result::create(['report_id' => $report->id, 'user_id' => $user->id, 'indicator_id' => $indicator->id, 'value' => $value, 'points' => $points]); } $report->evaluated_at = Carbon::now(); $report->save(); } } Model::reguard(); }
public function ReportsDate(Request $request) { if ($request->ajax()) { $date = date('Y-m-d', strtotime($request->input('date'))); $todate = date('Y-m-d', strtotime($request->input('todate'))); $idad = $request->input('ad'); $idweb = $request->input('web'); if ($idad == 0) { if ($idweb == 'all') { if ($request->ajax()) { $reports = Report::TimeReport($date, $todate); return response()->json(["web" => $reports]); } } else { if ($request->ajax()) { if ($idad == 'all') { if ($request->ajax()) { $reports = Report::TimeReport($date, $todate); return response()->json(["web" => $reports]); } } else { $ad = Web::find($idweb); $reports = Report::ReportTime($date, $todate, $ad->id); return response()->json(["web" => $reports]); } } } } else { if ($idad == 'all' || $idweb == 'all') { if ($request->ajax()) { $reports = Report::TimeReport($date, $todate); return response()->json(["web" => $reports]); } } else { if ($request->ajax()) { $ad = Ad::find($idad); $web = Web::find($idweb); $reports = Report::TimeReportComplete($date, $todate, $ad->id, $web->id); return response()->json(["web" => $reports]); } } } } }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('bans', function (Blueprint $table) { $table->string('ban_ip', 46)->after('ban_ip_end'); }); Schema::table('posts', function (Blueprint $table) { $table->string('author_ip_string', 46)->after('author_ip'); }); Schema::table('reports', function (Blueprint $table) { $table->string('ip', 46)->after('reporter_ip'); }); Ban::chunk(100, function ($bans) { foreach ($bans as $ban) { $ban->ban_ip_start = inet_ntop($ban->ban_ip); $ban->ban_ip_end = inet_ntop($ban->ban_ip); $ban->save(); } }); Post::withTrashed()->chunk(100, function ($posts) { foreach ($posts as $post) { $post->author_ip_string = null; if (!is_null($post->author_ip)) { $post->author_ip_string = inet_ntop($post->author_ip); } $post->save(); } }); Report::chunk(100, function ($reports) { foreach ($reports as $report) { $report->ip = inet_ntop($report->reporter_ip); $report->save(); } }); Schema::table('bans', function (Blueprint $table) { $table->dropColumn('ban_ip_start', 'ban_ip_end'); }); Schema::table('posts', function (Blueprint $table) { $table->dropColumn('author_ip'); }); Schema::table('posts', function (Blueprint $table) { $table->renameColumn('author_ip_string', 'author_ip'); }); Schema::table('reports', function (Blueprint $table) { $table->dropColumn('reporter_ip'); }); }
public function reports() { return view('admin.main')->with('reports', Report::all()); }