?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec_old/application/controllers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/sec_old/application/controllers/hr.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Hr extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('mastermodel'); $this->load->model('accountingmodel'); $this->load->model('hrmodel'); } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if ($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } function viewinhrsearch($modelfunction, $page, $pagenum) { $output = $this->hrmodel->$modelfunction($pagenum); $data['viewinfo'] = $output['results']; $this->load->view('hr/' . $page . '', $data); } function addformdisplay($page, $directory, $return_page = '') { $data = array(); $data['return_page'] = $return_page; $perm = $this->hrmodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $this->load->view('' . $directory . '/' . $page . '', $data); } } function addinhr($modelfunction, $page) { $data = array(); $postdata = $this->get_post_values(); $data = $this->hrmodel->$modelfunction($postdata); $this->viewinhrsearch($data['resfunction'], $page, $_SESSION['pagenum']); $this->load->view('message', $data); } function deletedata($table, $id, $field) { $data = array(); $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 3); if (!$perm) $data['msg'] = "Access is restricted"; else $data = $this->mastermodel->deletedata($table, $id, $field); $arr = array('msg' => $data['msg'], 'res' => $data['res']); echo json_encode($arr); } function edit_page($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['id'] = $id; $this->load->view('hr/' . $page, $data); } } function edit_salary_setting($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['allowdeduc'] = $this->mastermodel->get_data('employee_salary_allowdeduc', $id, 'employee_salary_id'); $data['medical'] = $this->mastermodel->get_data('employee_salary_medical', $id, 'employee_salary_id'); $data['id'] = $id; $this->load->view('hr/' . $page, $data); } } function single_page($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['id'] = $id; $this->load->view('hr/' . $page, $data); } } function single_leave_page($id, $table, $field, $page, $returnpage = "") { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['leave_alloc'] = array(); $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $leav_alloc = $this->mastermodel->get_data_dual_srow('leave_allocation', $id, 'employee_id', date('Y'), 'leave_allocation_year'); if (!empty($leav_alloc)) { $data['leave_alloc'] = $this->mastermodel->get_data_joined('leave_allocation_detail', 'leave_type', 'leave_type_id', 'leave_type_id', $leav_alloc->leave_allocation_id, 'leave_allocation_id'); } $data['leave_appln'] = $this->hrmodel->getstfleavapply($id); // $data['leave_balance']=$this->hrmodel->get_leave_balance($id, date('Y')); $data['id'] = $id; $this->load->view('hr/' . $page, $data); } } function single_salary_setting($id, $table, $field, $page, $returnpage = "") { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { // $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['return_page'] = $returnpage; $data['viewinfo'] = $this->mastermodel->get_data_srow_joined($table, 'employee', 'employee_id', 'employee_id', $id, $field); $data['allowdeduc'] = $this->mastermodel->get_data('employee_salary_allowdeduc', $id, 'employee_salary_id'); $data['medical'] = $this->mastermodel->get_data('employee_salary_medical', $id, 'employee_salary_id'); $data['id'] = $id; $this->load->view('hr/' . $page, $data); } } function load_items($page, $employee_id) { $data['employee_id'] = $employee_id; $this->load->view('hr/' . $page, $data); } function load_employee_details($id) { $employee_id = $this->mastermodel->get_single_field_value('employee', 'employee_id', 'employee_id', $id); $data['emp'] = $this->mastermodel->get_data_srow('employee', $employee_id, 'employee_id'); $data['designation'] = $this->mastermodel->get_single_field_value('designation', 'designation_name', 'designation_id', $data['emp']->employee_designation_id); $data['department'] = $this->mastermodel->get_single_field_value('department', 'department_name', 'department_id', $data['emp']->employee_department_id); $this->load->view('hr/employee_details', $data); } function load_all_employee_salary_payment($date) { $data['viewinfo'] = $this->hrmodel->getemployeelist(); $data['date'] = $date; $this->load->view('hr/add_multiple_employee_salary_payment', $data); } function checksalarymonth() { $data = array(); $data['info'] = $_POST; $salary_count = $this->hrmodel->count_data_salary('employee_salary', $data['info']['id'], $data['info']['date']); if ($salary_count == 0) { echo "salary_not_set"; } else { $salary_exist = $this->hrmodel->check_salary_month($data['info']['id'], $data['info']['date']); if ($salary_exist > 0) echo "salary_exists"; else echo ""; } } function load_employees_salary($id, $date, $type = "") { $employee_salary_id = $this->hrmodel->get_employee_salary_id($id, $date); if ($employee_salary_id != "") { $data['viewinfo'] = $this->mastermodel->get_data_srow('employee_salary', $employee_salary_id, 'employee_salary_id'); $data['salary_date'] = $date; $data['form_type'] = $type; $data['emp_sal_id'] = $employee_salary_id; $this->load->view('hr/add_single_employee_salary_payment', $data); } else { echo '<script type="text/javascript">alert(\'Employee Salary Not set\');</script>'; } } function load_employees_salary_selected() { $id = $_POST['id']; $date = $_POST['date']; $employee_salary_id = $this->hrmodel->get_employee_salary_id($id, $date); if ($employee_salary_id != "") { $data['viewinfo'] = $this->mastermodel->get_data_srow('employee_salary', $employee_salary_id, 'employee_salary_id'); $data['salary_date'] = $date; $data['emp_sal_id'] = $employee_salary_id; $this->load->view('hr/view_single_employee_salary_payment', $data); } else { echo '<script type="text/javascript">alert(\'Employee Salary Not set\');</script>'; } } function loadsalary($page, $post, $date) { $data['viewinfo'] = $this->hrmodel->loademployeesalary($post, $date); $data['wef_date'] = $date; $this->load->view('hr/' . $page . '', $data); } function loadunpostedsalary($page, $salid, $date) { $data['wef_date'] = $date; $data['salpay'] = $this->hrmodel->loadunpostedsalary($salid); $this->load->view('hr/' . $page . '', $data); } function loadpostedsalary($page, $salid) { $data['salpay'] = $this->hrmodel->loadpostedsalary($salid); $this->load->view('hr/' . $page . '', $data); } function leave_approval($id, $status) { echo $this->hrmodel->leave_approval($id, $status); } function get_course_subject($id) { $sub_id = $this->mastermodel->get_data('course_subject', $id, 'course_id'); echo "<option value=''>Select</option>"; foreach ($sub_id as $row) { $sub = $this->mastermodel->get_data('subject', $row['subject_id'], 'subject_id'); foreach ($sub as $list) { echo "<option value='" . $list['subject_id'] . "'>" . $list['subject_name'] . "</option>"; } } } function load_payment_method($payment_type_id) { $data['payment_type'] = $payment_type_id; $this->load->view('hr/payment_method', $data); } function autosuggestemployeesalarypayment($salary_date) { $q = strtolower($_POST["q"]); if (!$q) return; $salary_month = date("m", strtotime($salary_date)); $salary_year = date("Y", strtotime($salary_date)); $employee_list = $this->hrmodel->getunpaidemployees($salary_month, $salary_year); foreach ($employee_list as $items) { $name = $items['employee_name']; $emp_no = $items['employee_no']; if (strpos(strtolower($name), $q) !== false) { echo '' . $name . '-' . $emp_no . '#' . $items['employee_id'] . '#'; echo "\n"; } else if (strpos(strtolower($emp_no), $q) !== false) { echo '' . $name . '-' . $emp_no . '#' . $items['employee_id'] . '#'; echo "\n"; } } } } /* End of file master.php */ /* Location: ./application/controllers/master.php */