Esempio n. 1
0
 public function loadEarnables($issue_id)
 {
     $issue = Issue::find($issue_id);
     $receivable = Receivable::with('installments_not_paid')->where('issue_id', '=', $issue_id)->first();
     $registrations = Registration::where('student_id', '=', $issue->student_id)->where('cost_is_paid', '=', 0)->get();
     $movements = Movement::where('issue_id', '=', $issue_id)->get();
     $punishments = Punishment::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
     $resigns = Resign::where('issue_id', '=', $issue_id)->where('is_earned', '=', 0)->get();
     $responses = array('receivable' => $receivable, 'registrations' => $registrations, 'movements' => $movements, 'punishments' => $punishments, 'resigns' => $resigns);
     return $responses;
 }
Esempio n. 2
0
 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'));
 }
Esempio n. 3
0
 public function destroy($code)
 {
     $earnings = Earning::where('code', '=', $code)->get();
     foreach ($earnings as $earning) {
         switch ($earning->earnable_type) {
             case 'Receivable':
                 $receivable = Receivable::find($earning->earnable_id);
                 $receivable->balance += $receivable->balance + $earning->payment;
                 $receivable->save();
                 $earning->delete();
                 break;
             case 'Installment':
                 $installment = Installment::find($earning->earnable_id);
                 $installment->balance += $installment->balance + $earning->payment;
                 $installment->paid = 0;
                 $installment->save();
                 $earning->delete();
                 break;
             case 'Registration':
                 $registration = Registration::find($earning->earnable_id);
                 $registration->cost_is_paid = 0;
                 $registration->save();
                 $earning->delete();
                 break;
             case 'Movement':
                 $movement = Movement::find($earning->earnable_id);
                 $movement->paid = 0;
                 $movement->save();
                 $earning->delete();
                 break;
             case 'Punishment':
                 $punishment = Punishment::find($earning->earnable_id);
                 $punishment->paid = 0;
                 $punishment->save();
                 $earning->delete();
                 break;
             case 'Resign':
                 $resign = Resign::find($earning->earnable_id);
                 $resign->is_earned = 0;
                 $resign->save();
                 $earning->delete();
                 break;
             default:
                 $earning->delete();
                 break;
         }
     }
 }
Esempio n. 4
0
 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');
 }
Esempio n. 5
0
 public function recapCirculationGeneration()
 {
     $registrations = Classification::where('category', '=', 'Registration')->get();
     $resigns = Classification::where('category', '=', 'Resign')->get();
     $generations = Generation::all();
     $comes = array();
     $leaves = array();
     foreach ($registrations as $registration) {
         $statistics = array();
         foreach ($generations as $generation) {
             $count = Registration::with(array('issue'))->join('issues', 'issues.registration_id', '=', 'registrations.id')->where('registrations.project_id', '=', Auth::user()->curr_project_id)->where('registrations.location_id', '=', Auth::user()->location_id)->where('registrations.classification_id', '=', $registration->id)->where('issues.generation_id', '=', $generation->id)->count();
             $statistics[] = array('count' => $count);
         }
         $comes[] = array('name' => $registration->name, 'statistics' => $statistics);
     }
     foreach ($resigns as $resign) {
         $statistics = array();
         foreach ($generations as $generation) {
             $count = Resign::with(array('issue'))->join('issues', 'issues.id', '=', 'resigns.issue_id')->where('resigns.project_id', '=', Auth::user()->curr_project_id)->where('resigns.location_id', '=', Auth::user()->location_id)->where('resigns.classification_id', '=', $resign->id)->where('issues.generation_id', '=', $generation->id)->count();
             $statistics[] = array('count' => $count);
         }
         $leaves[] = array('name' => $resign->name, 'statistics' => $statistics);
     }
     $menu = 'report';
     return View::make('reports.recapcirculationgeneration', compact('comes', 'leaves', 'generations', 'menu'));
 }