72 lines
3.1 KiB
PHP
72 lines
3.1 KiB
PHP
<?php
|
|
$must_login = true ;
|
|
$require_path = '../../../' ;
|
|
$require_sub = '../../' ;
|
|
require( $require_sub.'header.php' ) ;
|
|
|
|
if ( $boolean_login ){
|
|
$status = '201' ;
|
|
|
|
|
|
// select all department
|
|
$department_list = [] ;
|
|
$select = $mysqli->query( "SELECT a.department_id, b.department_desc FROM setting_department a
|
|
LEFT JOIN setting_department_translation b ON ( a.department_id = b.department_id )
|
|
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."'" ) ;
|
|
if ( $select->num_rows > 0 ){
|
|
while ( $row = $select->fetch_assoc() ){
|
|
$department_list[$row['department_id']] = $row['department_desc'] ;
|
|
}
|
|
}
|
|
|
|
// select all staff
|
|
$staff_list = [] ;
|
|
$select = $mysqli->query( "SELECT a.staff_id, a.staff_name, a.staff_shortname, a.staff_idno FROM staff a
|
|
WHERE a.deleted_at IS NULL AND ( a.staff_date_resigned >= '".date("Y-m-d",time())."' OR a.staff_date_resigned = '0000-00-00' OR a.staff_date_resigned IS NULL )" ) ;
|
|
if ( $select->num_rows > 0 ){
|
|
while ( $row = $select->fetch_assoc() ){
|
|
$staff_list[$row['staff_id']] = $row['staff_shortname'] . ' ( '.$row['staff_idno'].' )' ;
|
|
}
|
|
}
|
|
|
|
|
|
$search_query = '' ;
|
|
$search_query .= " AND a.adjustment_id = '".$array['adjustment_id']."'" ;
|
|
|
|
$query = "SELECT a.adjustment_id, a.adjustment_so, a.adjustment_type, a.created_by, a.department_id, a.point, a.remark, a.created_at, b.title FROM staff_adjustment a
|
|
LEFT JOIN setting_adjustment_translation b ON ( a.setting_adjustment_id = b.adjustment_id )
|
|
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' " . $search_query ;
|
|
$mysqli_query = $mysqli->query( $query . " LIMIT 1" ) ;
|
|
|
|
if ( $mysqli_query->num_rows > 0 ){
|
|
|
|
$status = '200' ;
|
|
|
|
$row = $mysqli_query->fetch_assoc() ;
|
|
|
|
$search_query2 = '' ;
|
|
if ( $row['created_by'] != $staff_info['staff_id'] ){
|
|
$search_query2 .= " AND staff_id = '".$staff_info['staff_id']."'" ;
|
|
}
|
|
|
|
$related_staff = [] ;
|
|
$select_related = $mysqli->query( "SELECT staff_id FROM staff_adjustment_point
|
|
WHERE deleted_at IS NULL AND adjustment_id = '".$array['adjustment_id']."'" . $search_query2 ) ;
|
|
|
|
if ( $select_related->num_rows > 0 ){
|
|
while ( $row_related = $select_related->fetch_assoc() ){
|
|
$related_staff[] = $staff_list[$row_related['staff_id']] ;
|
|
}
|
|
}
|
|
|
|
$row['title'] = dataFilter( $row['title'] ) ;
|
|
$row['department'] = $department_list[ $row['department_id'] ] ;
|
|
$row['created_by_name'] = $staff_list[ $row['created_by'] ] ;
|
|
$row['related_staff'] = $related_staff ;
|
|
$data = $row ;
|
|
|
|
}
|
|
}
|
|
|
|
require( $require_sub.'footer.php' ) ;
|
|
?>
|