Beispiel #1
0
 function monthly($employee_id = '')
 {
     $data['page_name'] = '<b>Monthly Payroll</b>';
     $data['employee_id'] = $employee_id;
     $data['msg'] = '';
     if (Input::get('op')) {
     }
     $e = new Employee_m();
     $e->where('office_id', Input::get('office_id') ? Input::get('office_id') : Session::get('office_id'));
     $e->where('permanent', 1);
     $e->order_by('lname');
     $data['employees'] = $e->get();
     $data['main_content'] = 'monthly';
     return View::make('includes/template', $data);
 }
Beispiel #2
0
 function edit_place($mode = '')
 {
     if ($mode == 'tax_exempt') {
         $e = new Employee_m();
         $e->where('id', Input::get('rowid'));
         $e->get();
         if (Input::get('colid') == 'tax_status') {
             $e->tax_status = Input::get('new');
         }
         if (Input::get('colid') == 'dependents') {
             $e->dependents = Input::get('new');
         }
         $e->save();
         exit;
     }
 }
Beispiel #3
0
 function reports()
 {
     $data['page_name'] = '<b>Reports</b>';
     $data['pop_up'] = '';
     $data['rows'] = array();
     $data['records_found'] = '';
     if (Input::get('op')) {
         $e = new Employee_m();
         if (Input::get('lname') != '') {
             $e->where('lname', Input::get('lname'));
         }
         if (Input::get('fname') != '') {
             $e->where('fname', Input::get('fname'));
         }
         if (Input::get('position') != '') {
             $e->like('position', Input::get('position'));
         }
         if (Input::get('permanent') != 'all') {
             $e->where('permanent', Input::get('permanent'));
         }
         if (Input::get('office_id') != '0') {
             $e->where('office_id', Input::get('office_id'));
         }
         if (Input::get('salary_grade') != '') {
             list($salary_grade, $step) = explode("-", Input::get('salary_grade'));
             $e->where('salary_grade', $salary_grade);
             $e->where('step', $step);
         }
         // =======================================================
         if (Input::get('years_service') != '') {
             // If blank search for exact year
             if (Input::get('years_service_above') == '') {
             }
             $the_year = date('Y') - Input::get('years_service');
             $today = date('Y-m-d');
             $e->where('YEAR(first_day_of_service)', $the_year);
             $e->where('MONTH(first_day_of_service) >=', date('m'));
         }
         if (Input::get('eligibility') != '') {
             $e->like('eligibility', Input::get('eligibility'), 'both');
         }
         if (Input::get('course') != '') {
             $e->like('course', Input::get('course'), 'both');
         }
         if (Input::get('sex') != '') {
             $e->where('sex', Input::get('sex'));
         }
         if (Input::get('age') != '') {
             $the_year = date('Y') - Input::get('age');
             $e->where('YEAR(birth_date)', $the_year);
             $e->where('MONTH(birth_date) >=', date('m'));
         }
         if (Input::get('location') != '') {
             $e->like('res_address', Input::get('location'));
         }
         $e->order_by('lname');
         $data['rows'] = $e->get();
         $data['records_found'] = $e->result_count();
         // if search and print preview
         if (Input::get('search_preview')) {
             $data['pop_up'] = 1;
             $preview = new Search_result_preview();
             $data['report_file'] = $preview->preview($data['rows'], Input::get('report_name'));
         }
     }
     $data['options'] = array('position' => 'Position/ Designation', 'department' => 'Office/ Department', 'employment_status' => 'Employment Status');
     //Use for office listbox
     $data['options'] = $this->options->office_options($add_select = TRUE);
     $data['selected'] = Input::get('office_id');
     $data['permanent_options'] = $this->options->type_employment($all = TRUE);
     $data['permanent_selected'] = Input::get('permanent');
     $data['years_service_above_options'] = array('' => '', 'above' => 'above', 'below' => 'below');
     $data['years_service_above_selected'] = Input::get('years_service_above');
     $data['age_above_options'] = array('' => '', 'above' => 'above', 'below' => 'below');
     $data['age_above_selected'] = Input::get('age_above');
     $data['main_content'] = 'reports';
     return View::make('includes/template', $data);
 }
