public function destroy($id) { $issues = Issue::where('registration_id', '=', $id)->delete(); $placements = Placement::where('registration_id', '=', $id)->delete(); $receivables = Receivable::where('registration_id', '=', $id)->get(); foreach ($receivables as $receivable) { $installments = Installment::where('receivable_id', '=', $receivable->id)->get(); foreach ($installments as $installment) { $earnings = Earning::where('earnable_type', '=', 'Installment')->where('earnable_id', '=', $installment->id)->get(); foreach ($earnings as $earning) { $earning->delete(); } $installment->delete(); } $earnings = Earning::where('earnable_type', '=', 'Receivable')->where('earnable_id', '=', $receivable->id)->delete(); $reductions = Reduction::where('receivable_id', '=', $receivable->id)->delete(); $receivable->delete(); } Registration::destroy($id); Session::flash('message', 'Sukses membatalkan Pendaftaran!, Semua Data terkait pendaftaran ini telah dihapus!'); }
public function placement($primary = false) { $where = "placement_entry_id = " . $this->id; if ($primary) { $where .= " and placement_is_primary = 1"; } require_once 'class.mt_placement.php'; $place = new Placement(); $places = $place->Find($where); return $places; }
public function showDashboard() { $menu = ''; $_301 = Issue::where('generation_id', '=', 1)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_201 = Issue::where('generation_id', '=', 2)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_101 = Issue::where('generation_id', '=', 3)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_302 = Issue::where('generation_id', '=', 4)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_202 = Issue::where('generation_id', '=', 5)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_102 = Issue::where('generation_id', '=', 6)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_603 = Issue::where('generation_id', '=', 7)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_503 = Issue::where('generation_id', '=', 8)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_403 = Issue::where('generation_id', '=', 9)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $last_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '<>', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count(); $curr_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '=', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count(); $movement_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 10)->count(); $curr_active_students = Placement::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('active', '=', 1)->count(); $curr_do_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 13)->count(); $curr_resign_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 14)->count(); $curr_relocate_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 15)->count(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); return View::make('dashboard.home', compact('_301', '_201', '_101', '_302', '_202', '_102', '_603', '_503', '_403', 'last_month_registrations', 'curr_month_registrations', 'movement_registrations', 'curr_active_students', 'curr_do_students', 'curr_resign_students', 'curr_relocate_students', 'courses', 'menu')); }
public function normalizeIssue() { $issues = Issue::all(); foreach ($issues as $issue) { // Normalize Educations $educations = Education::where('student_id', '=', $issue->student_id)->get(); foreach ($educations as $education) { $education->student_id = $issue->id; $education->save(); } // Normalize Placements $placements = Placement::where('student_id', '=', $issue->student_id)->get(); foreach ($placements as $placement) { $placement->student_id = $issue->id; $placement->save(); } // Normalize Receivables $receivables = Receivable::where('student_id', '=', $issue->student_id)->get(); foreach ($receivables as $receivable) { $receivable->student_id = $issue->id; $receivable->save(); } } }
public function toPlace(Placement $placement) { $this->x = $placement->getX(); $this->y = $placement->getY(); }
public function cache_categories($entry_list) { $ids = null; foreach ($entry_list as $entry_id) { if (!isset($this->_cat_id_cache['e' . $entry_id])) { $ids[] = $entry_id; } $this->_cat_id_cache['e' . $entry_id] = null; } if (empty($ids)) { return; } $id_list = implode(",", $ids); if (empty($id_list)) { return; } $where = "placement_entry_id in ({$id_list})\n and placement_is_primary = 1"; $extras['join'] = array('mt_category' => array('condition' => "placement_category_id = category_id")); require_once 'class.mt_placement.php'; $placement = new Placement(); $rows = $placement->Find($where, false, false, $extras); if (!empty($rows)) { foreach ($rows as $row) { $entry_id = $row->entry_id; $this->_cat_id_cache['e' . $entry_id] = $row; $cat_id = $row->category_id; if (!isset($this->_cat_id_cache['c' . $cat_id])) { $cat = $row->category(); $this->_cat_id_cache['c' . $cat_id] = $cat; } } } return true; }
public function destroy($id) { Placement::destroy($id); Session::flash('message', 'Penempatan Kelas telah dihapus!!'); }
public function loadStudents($course) { $students = Placement::with('issue.student')->where('course_id', '=', $course)->get(); return $students; }
public function destroy($id) { $movement = Movement::find($id); $issue_id = $movement->issue_id; $base_id = $movement->base_id; $destination_id = $movement->destination_id; // restore the placement $placement = Placement::where('issue_id', '=', $issue_id)->where('course_id', '=', $destination_id)->first(); if ($placement) { $placement->course_id = $base_id; $placement->save(); } // deleting earning $earning = Earning::where('earnable_type', '=', 'Movement')->where('earnable_id', '=', $id)->first(); if ($earning) { $earning->delete(); } Movement::destroy($id); // Store to Timelines }
public function destroy($id) { $resign = Resign::find($id); $placements = Placement::where('resign_id', '=', $id)->get(); foreach ($placements as $placement) { $placement->resign_id = 0; $placement->active = 1; $placement->save(); } Returnment::where('resign_id', '=', $id)->delete(); Earning::where('earnable_type', '=', 'Resign')->where('earnable_id', '=', $id)->delete(); Resign::destroy($id); Session::flash('message', 'Sukses membatalkan penon-aktifan siswa'); }