?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/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/application/controllers/master.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Master extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('accountingmodel'); $this->load->model('mastermodel'); $this->load->model('settingsmodel'); $this->load->library('Fpaginate'); } public function index($menuid="",$modid="", $upload = 0) { $ret=$this->mastermodel->chk_url_permission($menuid); if($ret!=1) { $menuid=""; $modid=""; } if(empty($modid)) { $data['modname']='Home'; } else { $mod_id=$this->mastermodel->get_data('modules',$modid,'module_id','sort'); foreach($mod_id as $id) { $modname=$id['module_name']; } $data['modname']=$modname; } if(empty ($menuid)) { $tart='index'; $data['menuname']=''; $data['men_id']=$menuid; $data['modulelist']=$this->mastermodel->getmoduledatamaster(); } else { $tar=$this->mastermodel->get_data('menu',$menuid,'menu_id'); foreach($tar as $target) { $tart=$target['target']; $data['menuname']=$target['caption']; } } $_SESSION['searchdata']=""; $_SESSION['current_mode']=$menuid; $_SESSION['current_module']=$modid; $_SESSION['modename']=$data['modname']; $_SESSION['menuname']=$data['menuname']; //echo $_SESSION['current_mode']; //echo $_SESSION['current_module']; $data['modules']=$this->mastermodel->buildModule(); $data['menus']=$this->mastermodel->buildMenu($modid); $this->load->view($data['modname'] . '/' . $tart . '', $data); if ($upload == 1) { $data['message'] = 'File uploaded successfully!'; $this->load->view('message', $data); } } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } /* common function loading pages through jquery load method . * Usages:-used for displaying addform. */ 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 addinmaster($modelfunction,$page) { $postdata=$this->get_post_values(); $data=$this->mastermodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']==1) { $this->viewinmastersearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } else { $this->viewinmastersearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } } function viewinmastersearch($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->mastermodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Master/'.$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('Master/'.$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('Master/'.$page,$data); } } function addformdisplayalert($page,$directory,$employee_name,$alert_id) { $data['employee_name']=$employee_name; $data['alert_id']=$alert_id; $this->load->view(''.$directory.'/'.$page.'',$data); } function get_activity_code($activity_category_id) { echo $this->mastermodel->get_activity_code($activity_category_id); } function get_training_code($activity_id) { echo $this->mastermodel->get_training_code($activity_id); } function get_software_code($activity_id) { echo $this->mastermodel->get_software_code($activity_id); } function get_consulting_code($activity_id) { echo $this->mastermodel->get_consulting_code($activity_id); } function autosuggestemployee() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->mastermodel->getdatas('employee','employee_id'); 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 autosuggestemployeehierarchy() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=explode(',',$_SESSION['employees']); foreach ($employee_list as $items) { $employee= $this->mastermodel->get_data_srow('employee',$items,'employee_id'); $name = $employee->employee_name; $emp_no= $employee->employee_no; if (strpos(strtolower($name), $q) !== false) { echo ''.$name.'-'.$emp_no.'#'.$items.'#'; echo "\n"; } else if (strpos(strtolower($emp_no), $q) !== false) { echo ''.$name.'-'.$emp_no.'#'.$items.'#'; echo "\n"; } } } function autosuggestemployeeattendance() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->mastermodel->getemployeesforattendace(); foreach ($employee_list as $items) { $employees=explode(',',$_SESSION['employees']); if(in_array($items['employee_id'], $employees)) { $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 autosuggestemployeenotuser() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->mastermodel->get_employee_not_user(); 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 autosuggesttraining() { $q = strtolower($_POST["q"]); if (!$q) return; $training_list=$this->mastermodel->getdatas('training_proposal','training_id'); foreach ($training_list as $items) { $code = $items['training_code']; $venue= $items['venue']; if (strpos(strtolower($code), $q) !== false) { echo ''.$code.'-'.$venue.'#'.$items['training_id'].'#'; echo "\n"; } else if (strpos(strtolower($venue), $q) !== false) { echo ''.$code.'-'.$venue.'#'.$items['training_id'].'#'; echo "\n"; } } } function autosuggestcustomer() { $q = strtolower($_POST["q"]); if (!$q) return; $customer_list=$this->mastermodel->getdatas('customer','customer_name'); foreach ($customer_list as $items) { $name = $items['customer_name']; $customer_no= $items['customer_no']; if (strpos(strtolower($name), $q) !== false) { echo ''.$name.'-'.$customer_no.'#'.$items['customer_id'].'#'; echo "\n"; } else if (strpos(strtolower($customer_no), $q) !== false) { echo ''.$name.'-'.$customer_no.'#'.$items['customer_id'].'#'; echo "\n"; } } } function autosuggestcustomercode() { $q = strtolower($_POST["q"]); if (!$q) return; $customer_list=$this->mastermodel->getdatas('customer','customer_name'); foreach ($customer_list as $items) { $name = $items['customer_name']; $customer_no= $items['customer_no']; if (strpos(strtolower($name), $q) !== false) { echo ''.$name.'#'.$items['customer_no'].'#'; echo "\n"; } else if (strpos(strtolower($customer_no), $q) !== false) { echo ''.$name.'#'.$items['customer_no'].'#'; echo "\n"; } } } function autosuggestproposal() { $q = strtolower($_POST["q"]); if (!$q) return; $proposal_list=$this->mastermodel->get_software_proposal(); foreach ($proposal_list as $items) { $code = $items['proposal_code']; $customer_name= $items['customer_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['software_proposal_id'].'#'; echo "\n"; } else if (strpos(strtolower($customer_name), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['software_proposal_id'].'#'; echo "\n"; } } } function autosuggestconsultingproposal() { $q = strtolower($_POST["q"]); if (!$q) return; $proposal_list=$this->mastermodel->get_consulting_proposal(); foreach ($proposal_list as $items) { $code = $items['proposal_code']; $customer_name= $items['customer_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['consulting_proposal_id'].'#'; echo "\n"; } else if (strpos(strtolower($customer_name), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['consulting_proposal_id'].'#'; echo "\n"; } } } function autosuggesttrainingproposal() { $q = strtolower($_POST["q"]); if (!$q) return; $proposal_list=$this->mastermodel->get_training_proposal(); foreach ($proposal_list as $items) { $code = $items['training_code']; $customer_name= $items['customer_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['id'].'#'; echo "\n"; } else if (strpos(strtolower($customer_name), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['id'].'#'; echo "\n"; } } } function autosuggesttrainingquotation() { $q = strtolower($_POST["q"]); if (!$q) return; $quotation_list=$this->mastermodel->get_training_quotation(); foreach ($quotation_list as $items) { $code = $items['quotation_code']; $customer_name= $items['customer_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['training_quotation_id'].'#'; echo "\n"; } else if (strpos(strtolower($customer_name), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['training_quotation_id'].'#'; echo "\n"; } } } function autosuggesttrainingregistration() { $q = strtolower($_POST["q"]); if (!$q) return; $registration_list=$this->mastermodel->get_training_registration(); foreach ($registration_list as $items) { $code = $items['quotation_code']; $customer_name= $items['customer_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['training_registration_id'].'#'; echo "\n"; } else if (strpos(strtolower($customer_name), $q) !== false) { echo ''.$customer_name.'-'.$code.'#'.$items['training_registration_id'].'#'; echo "\n"; } } } function autosuggestmainaccounts() { $q = strtolower($_POST["q"]); if (!$q) return; $chart_master_list=$this->mastermodel->get_data('chart_master',0,'parent','chart_account_type'); foreach ($chart_master_list as $items) { $code = $items['chart_account_code']; $chart_account_name= $items['chart_account_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$items['chart_master_id'].'#'; echo "\n"; } else if (strpos(strtolower($chart_account_name), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$items['chart_master_id'].'#'; echo "\n"; } } } function autosuggestsubacfrom($main_account_id) { $q = strtolower($_POST["q"]); if (!$q) return; $chart_master_list=$this->mastermodel->get_data('chart_master',$main_account_id,'parent','chart_account_type'); foreach ($chart_master_list as $items) { $code = $items['chart_account_code']; $chart_account_name= $items['chart_account_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$items['chart_master_id'].'#'; echo "\n"; } else if (strpos(strtolower($chart_account_name), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$items['chart_master_id'].'#'; echo "\n"; } } } function autosuggestsubacto($main_account_id) { $q = strtolower($_POST["q"]); if (!$q) return; $chart_master_list=$this->mastermodel->get_data('chart_master',$main_account_id,'parent','chart_account_type'); foreach ($chart_master_list as $items) { $code = $items['chart_account_code']; $chart_account_name= $items['chart_account_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$items['chart_master_id'].'#'; echo "\n"; } else if (strpos(strtolower($chart_account_name), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$items['chart_master_id'].'#'; echo "\n"; } } } function autosuggestaccounts() { $q = strtolower($_POST["q"]); if (!$q) return; $chart_master_list=$this->mastermodel->listchartofaccounts(); foreach ($chart_master_list as $items) { $code = $items['chart_account_code']; $chart_account_name= $items['chart_account_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$code.'#'; echo "\n"; } else if (strpos(strtolower($chart_account_name), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$code.'#'; echo "\n"; } } } function autosuggestallaccounts() { $q = strtolower($_POST["q"]); if (!$q) return; $chart_master_list=$this->mastermodel->getdatas('chart_master','chart_account_type'); foreach ($chart_master_list as $items) { $code = $items['chart_account_code']; $chart_account_name= $items['chart_account_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$code.'#'; echo "\n"; } else if (strpos(strtolower($chart_account_name), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$code.'#'; echo "\n"; } } } function autosuggest_cust_emp_accounts() { $q = strtolower($_POST["q"]); if (!$q) return; $chart_master_list=$this->mastermodel->get_cust_emp_accounts(); foreach ($chart_master_list as $items) { $code = $items['chart_account_code']; $chart_account_name= $items['chart_account_name']; if (strpos(strtolower($code), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$code.'#'; echo "\n"; } else if (strpos(strtolower($chart_account_name), $q) !== false) { echo ''.$code.'-'.$chart_account_name.'#'.$code.'#'; echo "\n"; } } } function post_device_attendance() { echo $this->mastermodel->insert_device_attendance(); } function commonuploadform($master_id,$return_page) { $data=array(); $data['master_id']=$master_id; $data['return_page']=$return_page; $this->load->view('Master/commonuploadform',$data); } function commonsubmitupload() { $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->mastermodel->commonuploadfile($postdata); $data['msg']= "File Uploaded successfully!"; } } else { $data['msg']= "File already exists"; } $data['return_page']=$postdata['return_page']; $this->load->view('Master/commonafterupload',$data); } } /* End of file master.php */ /* Location: ./application/controllers/master.php */