Beispiel #4
0
 function aso()
 {
     $e = new Employee_m();
     $e->where('id', '25')->get();
     echo 'aso';
 }
 function training_employees()
 {
     $options = array();
     $ci =& get_instance();
     $e = new Employee_m();
     $e->where('lname !=', '');
     $e->where('status', 1);
     $e->order_by('lname');
     $types = $e->get();
     $ci->load->helper('text');
     foreach ($types as $type) {
         $options[$type->id] = $type->lname . ', ' . $type->fname . ' ' . $type->mname;
     }
     return $options;
 }
Beispiel #6
0
 function salary_index($employee_id = '')
 {
     $data['page_name'] = '<b>Employee Salary Index</b>';
     $data['employee_id'] = $employee_id;
     $data['msg'] = '';
     if (Input::get('op')) {
     }
     $e = new Employee_m();
     $e->where('permanent', 1);
     $e->where('id', 171);
     $e->order_by('lname');
     $data['employees'] = $e->get();
     $data['main_content'] = 'report/salary_index';
     return View::make('includes/template', $data);
 }
Beispiel #7
0
 /**
  * Enter description here...
  *
  */
 function add_employee()
 {
     $data['page_name'] = '<b>Add employee</b>';
     $data['msg'] = '';
     //Office
     $data['options'] = $this->options->office_options();
     $data['selected'] = Session::get('office_id');
     // Divisions options
     $data['division_options'] = $this->options->division_options(Session::get('office_id'));
     //Detailed office
     $detailed_options = $this->options->office_options($add_select = TRUE);
     $data['detailed_options'] = $detailed_options;
     $data['detailed_selected'] = '';
     //Type of employment
     $data['permanent_options'] = $this->options->type_employment();
     $data['permanent_selected'] = '';
     //Salary grade options
     $data['sg_options'] = $this->options->salary_grade();
     $data['sg_selected'] = '';
     //Step increment
     $data['step_options'] = $this->options->step();
     $data['step_selected'] = '';
     //Shift List
     $data['shifts_options'] = $this->options->shift();
     // Lets check if the auto generate employee
     // number is enabled
     $data['employee_id_readonly'] = '';
     $data['auto_generate_employee_id'] = 'no';
     $auto_generate_employee_id = Setting::getField('auto_generate_employee_id');
     $data['auto_employee_id'] = '';
     if ($auto_generate_employee_id == 'yes') {
         $data['employee_id_readonly'] = 'readonly';
         $data['auto_generate_employee_id'] = 'yes';
         // Lets get the maximum employee_id
         $e = new Employee_m();
         $e->where('office_id', Session::get('office_id'));
         $e->select_max('employee_id');
         $e->get();
         //$data['auto_employee_id'] = $e->employee_id + 1;
         //echo $this->db->last_query();
     }
     //If form submit
     if (Input::get('op')) {
         $this->form_validation->set_rules('employee_id', 'Employee ID', 'required|callback_employee_id_check');
         $this->form_validation->set_rules('salutation', 'Salutation', 'required');
         $this->form_validation->set_rules('lname', 'Last Name', 'required');
         $this->form_validation->set_rules('fname', 'First Name', 'required');
         $this->form_validation->set_rules('extension', 'First Name', '');
         $this->form_validation->set_rules('position', 'Position', 'required');
         $this->form_validation->set_rules('permanent', 'Type of employment', 'required');
         //$this->form_validation->set_rules('password', 'Password', 'required|matches[repassword]');
         if ($this->form_validation->run($this) == FALSE) {
             $data['selected'] = Input::get('office_id');
             $data['detailed_selected'] = Input::get('detailed_office_id');
             $data['permanent_selected'] = Input::get('permanent');
             $data['sg_selected'] = Input::get('sg');
             $data['step_selected'] = Input::get('step');
         } else {
             $shift_id = Input::get('shift2');
             $shift_type = Input::get('shift2');
             //File name of the photo
             $file_register = Session::get('file_register');
             $finger_pics = '/../' . current_work_dir() . '/pics/' . Session::get('file_register');
             $info = array('employee_id' => Input::get('employee_id'), 'lname' => Input::get('lname'), 'fname' => Input::get('fname'), 'mname' => Input::get('mname'), 'extension' => Input::get('extension'), 'position' => Input::get('position'), 'assistant_dept_head' => Input::get('assistant_dept_head'), 'office_id' => Input::get('office_id'), 'division_id' => Input::get('division_id'), 'section_id' => Input::get('section_id'), 'detailed_office_id' => Input::get('detailed_office_id'), 'salut' => Input::get('salutation'), 'pics' => $file_register, 'finger_pics' => $finger_pics, 'shift_id' => $shift_id, 'shift_type' => $shift_type, 'status' => 1, 'permanent' => Input::get('permanent'), 'first_day_of_service' => Input::get('first_day_of_service'), 'salary_grade' => Input::get('sg'), 'step' => Input::get('step'), 'newly_added' => 1, 'updated' => 1, 'emergency_contact' => Input::get('emergency_contact'), 'emergency_contact_no' => Input::get('emergency_contact_no'));
             $id = $this->Employee->add_employee($info);
             $this->Logs->insert_logs('employees', 'ADD EMPLOYEE', 'Add new employee (' . $id . ')', $id);
             // Use for messaging
             Session::flash('msg', 'New Employee added!');
             if ($this->config->item('active_apps') == 'hris') {
                 // Add to personal info
                 $p = new Personal_m();
                 $p->get_by_employee_id($id);
                 $p->employee_id = $id;
                 $p->lname = Input::get('lname');
                 $p->fname = Input::get('fname');
                 $p->mname = Input::get('mname');
                 $p->save();
                 // Redirect to pds page
                 //return Redirect::to('pds/employee_profile/'.$id, 'refresh');
             }
             // Redirect to adding new employee form
             return Redirect::to('employees/add_employee', 'refresh');
         }
     }
     $data['main_content'] = 'add_employee';
     return View::make('includes/template', $data);
 }
