📄 empinfo.php
字号:
return $this->empEEOCat;
}
function getEmpLocation() {
return $this->empLocation;
}
function getEmpJoinedDate() {
return $this->empjoindat;
}
//permanent contacts
function getEmpStreet1() {
return $this->empStreet1;
}
function getEmpStreet2() {
return $this->empStreet2;
}
function getEmpCity() {
return $this->empCity;
}
function getEmpProvince() {
return $this->empProvince;
}
function getEmpCountry() {
return $this->empCountry;
}
function getEmpZipCode() {
return $this->empZipCode;
}
function getEmpHomeTelephone() {
return $this->empHomeTelephone;
}
function getEmpMobile() {
return $this->empMobile;
}
function getEmpWorkTelephone() {
return $this->empWorkTelephone;
}
function getEmpWorkEmail() {
return $this->empWorkEmail;
}
function getEmpOtherEmail() {
return $this->empOtherEmail;
}
/**
* Get a list of employee ids that match a given criteria
*
* The criteria is given in the form of a string array.
* The array keys should match to $filterFields keys
*
* @param String[] fileterValues
*/
public function getEmployeeIdsFilterMultiParams($filterValues) {
//$tableName = 'HS_HR_EMPLOYEE';
$arrFieldList[0] = "a.`employee_id`";
$filterFields[0] = "LPAD(a.`emp_number`, " . $this->employeeIdLength . ", 0)";
$filterFields[1] = "a.`work_station`";
$filterFields[2] = "g.`employee_id`";
$filterFields[3] = "a.`emp_status`";
$sql_builder = new SQLQBuilder();
$arrTables[0] = "`hs_hr_employee` a";
$arrTables[1] = "`hs_hr_emp_reportto` f";
$arrTables[2] = "`hs_hr_employee` g";
$joinConditions[1] = "a.`emp_number` = f.`erep_sub_emp_number`";
$joinConditions[2] = "f.`erep_sup_emp_number` = g.`emp_number`";
for ($i = 0; $i < count($filterFields); $i++) {
if ((is_numeric($filterValues[$i]) && ($filterValues[$i] > -1)) || !is_numeric($filterValues[$i])) {
$filteredSearch[$i] = mysql_real_escape_string($filterValues[$i]);
} else {
if ($i == 3) {
$selectConditions[] = "(a.`emp_status` != 'EST000' OR a.`emp_status` IS NULL)";
}
continue;
}
if ($i == 1) {
// Special handling for search by subdivision.
// Get list of workstations with matches in the title or matches higher in the hierachy
$subdivisionIds = $this->_getMatchingSubdivisionIds($filterValues[$i]);
// Create select condition for employees with workstation set to any of the
// subdivisions
if (isset ($subdivisionIds) && !empty ($subdivisionIds)) {
$selectConditions[] = "a.`work_station` IN (" . $subdivisionIds . ") ";
} else {
// No subdivisions matches found.
return '';
}
} else {
$selectConditions[] = "{$filterFields[$i]} LIKE '" . $filteredSearch[$i] . "%'";
}
}
$selectOrder = 'ASC';
$selectOrderBy = $arrFieldList[0];
$sqlQString = $sql_builder->selectFromMultipleTable($arrFieldList, $arrTables, $joinConditions, $selectConditions, null, $selectOrderBy, $selectOrder);
//echo $sqlQString;
$dbConnection = new DMLFunctions();
$message2 = $dbConnection->executeQuery($sqlQString);
$arrayDispList = null;
while ($line = mysql_fetch_array($message2, MYSQL_NUM)) {
$arrayDispList[] = $line[0];
}
return $arrayDispList;
}
/////////////
function getListofEmployee($pageNO = 0, $schStr = '', $mode = -1, $sortField = 4, $sortOrder = 'ASC', $supervisorId = null) {
//$tableName = 'HS_HR_EMPLOYEE';
$arrFieldList[0] = "a.`employee_id`";
$arrFieldList[1] = "a.`emp_firstname`";
$arrFieldList[2] = "a.`emp_lastname`";
$arrFieldList[3] = "a.`emp_middle_name`";
$arrFieldList[4] = "LPAD(a.`emp_number`, " . $this->employeeIdLength . ", 0)";
$arrFieldList[5] = "a.`work_station`";
$arrFieldList[6] = "c.`jobtit_name`";
$arrFieldList[7] = "CONCAT(a.`emp_firstname`, ' ', a.`emp_middle_name`, ' ', a.`emp_lastname`)";
$arrFieldList[8] = "d.`title`";
$arrFieldList[9] = "e.`estat_name`";
/* First show direct supervisors then indirect supervisors */
$arrFieldList[10] = "GROUP_CONCAT(g.`emp_firstname`, ' ', g.`emp_lastname` ORDER BY erep_reporting_mode ) AS Supervisor";
$sql_builder = new SQLQBuilder();
$arrTables[0] = "`hs_hr_employee` a";
$arrTables[1] = "`hs_hr_job_title` c";
$arrTables[2] = "`hs_hr_compstructtree` d";
$arrTables[3] = "`hs_hr_empstat` e";
$arrTables[4] = "`hs_hr_emp_reportto` f";
$arrTables[5] = "`hs_hr_employee` g";
$joinConditions[1] = "a.`job_title_code` = c.`jobtit_code`";
$joinConditions[2] = "a.`work_station` = d.`id`";
$joinConditions[3] = "a.`emp_status` = e.`estat_code`";
$joinConditions[4] = "a.`emp_number` = f.`erep_sub_emp_number`";
$joinConditions[5] = "f.`erep_sup_emp_number` = g.`emp_number`";
$selectConditions = null;
$filteredSearch = mysql_real_escape_string($schStr);
/*
* Skip setting select conditions if no search string set, no search mode set
* or if searching by supservisor (mode = 8)
*
* If searching by supervisor, the conditions are set in the outer SELECT statement.
*/
if (($mode != -1) && ($mode != 8) && !empty ($schStr)) {
if ($mode == 7) {
// Special handling for search by subdivision.
// Get list of workstations with matches in the title or matches higher in the hierachy
$subdivisionIds = $this->_getMatchingSubdivisionIds($schStr);
// Create select condition for employees with workstation set to any of the
// subdivisions
if (isset ($subdivisionIds) && !empty ($subdivisionIds)) {
$selectConditions[] = "a.`work_station` IN (" . $subdivisionIds . ") ";
} else {
// No subdivisions matches found.
return '';
}
} else {
$selectConditions[] = "{$arrFieldList[$mode]} LIKE '" . $filteredSearch . "%'";
}
}
/**
* Check whether searching for the employement status,
* if not add this to not to show 'Terminated' employees
*/
if ($mode != 9) {
$selectConditions[] = "(a.`emp_status` != 'EST000' OR a.`emp_status` IS NULL)";
}
/* If supervisor ID is set, filter by that supervisor */
if (!empty ($supervisorId)) {
$selectConditions[] = "(f.`erep_sup_emp_number` = '$supervisorId')";
}
$sysConst = new sysConf();
$limit = null;
if ($pageNO > 0) {
$pageNO--;
$pageNO *= $sysConst->itemsPerPage;
$limit = "{$pageNO}, {$sysConst->itemsPerPage}";
}
/* We need to group to get the concatenated list of supervisor names */
$groupBy = "a.`emp_number` ";
/* Don't order if searching by supervisor. The order by has
* to be added to the outer SELECT.
*/
if ($sortField == 10) {
$selectOrder = null;
$selectOrderBy = null;
} else {
$selectOrder = $sortOrder;
$selectOrderBy = $arrFieldList[$sortField];
}
$sqlQString = $sql_builder->selectFromMultipleTable($arrFieldList, $arrTables, $joinConditions, $selectConditions, null, $selectOrderBy, $selectOrder, null, $groupBy);
/* Add the outer SELECT */
$sqlQString = "SELECT * FROM ( $sqlQString ) AS subsel ";
/* If searching by supervisor add the condition now */
if ($mode == 8 && !empty ($schStr)) {
$sqlQString .= " WHERE Supervisor LIKE '%${filteredSearch}%' ";
}
/* If sorting by supervisor add the order by condition */
if ($sortField == 10) {
$sqlQString .= " ORDER BY Supervisor $sortOrder";
}
/* Add the search limit */
if (isset ($limit)) {
$sqlQString .= " LIMIT $limit";
}
$dbConnection = new DMLFunctions();
$message2 = $dbConnection->executeQuery($sqlQString); //Calling the addData() function
$i = 0;
while ($line = mysql_fetch_array($message2, MYSQL_NUM)) {
$arrayDispList[$i][0] = $line[0];
$arrayDispList[$i][1] = $line[1] . ' ' . $line[3] . ' ' . $line[2];
$arrayDispList[$i][2] = $line[4];
$arrayDispList[$i][3] = $line[5];
$arrayDispList[$i][4] = $line[6];
$arrayDispList[$i][6] = $line[9];
$arrayDispList[$i][5] = $line[10];
$i++;
}
if (isset ($arrayDispList)) {
return $arrayDispList;
} else {
$arrayDispList = '';
return $arrayDispList;
}
}
function countEmployee($schStr = '', $mode = 0) {
$arrFieldList[0] = "a.`employee_id`";
$arrFieldList[1] = "a.`emp_firstname`";
$arrFieldList[2] = "a.`emp_lastname`";
$arrFieldList[3] = "a.`emp_middle_name`";
$arrFieldList[4] = "LPAD(a.`emp_number`, " . $this->employeeIdLength . ", 0)";
$arrFieldList[5] = "a.`work_station`";
$arrFieldList[6] = "c.`jobtit_name`";
$arrFieldList[7] = "CONCAT(a.`emp_firstname`, ' ', a.`emp_middle_name`, ' ', a.`emp_lastname`)";
$arrFieldList[8] = "d.`title`";
$arrFieldList[9] = "e.`estat_name`";
$arrTables[0] = "`hs_hr_employee` a";
$arrTables[1] = "`hs_hr_job_title` c";
$arrTables[2] = "`hs_hr_compstructtree` d";
$arrTables[3] = "`hs_hr_empstat` e";
$joinConditions[1] = "a.`job_title_code` = c.`jobtit_code`";
$joinConditions[2] = "a.`work_station` = d.`id`";
$joinConditions[3] = "a.`emp_status` = e.`estat_code`";
$selectConditions = null;
if (($mode != -1) && !empty ($schStr)) {
$filteredSearch = mysql_real_escape_string($schStr);
if ($mode == 6) {
// Need to join extra tables if searching by job title
$arrTables[1] = "`hs_hr_job_title` c";
$joinConditions[1] = "a.`job_title_code` = c.`jobtit_code`";
$selectConditions[] = "c.`jobtit_name` LIKE '" . $filteredSearch . "%'";
} else
if ($mode == 7) {
// search by subdivision
// Get list of workstations with matches in the title or matches higher in the hierachy
$subdivisionIds = $this->_getMatchingSubdivisionIds($filteredSearch);
// Create select condition for employees with workstation set to any of the subdivisions
if (isset ($subdivisionIds) && !empty ($subdivisionIds)) {
$selectConditions[] = "a.`work_station` IN (" . $subdivisionIds . ") ";
} else {
// no matches. Return 0
return 0;
}
} else
if ($mode == 8) {
// search by supervisor
$empNumbers = $this->_getEmpIdsWithMatchingSupervisor($filteredSearch);
if (isset ($empNumbers) && !empty ($empNumbers)) {
$selectConditions[] = "a.`emp_number` IN (" . $empNumbers . ") ";
} else {
// No subordinates found with with supervisor matching search string.
return 0;
}
} else {
$selectConditions[] = "{$arrFieldList[$mode]} LIKE '" . $filteredSearch . "%'";
}
}
$sql_builder = new SQLQBuilder();
$sqlQString = $sql_builder->countFromMultipleTables($arrTables, $joinConditions, $selectConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($sqlQString);
$resultSet = mysql_fetch_array($result, MYSQL_NUM);
$count = $resultSet[0];
return $count;
}
function getLastId() {
$tableName = 'HS_HR_EMPLOYEE';
$lastId = UniqueIDGenerator :: getInstance()->getLastID($tableName, 'EMP_NUMBER');
return str_pad(((int) $lastId) + 1, $this->employeeIdLength, "0", STR_PAD_LEFT);
}
function getEmployeeIdLength() {
$confObj = new Conf();
if (isset ($confObj->maxEmp)) {
return strlen($confObj->maxEmp);
}
return 6;
}
function delEmployee($arrList) {
$tableName = 'HS_HR_EMPLOYEE';
$arrFieldList[0] = 'EMP_NUMBER';
$sql_builder = new SQLQBuilder();
$sql_builder->table_name = $tableName;
$sql_builder->flg_delete = 'true';
$sql_builder->arr_delete = $arrFieldList;
$sqlQString = $sql_builder->deleteRecord($arrList);
//echo $sqlQString;
$dbConnection = new DMLFunctions();
$message2 = $dbConnection->executeQuery($sqlQString); //Calling the addData() function
return $message2;
}
function filterEmpMain($getID) {
$this->getID = $getID;
$tableName = 'HS_HR_EMPLOYEE';
$arrFieldList[0] = 'EMP_NUMBER';
$arrFieldList[1] = 'EMP_LASTNAME';
$arrFieldList[2] = 'EMP_FIRSTNAME';
$arrFieldList[3] = 'EMP_MIDDLE_NAME';
$arrFieldList[4] = 'EMP_NICK_NAME';
$arrFieldList[5] = 'EMPLOYEE_ID';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -