public function updateEmployee()
 {
     $id = $this->input->get('emp_id');
     if ($this->input->post('btnAddJob')) {
         if (Job_history_model::create(Emp_info_model::jobInfo())) {
             $this->session->set_userdata('edited', 1);
             redirect("ems/view_details?emp_id={$id}");
         }
     }
     if ($this->input->post('btnAddDependents')) {
         if (Dependent_model::create(Emp_info_model::dependentInfo())) {
             $this->session->set_userdata('edited', 1);
             redirect("ems/view_details?emp_id={$id}");
         }
     }
     $ems = Emp_info_model::find($id);
     $gov = Gov_id_model::find($id);
     $address = Emp_address_model::find($id);
     $contact = Emp_contact_model::find($id);
     $contactP = Emp_contact_person::find($id);
     $school = Emp_school_model::find($id);
     $emp = Emp_history_model::find($id);
     $user = Users::find_by_employee_id($id);
     if ($ems->update_attributes(Emp_info_model::personalInfo()) && $gov->update_attributes(Emp_info_model::govInfo()) && $address->update_attributes(Emp_info_model::addressInfo()) && $contact->update_attributes(Emp_info_model::contactInfo()) && $contactP->update_attributes(Emp_info_model::contactPerson()) && $school->update_attributes(Emp_info_model::schoolInfo()) && $emp->update_attributes(Emp_info_model::employmentInfo()) && $user->update_attributes(Emp_info_model::accountInfo())) {
         $this->session->set_userdata('edited', 1);
         Audit_trail_model::auditUpdateEmp($id);
         redirect("ems/view_details?emp_id={$id}");
     }
 }
Example #2
0
 public function view_details()
 {
     $id = $this->input->get('emp_id');
     $data['departments'] = Departments_model::all();
     $data['job_titles'] = Job_titles_model::all();
     $data['employment_type'] = Employment_type_model::all();
     $data['countryy'] = Countries::all();
     $data['user_level'] = View_user_level::all();
     $data['record'] = Dependent_model::find('all', array('conditions' => "employee_id='{$id}'"));
     //get dependents by id
     $data['info'] = Emp_info_model::find($id);
     //Tab 1a - Personal Tab
     $data['gov_id'] = Gov_id_model::find($id);
     //Tab 1b - Gov ID Tab
     $data['address'] = View_emp_address::find($id);
     //Tab 2a - Contact Tab
     $data['contact'] = Emp_contact_model::find($id);
     //Tab 2b - Contact Tab
     $data['contactP'] = Emp_contact_person::find($id);
     //Tab 2c - Contact Tab
     $data['school'] = Emp_school_model::find($id);
     //Tab 3 - School Tab
     $data['job_hist'] = Job_history_model::find('all', array('conditions' => "employee_id ='{$id}'"));
     //Tab 4 - Job History Tab
     $data['emp'] = View_job_history::find($id);
     //Tab 5 - Employment Tab
     $data['leaves'] = View_leaves_left::find('all', array('conditions' => "employee_id ='{$id}'"));
     //Tab 6 - Leaves Tab
     $data['asset'] = View_assigned_assets_model::find('all', array('conditions' => "emp_id ='{$id}'"));
     //Tab 7 - Asset Tab
     $data['project'] = View_project_workers::find('all', array('conditions' => "emp_id ='{$id}'"));
     //Tab 8 - Project Tab
     $data['account'] = View_users_model::find_by_employee_id($id);
     //Tab 9 - Users Tab
     $data['pageTitle'] = 'Employee Details - MSInc.';
     $data['content'] = 'employee/employee_details';
     $this->load->view($this->master_layout, $data);
     $this->display_notif();
 }