Beispiel #8
0
    function delete_office($office_id = '')
    {
        // Lets check if the office have associated employee
        $e = new Employee_m();
        $e->where('office_id', $office_id);
        $e->get();
        // If exists
        if ($e->exists()) {
            Session::flash('error_msg', 'Unable to delete office. 
														Please delete all employee associated with the office.');
            return Redirect::to('office_manage/view_offices', 'refresh');
        }
        $this->Office->delete_office($office_id);
        // Delete the associated division
        $d = new Division();
        $d->where('office_id', $office_id)->get();
        $d->delete_all();
        Session::flash('msg', 'Office deleted!');
        return Redirect::to('office_manage/view_offices', 'refresh');
    }
Beispiel #9
0
 function staff_entitlement($employee_id = '')
 {
     $this->load->helper('payroll_options');
     $data['page_name'] = '<b>Staff Entitlement</b>';
     //Use for office listbox
     $data['options'] = $this->options->office_options();
     $data['selected'] = Session::get('office_id');
     $data['additional_compensation_id'] = Input::get('additional_compensation_id') ? Input::get('additional_compensation_id') : 1;
     $data['msg'] = '';
     $office_id = Session::get('office_id');
     if (Input::get('op')) {
         $data['employee_id'] = Input::get('employee_id');
         $data['selected'] = Input::get('office_id');
     }
     if (Input::get('office_id')) {
         $office_id = Input::get('office_id');
     }
     $e = new Employee_m();
     $e->order_by('lname');
     $e->where('office_id', $office_id);
     $data['rows'] = $e->get();
     $data['main_content'] = 'adcom/staff/staff_entitlement';
     return View::make('includes/template', $data);
 }