?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/draft/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/sgms/draft/application/controllers/hr.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Hr extends MY_Controller { function __construct() { parent::__construct(); $this->load->library('Fpaginate'); $this->load->model('mastermodel'); $this->load->model('accountingmodel'); $this->load->model('hrmodel'); $this->load->helper('to_pdf'); } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } function addformdisplay($page,$directory,$table="",$pagenum="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],1); if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $this->load->view(''.$directory.'/'.$page.''); } } function deletedata($table,$id,$field) { $data=array(); $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],3); if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data=$this->mastermodel->deletedata($table,$id,$field); $data['msg']=$data['msg']; if($data['res']==1) { $this->load->view('message',$data); } else { $this->load->view('message',$data); } } } function checkexistence($table,$field,$value) { if($this->mastermodel->checkexistence($table,$field,$value)>0) { echo 1; } } function checkexistencearray($table,$field,$value) { if($this->mastermodel->checkexistencearray($table,$field,$value)>0) { echo 1; } } function addinhr($modelfunction,$page) { $postdata=$this->get_post_values(); $path = './assets/uploads'; if(isset($_FILES['filename']) && $_FILES['filename']['name'] != "") { $_FILES["filename"]["name"]=date("y-m-d-H-i-s").$_FILES["filename"]["name"]; if (!is_file("$path/".$_FILES["filename"]["name"])) { (move_uploaded_file($_FILES["filename"]["tmp_name"],$path."/".$_FILES["filename"]["name"])); $postdata['filename']=$_FILES["filename"]["name"]; } } else if(isset($postdata['candidate_name'])) { $postdata['filename']=""; } $data=$this->hrmodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']=="password") { $this->load->view('message',$data); } else if($data['res']==1) { $this->viewinhrsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } else { $this->viewinhrsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } } function viewinhrsearch($modelfunction,$page,$pagenum) { /*<---------------- For pagination purpose------------>*/ $perpage= $this->config->item('perpage'); $_SESSION['pagenum']=$pagenum; $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } if(isset($_POST['tab_name'])) { $postdata =""; } else { $postdata=$this->get_post_values(); } if(!empty ($postdata)) $_SESSION['searchdata']=$postdata; else if(!isset($_SESSION['searchdata'])) $_SESSION['searchdata']=""; /*<---------------- For pagination purpose------------> */ $output=$this->hrmodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('HR/'.$page.'',$data); } function edit_page($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],2); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $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_page($id,$table,$field,$page,$alert_id='') { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],0); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['id']=$id; $data['alert_id']=$alert_id; $this->load->view('HR/'.$page,$data); } } function singleemployee($id) { $data['employee']=$this->mastermodel->get_data_srow('employee',$id,'employee_id'); $this->load->view('Student/singlestudent',$data); } function load_employees_salary($id,$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; $this->load->view('HR/add_single_employee_salary_payment',$data); } else { echo '<script type="text/javascript">alert(\'Employee Salary Not set\');</script>'; } } 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 loadsalary($page,$post,$date) { $data['viewinfo'] = $this->hrmodel->loademployeesalary($post,$date); $this->load->view('HR/'.$page.'',$data); } function loadunpostedsalary($page,$salid) { $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 listSearchstaff($pagenum,$searchBy="",$staffname="") { $data['per_page']=6; if($pagenum!=1) { $data['id']=($pagenum-1) * $data['per_page']+1; } else { $data['id']=1; } $data['searchBy']=$searchBy; $data['currentpage']=$pagenum; $data['custname']=$staffname; $counts=$this->documentsmodel->count_alls('employee','id',''); if($counts==0) { $data['Maxpage']=1; } else { $data['Maxpage']=ceil($counts/$data['per_page']); } $data['viewinfo']=$this->hrmodel->employeelistpagination($pagenum, $data['per_page'],$staffname,$searchBy); $this->load->view('HR/loadstafflist',$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"; } } function checksalaryposted() { $data=array(); $data['info']=$_POST; echo $this->hrmodel->checksalaryposted($data['info']['id']) ; } function autosuggestemployeesalarypayment($salary_date) { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->hrmodel->getunpaidemployees($salary_date); 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"; } } } function leave_approval($id) { $data['leave_id']=$id; $this->load->view('HR/leave_approval',$data); } function updateleavestatus() { $res=$this->hrmodel->updateleavestatus(); if($res>=1) { echo "Leave status updated"; } else { echo "Error While Adding"; } } function uploadform($employee_id) { $data=array(); $data['employee_id']=$employee_id; $this->load->view('HR/uploadform',$data); } function submitupload() { $data=array(); $postdata=$this->get_post_values(); $path = './assets/uploads/'; $_FILES["upload_file"]["name"]=date('Y-m-d-h-i-s').$_FILES["upload_file"]["name"]; if (!is_file("$path".$_FILES["upload_file"]["name"])) { if (!(move_uploaded_file($_FILES["upload_file"]["tmp_name"],$path."/".$_FILES["upload_file"]["name"]))) { $data['msg']= "File not uploaded.. Permission denied!"; } else { $postdata['file_location']=$path."/".$_FILES["upload_file"]["name"]; $data=$this->hrmodel->uploadfile($postdata); $data['msg']= "File Uploaded successfully!"; } } else { $data['msg']= "File already exists"; } $this->load->view('HR/afterupload',$data); } function get_employee_attendance_info($employee_id,$from_date,$to_date) { $data=array(); $data['viewinfo']=$this->hrmodel->get_employee_attendance($employee_id,$from_date,$to_date); $data['employee']=$this->mastermodel->get_data_srow('employee',$employee_id,'employee_id'); $this->load->view('HR/employee_attendance_info',$data); } function getreport($modelfunction,$page) { $postdata=$this->get_post_values(); $output=$this->hrmodel->$modelfunction($postdata); if(!empty ($output)) { $data['report']=$output; $data['postdata']=$postdata; $page=$postdata['report_type'].$page; $this->load->view('HR/'.$page.'',$data); } else { redirect('master/index/'.$_SESSION['current_mode'].'/6'); } } function leave_approval_list() { $output=$this->hrmodel->get_leave_approval_list(); $data['viewinfo']=$output['results']; $this->load->view('HR/leave_approval_list',$data); } }