query("SELECT * FROM setting_salary_tax WHERE deleted_at IS NULL");
while($row_tax = mysqli_fetch_assoc($get_salary_tax)){
if($row_tax['tax_type'] == 'EPF'){
$epf_rate[$row_tax['tax_id']] = [
'title' => $row_tax['tax_title'],
'employee_rate' => $row_tax['employee_rate'],
'employer_rate' => $row_tax['employer_rate'],
];
}else if($row_tax['tax_type'] == 'SOCSO'){
$socso_rate[$row_tax['tax_id']] = [
'title' => $row_tax['tax_title'],
'employee_rate' => $row_tax['employee_rate'],
'employer_rate' => $row_tax['employer_rate'],
];
}else if($row_tax['tax_type'] == 'EIS'){
$eis_rate[$row_tax['tax_id']] = [
'title' => $row_tax['tax_title'],
'employee_rate' => $row_tax['employee_rate'],
'employer_rate' => $row_tax['employer_rate'],
];
}else if($row_tax['tax_type'] == 'ZAKAT'){
$zakat_rate[$row_tax['tax_id']] = [
'title' => $row_tax['tax_title'],
'employee_rate' => $row_tax['employee_rate'],
'employer_rate' => $row_tax['employer_rate'],
];
}
}
// get all gender
$gender = [] ;
$get_gender = $mysqli->query("SELECT * FROM master_gender
WHERE deleted_at IS NULL") ;
if ( $get_gender->num_rows > 0 ){
while ( $row_gender = $get_gender->fetch_assoc() ){
$gender[$row_gender['gender_id']] = $row_gender['gender_desc'] ;
}
}
// get all position
$position = [] ;
$get_position = $mysqli->query("SELECT a.job_position_id, a.job_position_code, b.job_position_desc FROM setting_job_position a
LEFT JOIN setting_job_position_translation b ON ( a.job_position_id = b.job_position_id )
WHERE a.deleted_at IS NULL AND b.lang = 'en'") ;
if ( $get_position->num_rows > 0 ){
while ( $row_position = $get_position->fetch_assoc() ){
$position[$row_position['job_position_id']] = $row_position['job_position_code'] . ' ( ' . $row_position['job_position_desc'] . ' )' ;
}
}
// get all section
$section = [] ;
$get_section = $mysqli->query("SELECT a.job_section_id, a.job_section_code, b.job_section_desc FROM setting_job_section a
LEFT JOIN setting_job_section_translation b ON ( a.job_section_id = b.job_section_id )
WHERE a.deleted_at IS NULL AND b.lang = 'en'") ;
if ( $get_section->num_rows > 0 ){
while ( $row_section = $get_section->fetch_assoc() ){
$section[$row_section['job_section_id']] = $row_section['job_section_code'] . ' ( ' . $row_section['job_section_desc'] . ' )' ;
}
}
// get all job status
$job_status = [] ;
$get_job_status = $mysqli->query("SELECT * FROM master_job_status
WHERE deleted_at IS NULL") ;
if ( $get_job_status->num_rows > 0 ){
while ( $row_job_status = $get_job_status->fetch_assoc() ){
$job_status[$row_job_status['job_status_id']] = $row_job_status['job_status_desc'] ;
}
}
// get all country
$country = [] ;
$get_country = $mysqli->query("SELECT * FROM master_country
WHERE deleted_at IS NULL") ;
if ( $get_country->num_rows > 0 ){
while ( $row_country = $get_country->fetch_assoc() ){
$country[$row_country['country_id']] = $row_country['country_desc'] ;
}
}
// get all working group
$working_group = [] ;
$get_working_group = $mysqli->query("SELECT * FROM setting_working_group
WHERE deleted_at IS NULL") ;
if ( $get_working_group->num_rows > 0 ){
while ( $row_working_group = $get_working_group->fetch_assoc() ){
$working_group[$row_working_group['group_id']] = $row_working_group['group_name'] ;
}
}
// get all branch
$branch = [] ;
$get_branch = $mysqli->query("SELECT * FROM branch
WHERE deleted_at IS NULL".$user_branch_permission_sql) ;
if ( $get_branch->num_rows > 0 ){
while ( $row_branch = $get_branch->fetch_assoc() ){
$branch[$row_branch['branch_id']] = $row_branch['branch_name'] ;
}
}
// get all requires
$get_user_tier = userTierQuery( $row_user ) ;
$tier_list = [] ;
$tier_list_id = [] ;
$mysqli_tier = $mysqli->query("SELECT a.tier_id, b.title FROM profile_tier a
LEFT JOIN profile_tier_translation b ON ( a.tier_id = b.tier_id )
WHERE a.deleted_at IS NULL AND b.lang = 'en' ORDER BY a.sortable DESC") ;
if ( $mysqli_tier->num_rows > 0 ){
while ( $row_tier = $mysqli_tier->fetch_assoc() ){
$tier_list[] = $row_tier ;
$tier_list_id[$row_tier['tier_id']] = $row_tier['title'] ;
}
}
// get all requires
$department_list = [] ;
$mysqli_department = $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 = 'en' ORDER BY b.department_desc ASC") ;
if ( $mysqli_department->num_rows > 0 ){
while ( $row_department = $mysqli_department->fetch_assoc() ){
$department_list[] = $row_department ;
}
}
// mode type | all list | new | edit
switch($page_mode){
case 'staff-point-history' :
include 'hr-staff-point-history.php';
break;
// edit staff
case 'new' :
case 'edit' :
$active_menu = 'hr-staff-list' ;
// add permission
$search_query = '' ;
// if ( $_SESSION['system_permission'] != 'admin' ){
// if ( permissionCheck($row_user, 'staff-list-view') && permissionCheck($row_user, 'foreign-only') ){
// // do nothing
// }elseif ( permissionCheck($row_user, 'staff-list-view') ){
// $search_query .= " AND country_id = '1'" ;
// }else{
// $search_query .= " AND country_id != '1'" ;
// }
// }
// check query exsits
$submit_type = 'new' ;
$mysqli_page = $mysqli->query("SELECT * FROM staff
WHERE staff_id = '".$page."' ".$search_query." LIMIT 1");
if ($mysqli_page->num_rows > 0){
// keep query value in array
$row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ;
$submit_type = 'edit' ;
}else{
$page = '' ;
}
// trash passport / permit
if ( $_GET['staff_image'] == 'yes' && $_GET['staff_image_id'] != '' ){
$error_message = '
'.$lang['Sorry image not found'].'
' ;
$staff_image_id = escapeString($_GET['staff_image_id']) ;
$get_staff_image = $mysqli->query("SELECT * FROM staff_image
WHERE image_id = '".$staff_image_id."' LIMIT 1") ;
if ( $get_staff_image->num_rows > 0 ){
$mysqli->query("UPDATE staff_image SET
deleted_at = '".TODAYDATE."'
WHERE image_id = '".$staff_image_id."'") ;
$error_message = ''.$lang['Thank you image was removed'].'
' ;
}
// refresh page
header("Location:hr-staff.php?page_mode=edit&page=".$page) ;
$_SESSION['system_result'] = $error_message ;
exit ;
}
// update database
if ( isset($type) && ( $type == 'new' || $type == 'edit' ) && $_POST['hide'] == 1 ){
$error_message = ''.$lang['Please enter all required fill'].'
' ;
$message = '';
$staff_idno = escapeString($_POST['staff_idno']) ;
$staff_name = escapeString($_POST['staff_name']) ;
$staff_shortname = escapeString($_POST['staff_shortname']) ;
$staff_mobileno = escapeString($_POST['staff_mobileno']) ;
$staff_birthdate = escapeString($_POST['staff_birthdate']) ;
$staff_date_joined = escapeString($_POST['staff_date_joined']) ;
$staff_tier = escapeString($_POST['staff_tier']) ;
$staff_probation_end = escapeString($_POST['staff_probation_end']) ;
$staff_effective_date = escapeString($_POST['staff_effective_date']) ;
$staff_salary_nextreview_date = escapeString($_POST['staff_salary_nextreview_date']) ;
$staff_salary_effective_date = escapeString($_POST['staff_salary_effective_date']) ;
$staff_username = escapeString($_POST['staff_username']) ;
$staff_email = escapeString($_POST['staff_email']) ;
$password = escapeString($_POST['password']) ;
$passwordnotmatch = escapeString($_POST['passwordnotmatch']) ;
$staff_covid = escapeString($_POST['staff_covid']) ;
$staff_covid_test = escapeString($_POST['staff_covid_test']) ;
$staff_fonema = escapeString($_POST['staff_fonema']) ;
$staff_typhoid = escapeString($_POST['staff_typhoid']) ;
$staff_fenoma_period = escapeString($_POST['staff_fenoma_period']) ;
$country_id = $_POST['country_id'] ;
$staff_icno = escapeString($_POST['staff_icno']) ;
$staff_passportno = escapeString($_POST['staff_passportno']) ;
$staff_passportexpired = escapeString($_POST['staff_passportexpired']) ;
$old_staff_group[0] = false;
// if ( $staff_idno != '' && $staff_name != '' && $staff_shortname != '' && $staff_username != '' && $staff_mobileno != '' && $staff_birthdate != '' && $staff_tier != '' && $staff_date_joined != '' ){
//if( ($country_id == '1' && $staff_icno != '') || ( $country_id != '' && $staff_passportno != '' && $staff_passportexpired != '') ){
// check if email not exists
if ( $staff_email != '' ){
$check_email = $mysqli->query("SELECT * FROM staff
WHERE deleted_at IS NULL AND staff_id != '".$page."' AND staff_email = '".$staff_email."' LIMIT 1") ;
if ( $check_email->num_rows > 0 ){
$error_message .= ''.$lang['Sorry email already exists'].'
' ;
}
}
// check if username not exists
if ( $staff_username != '' ){
$check_username = $mysqli->query("SELECT * FROM staff
WHERE deleted_at IS NULL AND staff_id != '".$page."' AND staff_username = '".$staff_username."' LIMIT 1") ;
if ( $check_username->num_rows > 0 ){
$error_message .= ''.$lang['Sorry username already exists'].'
' ;
}
}
// check if staff idno not exists
if ( $staff_idno != '' ){
$check_idno = $mysqli->query("SELECT * FROM staff
WHERE deleted_at IS NULL AND staff_id != '".$page."' AND staff_idno = '".$staff_idno."' LIMIT 1") ;
if ( $check_idno->num_rows > 0 ){
$error_message .= ''.$lang['Sorry idno already exists'].'
' ;
}
}
$check_group = $mysqli->query("SELECT * FROM staff
WHERE deleted_at IS NULL AND staff_id = '".$page."' LIMIT 1") ;
if ( $check_group->num_rows > 0 ){
$row = $check_group->fetch_array(MYSQLI_ASSOC);
if ( $row['group_id'] != $_POST['group_id'] ){
$old_staff_group[0] = true;
$old_staff_group[1] = [
"old" => $row['group_id'],
"new" => $_POST['group_id'],
];
}
}
// if ( $password != '' && $password != $passwordnotmatch ){
// $error_message .= ''.$lang['Sorry password doesnt exists'].'
' ;
// }
// save staff data
if ( $error_message != '' ){
$error = 0 ;
$mysqli->autocommit( false ) ;
$update_query = '' ;
try {
// new staff
if ( $page == '' ){
$mysqli->query("INSERT INTO staff (created_at) VALUES ('".TODAYDATE."')") ;
$page = $mysqli->insert_id ;
}
// password
if ( $password != '' ){
$staff_password = passwordEncrypt($password) ;
$update_query .= "staff_password = '".$staff_password."'," ;
}
// staff settings
$staff_settings = [
'ismanager' => ( $_POST['staff_setting_ismanager'] == 'yes' ? 'yes' : 'no' ),
'ishrmanager' => ( $_POST['staff_setting_ishrmanager'] == 'yes' ? 'yes' : 'no' ),
'warning' => ( $_POST['staff_setting_warning'] == 'yes' ? 'yes' : 'no' ),
'switchbranch' => ( $_POST['staff_setting_switchbranch_card'] == 'yes' ? 'yes' : 'no' ),
'reporttaskbranch' => ( $_POST['staff_setting_reporttaskbranch_card'] == 'yes' ? 'yes' : 'no' ),
'reportadjustmentbranch' => ( $_POST['staff_setting_reportadjustmentbranch_card'] == 'yes' ? 'yes' : 'no' ),
'punch' => ( $_POST['staff_setting_punch_card'] == 'yes' ? 'yes' : 'no' ),
'without_geometry' => ( $_POST['staff_setting_without_geometry'] == 'yes' ? 'yes' : 'no' ),
'checkrecruitment' => ( $_POST['staff_setting_checkrecruitment'] == 'yes' ? 'yes' : 'no' ),
'checkassociation' => ( $_POST['staff_setting_checkassociation'] == 'yes' ? 'yes' : 'no' ),
'checktraining' => ( $_POST['staff_setting_checktraining'] == 'yes' ? 'yes' : 'no' ),
'approvevisitation' => ( $_POST['staff_setting_approvevisitation'] == 'yes' ? 'yes' : 'no' ),
'checkvisitation' => ( $_POST['staff_setting_checkvisitation'] == 'yes' ? 'yes' : 'no' ),
'vcard_mode' => ( $_POST['staff_setting_vcard_mode'] == '1' ? '1' : ( $_POST['staff_setting_vcard_mode'] == '2' ? '2' : '3' ) ),
'marital_status' => escapeString($_POST['marital_status']),
'mailing_address' => escapeString($_POST['mailing_address']),
'income_tax_no' => escapeString($_POST['income_tax_no']),
'spouse_name' => escapeString($_POST['spouse_name']),
'spouse_ic' => escapeString($_POST['spouse_ic']),
'spouse_working' => escapeString($_POST['spouse_working']),
'spouse_income_tax' => escapeString($_POST['spouse_income_tax']),
'no_children' => escapeString($_POST['no_children']),
] ;
$staff_settings = json_encode($staff_settings) ;
// resize image
// set image in variable
$image = $_FILES["staff_image"]["name"] ;
$image_query = '' ;
$remove_photo = $_POST['remove_photo'] ;
if ($remove_photo == 1){
$image = '' ;
$image_query = "staff_image = ''," ;
}
$create_image = reCreateImage('Staff', $page, $page, '', $image, $_FILES["staff_image"]["type"], $_FILES['staff_image']['tmp_name']) ;
// Image uploads when exists
if ($create_image['result'] && is_array($create_image['crop']) && count($create_image['result']) > 0){
$resizeObj = new resize($create_image['original']) ; // Initialise load image
foreach($create_image['crop'] as $value){
// Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage($value['width'], $value['height'], $value['type']) ;
$resizeObj -> saveImage($value['source'], 70) ; // Save image
}
$image_query = "staff_image = '".$create_image['image']."'," ;
}
//Array ( [name] => Array ( [0] => addon-apk.pdf ) [type] => Array ( [0] => application/pdf ) [tmp_name] => Array ( [0] => /tmp/phpy5FLEr ) [error] => Array ( [0] => 0 ) [size] => Array ( [0] => 314338 ) )
// passport image
$passportimages = $_FILES['passportimages'] ;
if ( arrayCheck($passportimages['name']) ){
foreach ( $passportimages['name'] as $k => $v ){
$image = $v ;
if ( $_FILES['passportimages']['type'][$k] == 'application/pdf' ){
$new_image = 'ppd-'.$k.'-'.rand(000000, 999999).'-'.time().'.pdf' ;
copy( $_FILES['passportimages']['tmp_name'][$k], 'uploads/StaffImage/'.$new_image ) ;
$mysqli->query("INSERT INTO staff_image
(staff_id, type, file_name, created_at, updated_at) VALUES
('".$page."', 'passport', '".$new_image."', '".TODAYDATE."', '".TODAYDATE."')") ;
}else{
$create_image = reCreateImage('StaffImage', $page, 'ppi-'.$k.'-'.rand(000000, 999999).'-'.time(), '', $image, $_FILES['passportimages']["type"][$k], $_FILES['passportimages']['tmp_name'][$k]) ;
// Image uploads when exists
if ($create_image['result'] && is_array($create_image['crop']) && count($create_image['result']) > 0){
$resizeObj = new resize($create_image['original']) ; // Initialise load image
foreach($create_image['crop'] as $value){
// Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage($value['width'], $value['height'], $value['type']) ;
$resizeObj -> saveImage($value['source'], 70) ; // Save image
}
$mysqli->query("INSERT INTO staff_image
(staff_id, type, file_name, created_at, updated_at) VALUES
('".$page."', 'passport', '".$create_image['image']."', '".TODAYDATE."', '".TODAYDATE."')") ;
}
}
}
}
// permit image
$permitimages = $_FILES['permitimages'] ;
if ( arrayCheck($permitimages['name']) ){
foreach ( $permitimages['name'] as $k => $v ){
$image = $v ;
if ( $_FILES['permitimages']['type'][$k] == 'application/pdf' ){
$permit_pdf = 'pd-'.$k.'-'.rand(000000, 999999).'-'.time().'.pdf' ;
copy( $_FILES['permitimages']['tmp_name'][$k], 'uploads/StaffImage/'.$permit_pdf ) ;
$mysqli->query("INSERT INTO staff_image
(staff_id, type, file_name, created_at, updated_at) VALUES
('".$page."', 'permit', '".$permit_pdf."', '".TODAYDATE."', '".TODAYDATE."')") ;
}
else{
$create_image = reCreateImage('StaffImage', $page, 'pi-'.$k.'-'.rand(000000, 999999).'-'.time(), '', $image, $_FILES['permitimages']["type"][$k], $_FILES['permitimages']['tmp_name'][$k]) ;
// Image uploads when exists
if ($create_image['result'] && is_array($create_image['crop']) && count($create_image['result']) > 0){
$resizeObj = new resize($create_image['original']) ; // Initialise load image
foreach($create_image['crop'] as $value){
// Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage($value['width'], $value['height'], $value['type']) ;
$resizeObj -> saveImage($value['source'], 70) ; // Save image
}
$mysqli->query("INSERT INTO staff_image
(staff_id, type, file_name, created_at, updated_at) VALUES
('".$page."', 'permit', '".$create_image['image']."', '".TODAYDATE."', '".TODAYDATE."')") ;
}
}
}
}
// update database
$mysqli->query("UPDATE staff SET
".$update_query."
".$image_query."
staff_idno = '".$staff_idno."',
staff_name = '".$staff_name."',
staff_shortname = '".$staff_shortname."',
staff_email = '".$staff_email."',
staff_username = '".$staff_username."',
staff_mobileno = '".$staff_mobileno."',
gender_id = '".escapeString($_POST['gender_id'])."',
staff_birthdate = '".escapeString($_POST['staff_birthdate'])."',
country_id = '".escapeString($_POST['country_id'])."',
staff_icno = '".escapeString($_POST['staff_icno'])."',
staff_passportno = '".escapeString($_POST['staff_passportno'])."',
staff_passportexpired = '".escapeString($_POST['staff_passportexpired'])."',
religion_id = '".escapeString($_POST['religion_id'])."',
ethnic_id = '".escapeString($_POST['ethnic_id'])."',
staff_date_joined = '".escapeString($_POST['staff_date_joined'])."',
staff_tier = '".escapeString($_POST['staff_tier'])."',
staff_date_confirmed = '".escapeString($_POST['staff_date_confirmed'])."',
staff_date_resigned = '".escapeString($_POST['staff_date_resigned'])."',
staff_run_away = '".escapeString($_POST['staff_run_away'])."',
staff_resign_reason = '".escapeString($_POST['staff_resign_reason'])."',
staff_probation_end = '".escapeString($_POST['staff_probation_end'])."',
job_position_id = '".escapeString($_POST['job_position_id'])."',
job_section_id = '".escapeString($_POST['job_section_id'])."',
staff_effective_date = '".escapeString($_POST['staff_effective_date'])."',
branch_id = '".escapeString($_POST['branch_id'])."',
leave_id = '".escapeString($_POST['leave_id'])."',
sick_id = '".escapeString($_POST['sick_id'])."',
group_id = '".escapeString($_POST['group_id'])."',
salary_id = '".escapeString($_POST['salary_id'])."',
job_type_id = '".escapeString($_POST['job_type_id'])."',
job_status_id = '".escapeString($_POST['job_status_id'])."',
work_type_id = '".escapeString($_POST['work_type_id'])."',
staff_permitno = '".escapeString($_POST['staff_permitno'])."',
staff_permit_start = '".escapeString($_POST['staff_permit_start'])."',
staff_permit_end = '".escapeString($_POST['staff_permit_end'])."',
staff_permit_effective_date = '".escapeString($_POST['staff_permit_effective_date'])."',
staff_salary = '".escapeString($_POST['staff_salary'])."',
staff_contract_salary = '".escapeString($_POST['staff_contract_salary'])."',
staff_allowance_topup = '".escapeString($_POST['staff_allowance_topup'])."',
staff_allowance_work = '".escapeString($_POST['staff_allowance_work'])."',
staff_allowance_food = '".escapeString($_POST['staff_allowance_food'])."',
staff_salary_nextreview_date = '".escapeString($_POST['staff_salary_nextreview_date'])."',
staff_salary_effective_date = '".escapeString($_POST['staff_salary_effective_date'])."',
bank_id = '".escapeString($_POST['bank_id'])."',
payment_type_id = '".escapeString($_POST['payment_type_id'])."',
payment_transfer_id = '".escapeString($_POST['payment_transfer_id'])."',
staff_accountno = '".escapeString($_POST['staff_accountno'])."',
staff_epf_rate = '".escapeString($_POST['staff_epf_rate'])."',
staff_epf_rate_id = '".escapeString($_POST['staff_epf_rate_id'])."',
staff_socso_rate_id = '".escapeString($_POST['staff_socso_rate_id'])."',
staff_eis_rate_id = '".escapeString($_POST['staff_eis_rate_id'])."',
staff_zakat_rate_id = '".escapeString($_POST['staff_zakat_rate_id'])."',
staff_epfno = '".escapeString($_POST['staff_epfno'])."',
staff_taxno = '".escapeString($_POST['staff_taxno'])."',
staff_child_relief = '".escapeString($_POST['staff_child_relief'])."',
staff_eis_status = '".escapeString($_POST['staff_eis_status'])."',
socso_category_id = '".escapeString($_POST['socso_category_id'])."',
tax_status_id = '".escapeString($_POST['tax_status_id'])."',
staff_muslim_zakat = '".escapeString($_POST['staff_muslim_zakat'])."',
staff_eis_status = '".escapeString($_POST['staff_eis_status'])."',
staff_settings = '".$staff_settings."',
staff_covid = '".$staff_covid."',
staff_covid_test = '".$staff_covid_test."',
staff_fonema = '".$staff_fonema."',
staff_fenoma_period = '".$staff_fenoma_period."',
staff_typhoid = '".$staff_typhoid."',
updated_at = '".TODAYDATE."'
WHERE staff_id = '".$page."'") ;
// knowledge check list
$knowledgelist = $_POST['knowledge'] ;
$mysqli->query("DELETE FROM staff_knowledge
WHERE staff_id = '".$page."'") ;
if( !empty($knowledgelist) ){
for ( $i = 0 ; $i < count($knowledgelist) ; $i++ ){
$mysqli->query("INSERT INTO staff_knowledge
(staff_id, knowledge_id, created_at, updated_at) VALUES
('".$page."', '".$knowledgelist[$i]."', '".TODAYDATE."', '".TODAYDATE."')") ;
}
}
// department check list
$departmentlist = $_POST['department'] ;
$mysqli->query("DELETE FROM staff_department
WHERE staff_id = '".$page."'") ;
if( !empty($departmentlist) ){
for ( $i = 0 ; $i < count($departmentlist) ; $i++ ){
$mysqli->query("INSERT INTO staff_department
(staff_id, department_id, created_at, updated_at) VALUES
('".$page."', '".$departmentlist[$i]."', '".TODAYDATE."', '".TODAYDATE."')") ;
}
}
// hostel check list
$hostellist = $_POST['hostel'] ;
$mysqli->query("DELETE FROM staff_hostel
WHERE staff_id = '".$page."'") ;
if( !empty($hostellist) ){
for ( $i = 0 ; $i < count($hostellist) ; $i++ ){
$mysqli->query("INSERT INTO staff_hostel
(staff_id, hostel_id, created_at, updated_at) VALUES
('".$page."', '".$hostellist[$i]."', '".TODAYDATE."', '".TODAYDATE."')") ;
}
}
// add system log
$array_remark = array('old' => array('staff_name' => $row_page['staff_name']),
'new' => array('staff_name' => $staff_name)) ;
}catch( Exception $e ){
$error_message .= ''.$lang['Sorry something error'].' ('.$e.').
' ;
$error++;
}
if( $error == 0 ) {
// commit query
$mysqli->commit() ;
$error_message = ''.$lang['Thank you your staff has been updated'].'
' ;
}else{
$mysqli->rollback() ;
}
}
//}else{
//$error_message ;
//}
// }
// refresh page
header("Location:hr-staff.php?page_mode=edit&page=".$page) ;
$_SESSION['system_result'] = $error_message ;
exit ;
}
// get all ethnic
$ethnic = [] ;
$get_ethnic = $mysqli->query("SELECT * FROM master_ethnic
WHERE deleted_at IS NULL") ;
if ( $get_ethnic->num_rows > 0 ){
while ( $row_ethnic = $get_ethnic->fetch_assoc() ){
$ethnic[$row_ethnic['ethnic_id']] = $row_ethnic['ethnic_desc'] ;
}
}
// get all religion
$religion = [] ;
$get_religion = $mysqli->query("SELECT * FROM master_religion
WHERE deleted_at IS NULL") ;
if ( $get_religion->num_rows > 0 ){
while ( $row_religion = $get_religion->fetch_assoc() ){
$religion[$row_religion['religion_id']] = $row_religion['religion_desc'] ;
}
}
// get all leave
$leave = [] ;
$get_leave = $mysqli->query("SELECT * FROM setting_leave
WHERE deleted_at IS NULL") ;
if ( $get_leave->num_rows > 0 ){
while ( $row_leave = $get_leave->fetch_assoc() ){
$leave[$row_leave['leave_id']] = $row_leave['leave_name'] ;
}
}
// get all sick
$sick = [] ;
$get_sick = $mysqli->query("SELECT * FROM setting_sick
WHERE deleted_at IS NULL") ;
if ( $get_sick->num_rows > 0 ){
while ( $row_sick = $get_sick->fetch_assoc() ){
$sick[$row_sick['sick_id']] = $row_sick['sick_name'] ;
}
}
// get all job type
$job_type = [] ;
$get_job_type = $mysqli->query("SELECT * FROM master_job_type
WHERE deleted_at IS NULL") ;
if ( $get_job_type->num_rows > 0 ){
while ( $row_job_type = $get_job_type->fetch_assoc() ){
$job_type[$row_job_type['job_type_id']] = $row_job_type['job_type_desc'] ;
}
}
// get all work days
$work_type = [] ;
$get_work_type = $mysqli->query("SELECT * FROM master_work_type
WHERE deleted_at IS NULL") ;
if ( $get_work_type->num_rows > 0 ){
while ( $row_work_type = $get_work_type->fetch_assoc() ){
$work_type[$row_work_type['work_type_id']] = $row_work_type['work_type_desc'] ;
}
}
// get all chief
$chief = [] ;
$get_chief = $mysqli->query("SELECT * FROM setting_chief
WHERE deleted_at IS NULL") ;
if ( $get_chief->num_rows > 0 ){
while ( $row_chief = $get_chief->fetch_assoc() ){
$chief[$row_chief['chief_id']] = $row_chief['chief_desc'] ;
}
}
// get all bank
$bank = [] ;
$get_bank = $mysqli->query("SELECT * FROM master_bank
WHERE deleted_at IS NULL") ;
if ( $get_bank->num_rows > 0 ){
while ( $row_bank = $get_bank->fetch_assoc() ){
$bank[$row_bank['bank_id']] = $row_bank['bank_desc'] ;
}
}
// get all payment transfer
$payment_transfer = [] ;
$get_payment_transfer = $mysqli->query("SELECT * FROM master_payment_transfer
WHERE deleted_at IS NULL") ;
if ( $get_payment_transfer->num_rows > 0 ){
while ( $row_payment_transfer = $get_payment_transfer->fetch_assoc() ){
$payment_transfer[$row_payment_transfer['payment_transfer_id']] = $row_payment_transfer['payment_transfer_desc'] ;
}
}
// get all payment transfer
$payment_type = [] ;
$get_payment_type = $mysqli->query("SELECT * FROM master_payment_type
WHERE deleted_at IS NULL") ;
if ( $get_payment_type->num_rows > 0 ){
while ( $row_payment_type = $get_payment_type->fetch_assoc() ){
$payment_type[$row_payment_type['payment_type_id']] = $row_payment_type['payment_type_desc'] ;
}
}
// get all payment transfer
$socso_category = [] ;
$get_socso_category = $mysqli->query("SELECT * FROM master_socso_category
WHERE deleted_at IS NULL") ;
if ( $get_socso_category->num_rows > 0 ){
while ( $row_socso_category = $get_socso_category->fetch_assoc() ){
$socso_category[$row_socso_category['socso_category_id']] = $row_socso_category['socso_category_desc'] ;
}
}
// get all payment transfer
$tax_status = [] ;
$get_tax_status = $mysqli->query("SELECT * FROM master_tax_status
WHERE deleted_at IS NULL") ;
if ( $get_tax_status->num_rows > 0 ){
while ( $row_tax_status = $get_tax_status->fetch_assoc() ){
$tax_status[$row_tax_status['tax_status_id']] = $row_tax_status['tax_status_desc'] ;
}
}
// get all knowledge
$knowledge = [] ;
$get_knowledge = $mysqli->query("SELECT * FROM setting_knowledge
WHERE deleted_at IS NULL") ;
if ( $get_knowledge->num_rows > 0 ){
while ( $row_knowledge = $get_knowledge->fetch_assoc() ){
$knowledge[$row_knowledge['knowledge_id']] = $row_knowledge['knowledge_desc'] ;
}
}
// get all hostel
$hostel = [] ;
$get_hostel = $mysqli->query("SELECT * FROM setting_hostel
WHERE deleted_at IS NULL") ;
if ( $get_hostel->num_rows > 0 ){
while ( $row_hostel = $get_hostel->fetch_assoc() ){
$hostel[$row_hostel['hostel_id']] = $row_hostel['hostel_desc'] ;
}
}
// get all department
$department = [] ;
$get_department = $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 = 'en'") ;
if ( $get_department->num_rows > 0 ){
while ( $row_department = $get_department->fetch_assoc() ){
$department[$row_department['department_id']] = $row_department['department_desc'] ;
}
}
// get selected knowledge
$selected_knowledge = [] ;
$get_selected_knowledge = $mysqli->query("SELECT * FROM staff_knowledge
WHERE deleted_at IS NULL AND staff_id = '".$page."'") ;
if ( $get_selected_knowledge->num_rows > 0 ){
while ( $row_selected_knowledge = $get_selected_knowledge->fetch_assoc() ){
$selected_knowledge[] = $row_selected_knowledge['knowledge_id'] ;
}
}
// get selected hostel
$selected_hostel = [] ;
$get_selected_hostel = $mysqli->query("SELECT * FROM staff_hostel
WHERE deleted_at IS NULL AND staff_id = '".$page."'") ;
if ( $get_selected_hostel->num_rows > 0 ){
while ( $row_selected_hostel = $get_selected_hostel->fetch_assoc() ){
$selected_hostel[] = $row_selected_hostel['hostel_id'] ;
}
}
// get selected department
$selected_department = [] ;
$get_selected_department = $mysqli->query("SELECT * FROM staff_department
WHERE deleted_at IS NULL AND staff_id = '".$page."'") ;
if ( $get_selected_department->num_rows > 0 ){
while ( $row_selected_department = $get_selected_department->fetch_assoc() ){
$selected_department[] = $row_selected_department['department_id'] ;
}
}
// default config
$default_config_punch = DEFAULTPUNCH ;
$staff_settings = $row_page['staff_settings'] ;
if ( $staff_settings != '' ){
$staff_settings = JsonEncodeDecode('decode', $staff_settings) ;
}else{
$staff_settings = [] ;
}
$passportimages = [] ;
$permitimages = [] ;
$get_staff_image = $mysqli->query("SELECT * FROM staff_image
WHERE deleted_at IS NULL AND staff_id = '".$page."'") ;
if ( $get_staff_image->num_rows > 0 ){
while ( $row_staff_image = $get_staff_image->fetch_assoc() ){
if ( $row_staff_image['type'] == 'passport' ){
$passportimages[$row_staff_image['image_id']] = $row_staff_image['file_name'] ;
}
if ( $row_staff_image['type'] == 'permit' ){
$permitimages[$row_staff_image['image_id']] = $row_staff_image['file_name'] ;
}
}
}
// start header here
include 'requires/page_header.php';
include 'requires/page_top.php';
?>
query("SELECT * FROM staff
// WHERE deleted_at IS NULL ORDER BY (staff_idno * 1) ASC, staff_idno ASC");
// $boolean_next = false ;
// $temp_id = $previous_id = '' ;
// while ($row_next_previous = $mysqli_next_previous->fetch_array(MYSQLI_ASSOC)){
// $next_previous_id = $row_next_previous['staff_id'] ;
// if ($boolean_next){
// $next_id = $next_previous_id ;
// $boolean_next = false ;
// }
// if ($next_previous_id == $page){
// $previous_id = $temp_id ;
// $boolean_next = true ;
// }
// $temp_id = $next_previous_id ;
// }
// if ($previous_id != '' || $next_id != ''){
// echo '
//
' ;
// }
?>
alert("Sorry You Don\'t Have The Permission.")';
header('Location: page-dashboard.php') ;
exit ;
}
// default parameter
$left_join = '' ;
$search = escapeString($_GET['search']) ;
$search_name = escapeString($_GET['search_name']) ;
$search_idno = escapeString($_GET['search_idno']) ;
$search = escapeString($_GET['search']) ;
$lf_type = escapeString($_GET['lf_type']) ;
$lf_branch = escapeString($_GET['lf_branch']) ;
$lf_resigned = escapeString($_GET['lf_resigned']) ;
$sort_by = escapeString($_GET['sort_by']) ;
$sort_by = ( $sort_by != '' ? $sort_by : 'staff_idno' ) ;
$sort_by_type = escapeString($_GET['sort_by_type']) ;
$sort_by_type = ( $sort_by_type != '' ? $sort_by_type : 'asc' ) ;
$export = escapeString($_GET['export']) ;
$status = escapeString($_GET['status']) ;
$search_mobile = escapeString($_GET['search_mobile']) ;
$search_mail = escapeString($_GET['search_mail']) ;
$search_tier = escapeString($_GET['search_tier']) ;
$search_department = escapeString($_GET['search_department']) ;
$search_point = escapeString($_GET['search_point']) ;
$search_wallet = escapeString($_GET['search_wallet']) ;
$search_star = escapeString($_GET['search_star']) ;
$search_achievement = escapeString($_GET['search_achievement']) ;
// query type
$search_query = '' ;
if($status != ''){
if($status == 'resign'){
$search_query .= " AND (a.staff_date_resigned != '0000-00-00' AND a.staff_date_resigned IS NOT NULL AND (a.staff_run_away = '' || a.staff_run_away IS NULL))" ;
}elseif($status == 'run-away'){
$search_query .= " AND (a.staff_date_resigned != '0000-00-00' AND a.staff_date_resigned IS NOT NULL AND a.staff_run_away = 'yes')" ;
}elseif($status == 'warning'){
}
}
switch ( $page_mode ){
case 'resign' :
$active_menu = 'hr-staff-resgined' ;
$search_query .= " AND (a.staff_date_resigned != '0000-00-00' AND a.staff_date_resigned IS NOT NULL AND (a.staff_run_away = '' || a.staff_run_away IS NULL))" ;
break ;
case 'run_away' :
$active_menu = 'hr-staff-run-away' ;
$search_query .= " AND (a.staff_date_resigned != '0000-00-00' AND a.staff_date_resigned IS NOT NULL AND a.staff_run_away = 'yes')" ;
break ;
default :
$active_menu = 'hr-staff-list' ;
}
// search query
if( $search != ''){
$search_query .= " AND (a.staff_idno LIKE '%".$search."%' || a.staff_name LIKE '%".$search."%')" ;
}
if( $search_name != ''){
$search_query .= " AND a.staff_name LIKE '%".$search_name."%'" ;
}
if( $search_mobile != ''){
$search_query .= " AND a.staff_mobileno LIKE '%".$search_mobile."%'" ;
}
if( $search_mail != ''){
$search_query .= " AND a.staff_email LIKE '%".$search_mail."%'" ;
}
if( $search_tier != ''){
$search_query .= " AND a.staff_tier LIKE '%".$search_tier."%'" ;
}
if( $search_department != ''){
$left_join = " LEFT JOIN staff_department b ON ( a.staff_id = b.staff_id )" ;
$search_query .= " AND b.department_id = '".$search_department."'" ;
}
if( $search_idno != ''){
$search_query .= " AND a.staff_idno LIKE '%".$search_idno."%'" ;
}
if( $search_point != ''){
$search_query .= " AND a.staff_point = '".$search_point."'" ;
}
if( $search_wallet != ''){
$search_query .= " AND a.staff_wallet = '".$search_wallet."'" ;
}
if( $search_star != ''){
$search_query .= " AND a.staff_star = '".$search_star."'" ;
}
if( $search_achievement != ''){
$search_query .= " AND a.staff_achievement LIKE '%".$search_achievement."%'" ;
}
if( $lf_type != '' ){
if( $lf_type == 'local' ){
$search_query .= " AND a.country_id = '1'" ;
}else{
$search_query .= " AND a.country_id != '1'" ;
}
}
if ( $lf_branch != '' ){
$search_query .= " AND a.branch_id = '".$lf_branch."'" ;
}
if ( $lf_resigned != '' ){
$search_query .= " AND ( a.staff_date_resigned >= '".$lf_resigned."' OR a.staff_date_resigned = '0000-00-00' OR a.staff_date_resigned IS NULL )" ;
}else{
$search_query .= " 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 )" ;
}
// $search_query .= ( $get_user_tier['check'] ? " AND a.staff_tier IN ( ".implode(', ', $get_user_tier['tiers'])." )" : '' ) ;
// form submit
if( $_POST['hide'] == '1' && $_POST['hide_status'] == 'action' ){
// trash item
switch( $_POST['page_action'] ){
case 'trash':
$mysqli_query = "UPDATE " . staff . " SET
deleted_at = '".TODAYDATE."'
WHERE staff_id = " ;
$trash_page = trashPage('staff', $mysqli, $mysqli_query, $_POST['multiple_trash']) ;
break;
}
}
// pagination
if (isset($page) && !empty($page)) { $product_page = $page ; } else { $product_page = 1 ; } // next and prev page (5 thing need to change)
$start_from = ($product_page - 1) * LIMIT ; //end next and prev page
// set search url
$search_url = 'search='.$search.'&search_name='.$search_name.'&search_idno='.$search_idno.'&lf_type='.$lf_type.'&lf_branch='.$lf_branch.'&sort_by='.$sort_by.'&sort_by_type='.$sort_by_type.'&lf_branch='.$lf_branch.'&lf_resigned='.$lf_resigned.'&status='.$status.'&show_all_none_branch_staff='.$show_all_none_branch_staff.'&search_point='.$search_point.'&search_wallet='.$search_wallet.'&search_star='.$search_star.'&search_achievement='.$search_achievement ;
$show_all_none_branch_staff = escapeString($_GET['show_all_none_branch_staff']);
if ($show_all_none_branch_staff == 'all') {
$user_branch_permission_sql = 'and branch_id = "" and staff_name != "" ';
}
// page query
$mysqli_query = "SELECT a.* FROM staff a
".$left_join."
WHERE a.deleted_at IS NULL" . $search_query . $user_branch_permission_sql_a ;
// export excel
if ( $export == 'yes' ){
include 'PhpExcel/PHPExcel.php' ;
$page_filename = 'Staff-'.date( 'Ymd', time() ) ;
$objPHPExcel = new PHPExcel() ;
$objPHPExcel->getProperties()
->setCreator(COMPANY)
->setTitle(COMPANY)
->setSubject(COMPANY)
->setDescription(COMPANY)
->setKeywords(COMPANY)
->setCategory(COMPANY) ;
$objPHPExcel->getActiveSheet()->setTitle( $page_filename ) ;
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter( $objPHPExcel, 'Excel5' ) ;
// default parameter
$count = 1 ;
$char = 'A' ;
$count_staff = 1 ;
$array_title = array( 'No.', 'Qrcode', 'ID', 'Name', 'Mobile No','Gender', 'Birth Date','Age','Mailing Address','Marriage Status','Country', "IC", 'Position', 'Status','Ethnic','Religion', 'Date Joined ','Created Date' ) ;
$newChar = $char ;
foreach( $array_title as $k => $v ){
$objPHPExcel->getActiveSheet()->setCellValue( $newChar.$count, $v ) ;
$newChar++ ;
}
$count++ ;
$array_staffidnos = [] ;
$staffs_q = $mysqli->query( $mysqli_query." ORDER BY (".$sort_by.' * 1) '.$sort_by_type . ', '.$sort_by.' '.$sort_by_type ) ;
if ( $staffs_q->num_rows > 0 ){
while ( $staff = $staffs_q->fetch_assoc() ){
$staff_idno = ucwords($staff['staff_idno']) ;
if( $staff['country_id'] == '1' ){
if( $staff['staff_icno'] != '' ){
$IC = dataFilter($staff['staff_icno']) ;
}else{
$IC = '-' ;
}
}else{
$IC = '-' ;
}
if( $staff['country_id'] == '1' ){
$passport = '-' ;
}else{
if( $staff['staff_passportno'] != '-' && $staff['staff_passportexpired'] != '0000-00-00' ){
$passport = dataFilter($staff['staff_passportexpired']) . ( $staff['staff_passportno'] != '' ? ' ('.dataFilter($staff['staff_passportno']).')' : '' ) ;
}else{
$passport = '-' ;
}
}
if( $staff['country_id'] == '1' ){
$permit = '-' ;
}else{
if( $staff['staff_permitno'] != '-' && $staff['staff_permit_end'] != '0000-00-00' ){
$permit = dataFilter($staff['staff_permit_end']) . ( $staff['staff_permitno'] != '' ? ' ('.dataFilter($staff['staff_permitno']).')' : '' ) ;
}else{
$permit = '-' ;
}
}
$birthDate = $staff['staff_birthdate'];
if($birthDate!='' && $birthDate !='0000-00-00'){
$birthDate = date("Y",strtotime($staff['staff_birthdate']));
//explode the date to get month, day and year
//get age from date or birthdate
$age = date("Y") - $birthDate;
if($birthDate!=''){
$age = "( ".$age." years old )";
}else{
$age = "(-)";
}
}else{
$age = "(-)";
}
$staff_settings_excel = jsonEncodeDecode('decode',$staff['staff_settings']);
$select_ethnic_name = $mysqli->query("SELECT * FROM master_ethnic WHERE ethnic_id = '".$staff['ethnic_id']."' ");
if($select_ethnic_name->num_rows>0){
while($row_ethnic_name = $select_ethnic_name->fetch_assoc()){
$ethic_name = $row_ethnic_name['ethnic_desc'];
}
}
$select_religion_name = $mysqli->query("SELECT * FROM master_religion WHERE religion_id = '".$staff['religion_id']."' ");
if($select_religion_name->num_rows>0){
while($row_religion_name = $select_religion_name->fetch_assoc()){
$religion_name = $row_religion_name['religion_desc'];
}
}
$newChar = $char ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $count_staff ) ;
// for qrcode
$qrcode_column = ($newChar++).$count ;
$objPHPExcel->getActiveSheet()->setCellValue( $qrcode_column, ' ' ) ;
$array_staffidnos[] = [ 'coordinate' => $qrcode_column, 'idno' => $staff_idno, ] ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff_idno ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_name'] ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_mobileno'] ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, dataFilter( $gender[$staff['gender_id']] ) ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, date("d-m-Y",strtotime($staff['staff_birthdate'])) );
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $age );
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff_settings_excel['mailing_address'] );
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff_settings_excel['marital_status'] );
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $country[$staff['country_id']] ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $IC ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $passport ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_passportno'] ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $permit ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, dataFilter( $position[$staff['job_position_id']] ) ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, dataFilter( $job_status[$staff['job_status_id']] ) ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $ethic_name) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $religion_name) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, resetDateFormat($staff['staff_date_joined']) ) ;
$objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, resetDateFormat($staff['created_at']) ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, resetDateFormat($staff['staff_covid']) ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, resetDateFormat($staff['staff_covid_test']) ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, resetDateFormat($staff['staff_fonema']) ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_fenoma_period'] ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, resetDateFormat($staff['staff_typhoid']) ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_point_achievement'] ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_point'] ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_wallet'] ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $staff['staff_star'] ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, $tier_list_id[$staff['staff_tier']] ) ;
// $objPHPExcel->getActiveSheet()->setCellValue( ($newChar++).$count, ucfirst($staff['staff_achievement']) ) ;
$count++ ;
$count_staff++ ;
}
}
// start drawing image
foreach ( $array_staffidnos as $kstaffidnos => $vstaffidnos ){
// if ( $kstaffidnos == '0' ){
$generatecode = generateQrcode( '', $vstaffidnos['idno'], PATH.'hr-staff-vcard.php?staff_idno='.$vstaffidnos['idno'] ) ;
$qrcode = $generatecode['url'] ;
$base64_qrcode = 'data:image/png;base64,'.base64_encode(file_get_contents($qrcode)) ;
$gdImage = imagecreatefrompng($base64_qrcode) ;
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing() ;
$objDrawing->setName( $vstaffidnos['idno'] ) ;
$objDrawing->setImageResource( $gdImage ) ;
$objDrawing->setRenderingFunction( PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG ) ;
$objDrawing->setMimeType( PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT ) ;
$objDrawing->setHeight( 55 ) ;
$objDrawing->setCoordinates( $vstaffidnos['coordinate'] ) ;
$objDrawing->setWorksheet( $objPHPExcel->getActiveSheet() ) ;
// }
}
$objPHPExcel->getActiveSheet()->getDefaultRowDimension()->setRowHeight( 40 ) ;
// start render excel file
header( 'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' ) ;
header( 'Content-Disposition: attachment;filename="'.$page_filename.'.xls"' ) ;
header( 'Cache-Control: max-age=0' ) ;
// save to pc
ob_clean();
$objWriter->save('php://output') ;
header( "Refresh: 0" ) ;
exit ;
}
$mysqli_page = $mysqli->query( $mysqli_query . " ORDER BY (".$sort_by.' * 1) '.$sort_by_type.", ".$sort_by." ".$sort_by_type." LIMIT $start_from, " . LIMIT ) ;
// load pagination
$page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ;
// start header here
include 'requires/page_header.php' ;
include 'requires/page_top.php' ;
// reset sort by type
$sort_by_type = ( $sort_by_type == 'DESC' ? 'ASC' : 'DESC' ) ;
?>