111 lines
2.9 KiB
PHP
111 lines
2.9 KiB
PHP
<?php
|
|
include 'connect/cms-config.php' ;
|
|
include 'requires/function.php' ;
|
|
|
|
// include the class
|
|
include 'requires/class_resize.php' ;
|
|
|
|
// keep parameter in value
|
|
$page = escapeString($_GET['page']) ;
|
|
$page_mode = escapeString($_GET['page_mode']) ;
|
|
$type = escapeString($_GET['type']) ;
|
|
$search = escapeString($_GET['search']) ;
|
|
$search_category = escapeString($_GET['search_category']) ;
|
|
$select_worker = $_GET['select_worker'] ;
|
|
$select_worker = ($select_worker == 'Foreign' ? 'Foreign' : 'Local') ;
|
|
$sort_type = escapeString($_GET['sort_type']) ;
|
|
$default_sortby = $sortby = escapeString($_GET['sortby']) ;
|
|
$show_another_script = true ;
|
|
|
|
$hide_title = true ;
|
|
|
|
// page header
|
|
$letter_head = getOwnerCompanyLetterHead($_SESSION['url_get_branch_admin']) ;
|
|
|
|
// mode type | all list | new | edit
|
|
$active_main_menu = 'hr' ;
|
|
$active_sub_menu = 'hr-employment' ;
|
|
$active_menu = 'hr-employment-new' ;
|
|
|
|
// check select worker
|
|
if ( $page_mode == 'edit' ){
|
|
|
|
// active page
|
|
$active_main_menu = 'hr' ;
|
|
$active_sub_menu = 'hr-employment' ;
|
|
$active_menu = 'hr-employment' ;
|
|
|
|
$boolean_redirect = false ;
|
|
|
|
$page_status = $_POST['page_status'] ;
|
|
if ($page_status == 'new'){
|
|
$worker_status = 'Pending' ;
|
|
$confirmation_date = ($worker_status == 'Confirmation' ? TODAYDATE : '') ;
|
|
$mysqli->query("INSERT INTO staff_employment (employment_status, employment_confirmation_date, employment_date, employment_modified, employment_trash) VALUES ('".$worker_status."', '".$confirmation_date."', '".TODAYDATE."', '".TODAYDATE."', '0')");
|
|
$page = $mysqli->insert_id;
|
|
}
|
|
|
|
// check query exsits
|
|
$mysqli_page = $mysqli->query("SELECT * FROM staff_employment
|
|
WHERE employment_id = '".$page."' AND employment_trash = '0' LIMIT 1") ;
|
|
if ($mysqli_page->num_rows > 0){
|
|
|
|
// keep query value in array
|
|
$row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ;
|
|
$select_worker = $row_page['employment_type'] ;
|
|
$employment_status = $row_page['employment_status'] ;
|
|
|
|
// check select worker
|
|
include 'HR/hr-local-edit.php' ;
|
|
|
|
}else{
|
|
$boolean_redirect = true ;
|
|
}
|
|
|
|
if ($boolean_redirect){
|
|
header("Location: ?page_mode=all") ;
|
|
exit ;
|
|
}
|
|
|
|
}else{
|
|
// start header here
|
|
include 'requires/page_header.php' ;
|
|
include 'HR/hr-local-new.php' ;
|
|
}
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
save_log(true);
|
|
setInterval(save_log,60000);
|
|
function save_log($value = false){
|
|
var form = $("#quotationForm");
|
|
if ($value){
|
|
$.ajax({
|
|
type:"POST",
|
|
url:"requires/ajax_log.php",
|
|
data: form.serialize() + "&status=unknown",
|
|
success: function(data)
|
|
{
|
|
|
|
}
|
|
});
|
|
}else{
|
|
$.ajax({
|
|
type:"POST",
|
|
url:"requires/ajax_log.php",
|
|
data: form.serialize() + "&status=unknown&status1=not-yet",
|
|
success: function(data)
|
|
{
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
<?php
|
|
|
|
// footer
|
|
include 'requires/page_footer.php' ;
|
|
?>
|