LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

61 lines
2.6 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 = '' ;
if ( $array['search'] != '' ){
$search_query .= " AND ( a.remark LIKE '%".$array['search']."%' OR b.title LIKE '%".$array['search']."%' )" ;
}
$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']."' AND ( a.created_branch_id = '".$array['branch_id']."' AND a.created_by = '".$staff_info['staff_id']."' ) " . $search_query ;
$mysqli_query = $mysqli->query( $query . " ORDER BY a.adjustment_id DESC LIMIT " . getLimit( $current ) ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$list = [] ;
while ( $row = $mysqli_query->fetch_assoc() ){
$row['department'] = $department_list[ $row['department_id'] ] ;
$row['created_by_name'] = $staff_list[ $row['created_by'] ] ;
$list[] = $row ;
}
$data['list'] = $list ;
}
}
require( $require_sub.'footer.php' ) ;
?>