Example #1
0
 function show_cto_balance($office_id = '')
 {
     $data = array();
     $this->Employee->fields = array('id', 'employee_id', 'office_id', 'lname', 'fname', 'mname');
     $data['rows'] = $this->Employee->get_employee_list(Session::get('office_id'), '');
     if ($office_id != '') {
         $data['rows'] = $this->Employee->get_employee_list($office_id, '');
     }
     //
     foreach ($data['rows'] as $row) {
         $c = CompensatoryTimeoff::where('employee_id', '=', $row['employee_id'])->where('type', '=', 'balance')->first();
         if ($c == null) {
             $c = new CompensatoryTimeoff();
             $c->employee_id = $row['employee_id'];
             $c->status = 'active';
             $c->type = 'balance';
             $c->save();
         }
     }
     return View::make('ajax/show_cto_balance', $data);
 }
 public static function getId($employee_id)
 {
     return CompensatoryTimeoff::where('employee_id', '=', $employee_id)->where('type', '=', 'balance')->first();
 }