Beispiel #1
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);
 }