public function filter($month, $year)
 {
     $curr_month = $month;
     $curr_year = $year;
     $punishments = Punishment::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('year(release_date)'), '=', $curr_year)->where(DB::raw('month(release_date)'), '=', $curr_month)->get();
     $menu = 'finance';
     return View::make('punishments.index', compact('punishments', 'curr_month', 'curr_year', 'menu'));
 }
 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;
 }
 public function create($issue_id)
 {
     $issue = Issue::find($issue_id);
     $receivable = Receivable::with('installments')->where('issue_id', '=', $issue_id)->first();
     $registration = Registration::where('student_id', '=', $issue->student_id)->where('cost_is_paid', '=', 0)->first();
     $movements = Movement::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
     $punishments = Punishment::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
     $resigns = Resign::where('issue_id', '=', $issue_id)->where('fines', '>', 0.0)->where('is_earned', '=', 0)->get();
     $employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
     $menu = 'finance';
     return View::make('earnings.create', compact('issue', 'receivable', 'registration', 'movements', 'punishments', 'resigns', 'employees', 'menu'));
 }