first commit
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
include '../connect/cms-config.php' ;
|
||||
include '../requires/session.php' ;
|
||||
include '../requires/function.php' ;
|
||||
|
||||
// set value in variable
|
||||
$place = escapeString($_POST['place']) ;
|
||||
$staff_id = escapeString($_POST['staff_id']) ;
|
||||
$type = escapeString($_POST['type']) ;
|
||||
$group_id = escapeString($_POST['group_id']) ;
|
||||
$formula_group = escapeString($_POST['formula_group']);
|
||||
|
||||
// default variable
|
||||
$content = '' ;
|
||||
$result = 'failed' ;
|
||||
|
||||
|
||||
if (!empty($type)){
|
||||
switch ($type) {
|
||||
case 'staff':
|
||||
// array for seaching query
|
||||
$staff_list = [];
|
||||
$staff_id = ( empty($staff_id) ? '0' : $staff_id );
|
||||
if ( $place > 0 ){
|
||||
|
||||
$query = "SELECT * FROM system_orgChart where chart_id = '".$place."'";
|
||||
//echo $query;
|
||||
$query = $mysqli->query($query);
|
||||
if ( $query ->num_rows > 0 ){
|
||||
$row = $query->fetch_array(MYSQLI_ASSOC);
|
||||
$old_staff_group[1]["old"] = $row['staff_id'];
|
||||
// $old_staff_group[1] = [
|
||||
// "old" => $row['staff_id'],
|
||||
// "new" => $staff_id,
|
||||
// ];
|
||||
}
|
||||
$old_staff_group[1]["new"] = $staff_id;
|
||||
|
||||
$query = "UPDATE system_orgChart set staff_id = '".$staff_id."' where chart_id = '".$place."'";
|
||||
|
||||
if (!$mysqli->query($query)){
|
||||
$result = "failed";
|
||||
}else{
|
||||
$result = "success";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'staff_update':
|
||||
// array for seaching query
|
||||
$staff_list = [];
|
||||
|
||||
if ( $staff_id > 0 && $group_id > 0 ){
|
||||
|
||||
$old_staff_group[0] = false;
|
||||
$check_group = $mysqli->query("SELECT * FROM staff
|
||||
WHERE deleted_at IS NULL AND staff_id = '".$staff_id."' LIMIT 1") ;
|
||||
if ( $check_group->num_rows > 0 ){
|
||||
$row = $check_group->fetch_array(MYSQLI_ASSOC);
|
||||
if ( $row['group_id'] != $group_id ){
|
||||
$old_staff_group[0] = true;
|
||||
$old_staff_group[1] = [
|
||||
"old" => $row['group_id'],
|
||||
"new" => $group_id,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$query = "UPDATE staff set group_id = '".$group_id."' where staff_id = '".$staff_id."'";
|
||||
|
||||
if (!$mysqli->query($query)){
|
||||
$result = "failed";
|
||||
}else{
|
||||
$result = "success";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "working_hours":
|
||||
$old_staff_group[0] = false;
|
||||
if ( $place > 0 && $group_id > 0 ){
|
||||
$query = "SELECT * FROM system_formula where chart_id = '".$place."' AND formula_group = '".$formula_group."'";
|
||||
//echo $query;
|
||||
$query = $mysqli->query($query);
|
||||
if ($query->num_rows > 0){
|
||||
$row = $query->fetch_array(MYSQLI_ASSOC);
|
||||
if ( $row['group_id'] != $group_id ){
|
||||
$old_staff_group[0] = true;
|
||||
$old_staff_group[1] = [
|
||||
"old" => $row['group_id'],
|
||||
"new" => $group_id,
|
||||
"formula" => $formula_group,
|
||||
];
|
||||
}
|
||||
if (!$mysqli->query("UPDATE system_formula set group_id = '".$group_id."' where chart_id = '".$place."' AND formula_group = '".$formula_group."'")){
|
||||
$result = "failed";
|
||||
}else{
|
||||
$result = "success";
|
||||
}
|
||||
}else{
|
||||
if ( $row['group_id'] != $group_id ){
|
||||
$old_staff_group[0] = true;
|
||||
$old_staff_group[1] = [
|
||||
"old" => $row['group_id'],
|
||||
"new" => $group_id,
|
||||
"formula" => $formula_group,
|
||||
|
||||
];
|
||||
}
|
||||
if (!$mysqli->query("INSERT INTO system_formula (group_id, chart_id, formula_group) VALUES ('".$group_id."', '".$place."', '".$formula_group."')")){
|
||||
$result = "failed";
|
||||
}else{
|
||||
$result = "success";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update_type':
|
||||
// array for seaching query
|
||||
$exchange = escapeString($_POST['exchange']);
|
||||
if ( $group_id > 0 ){
|
||||
|
||||
$query = "UPDATE system_orgChart set type = '".$exchange."', staff_id = '' where chart_id = '".$group_id."'";
|
||||
|
||||
if (!$mysqli->query($query)){
|
||||
$result = "failed";
|
||||
}else{
|
||||
$query = "UPDATE system_formula set group_id = '' where chart_id = '".$group_id."'";
|
||||
if (!$mysqli->query($query)){
|
||||
$result = "failed";
|
||||
}else{
|
||||
$result = "success";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'remark_update':
|
||||
// array for seaching query
|
||||
$remark = escapeString($_POST['remark']);
|
||||
if ( $group_id > 0 ){
|
||||
|
||||
$query = "UPDATE system_orgChart set remark = '".$remark."' where chart_id = '".$group_id."'";
|
||||
|
||||
if (!$mysqli->query($query)){
|
||||
$result = "failed";
|
||||
}else{
|
||||
$result = "success";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// set in array
|
||||
$array['data'] = $data ;
|
||||
$array['result'] = $result ;
|
||||
|
||||
// echo array
|
||||
echo json_encode($array);
|
||||
?>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
include '../connect/cms-config.php' ;
|
||||
include '../requires/session.php' ;
|
||||
include '../requires/function.php' ;
|
||||
|
||||
// set value in variable
|
||||
$type = escapeString($_GET['type']) ;
|
||||
$page = escapeString($_POST['page']) ;
|
||||
$status = escapeString($_POST['status']) ;
|
||||
|
||||
$result = false ;
|
||||
$update_query = '' ;
|
||||
|
||||
switch($type){
|
||||
case 'update-status' :
|
||||
|
||||
$mysqli_page = $mysqli->query("SELECT * FROM staff_employment
|
||||
WHERE employment_id = '".$page."' AND employment_trash = '0' LIMIT 1") ;
|
||||
|
||||
if ($mysqli_page->num_rows > 0){
|
||||
|
||||
$row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ;
|
||||
$current_employment_status = $row_page['employment_status'] ;
|
||||
|
||||
$array_update_status = array() ;
|
||||
switch($current_employment_status){
|
||||
case 'Pending' :
|
||||
$array_update_status = array('Pending', 'Offer', 'Reject') ;
|
||||
break ;
|
||||
case 'Offer' :
|
||||
$array_update_status = array('Offer', 'Confirmation', 'Terminate') ;
|
||||
break ;
|
||||
case 'Confirmation' :
|
||||
$array_update_status = array('Confirmation', 'Terminate') ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if (in_array($status, $array_update_status)) {
|
||||
|
||||
switch($status){
|
||||
case 'Confirmation' :
|
||||
$update_query = "employment_confirmation_date = '".TODAYDATE."'," ;
|
||||
break ;
|
||||
case 'Terminate' :
|
||||
$update_query = "employment_terminate_date = '".TODAYDATE."'," ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if ($mysqli->query("UPDATE staff_employment SET
|
||||
".$update_query."
|
||||
employment_status = '".$status."',
|
||||
employment_modified = '".TODAYDATE."'
|
||||
WHERE employment_id = '".$page."'")){
|
||||
|
||||
$result = true ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break ;
|
||||
|
||||
}
|
||||
|
||||
$array['result'] = $result ;
|
||||
echo json_encode($array) ;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
include '../connect/cms-config.php' ;
|
||||
include '../requires/session.php' ;
|
||||
include '../requires/function.php' ;
|
||||
|
||||
$result = 'failed' ;
|
||||
|
||||
// set value in variable
|
||||
$list_staff_id = escapeString($_POST['list_staff_id']) ;
|
||||
$list_date = escapeString($_POST['list_date']) ;
|
||||
$list_health = escapeString($_POST['list_health']) ;
|
||||
|
||||
if ( $list_staff_id != '' && $list_date != '' && $list_health != '' ){
|
||||
|
||||
$mysqli_page = $mysqli->query("SELECT * FROM staff_health
|
||||
WHERE staff_id = '".$list_staff_id."' AND request_date = '".$list_date."' LIMIT 1");
|
||||
if ( $mysqli_page->num_rows == 0 ){
|
||||
$mysqli->query( "INSERT INTO staff_health
|
||||
( staff_id, request_date, created_at ) VALUES
|
||||
( '".$list_staff_id."', '".$list_date."', '".TODAYDATE."' )" ) ;
|
||||
$health_id = $mysqli->insert_id ;
|
||||
}else{
|
||||
$row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ;
|
||||
$health_id = $row_page['health_id'] ;
|
||||
}
|
||||
|
||||
$mysqli->query("UPDATE staff_health SET
|
||||
degree = '".escapeString($_POST['list_health'])."',
|
||||
updated_at = '".TODAYDATE."'
|
||||
WHERE health_id = '".$health_id."'") ;
|
||||
|
||||
$result = 'success' ;
|
||||
}
|
||||
|
||||
// set in array
|
||||
$array['result'] = $result ;
|
||||
|
||||
// echo array
|
||||
echo json_encode($array) ;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
include '../connect/cms-config.php' ;
|
||||
include '../requires/session.php' ;
|
||||
include '../requires/function.php' ;
|
||||
|
||||
$result = 'failed' ;
|
||||
|
||||
// set value in variable
|
||||
$list_id = escapeString($_POST['list_id']) ;
|
||||
$list_work_day = escapeString($_POST['list_work_day']) ;
|
||||
$list_ot_day = escapeString($_POST['list_ot_day']) ;
|
||||
$list_min = escapeString($_POST['list_min']) ;
|
||||
$list_wt = escapeString($_POST['list_wt']) ;
|
||||
$list_remark = escapeString($_POST['list_remark']) ;
|
||||
|
||||
if ( $list_id != '' ){
|
||||
$mysqli->query( "UPDATE staff_attendance_list SET
|
||||
list_late = '".$list_min."',
|
||||
list_type_remark = '".$list_wt."',
|
||||
list_work_day = '".$list_work_day."',
|
||||
list_ot_day = '".$list_ot_day."',
|
||||
list_attendance_remark = '".$list_remark."'
|
||||
WHERE list_id = '".$list_id."'" ) ;
|
||||
|
||||
$result = 'success' ;
|
||||
}
|
||||
|
||||
// set in array
|
||||
$array['result'] = $result ;
|
||||
|
||||
// echo array
|
||||
echo json_encode($array) ;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
include '../connect/cms-config.php' ;
|
||||
include '../requires/function.php' ;
|
||||
|
||||
$array_other_details = array() ;
|
||||
|
||||
// personal information
|
||||
$position_applied = escapeString($_POST['position_applied']) ;
|
||||
$personal_call = escapeString($_POST['personal_call']) ;
|
||||
$personal_name = escapeString($_POST['personal_name']) ;
|
||||
$personal_nric = escapeString($_POST['personal_nric']) ;
|
||||
$personal_old_nric = escapeString($_POST['personal_old_nric']) ;
|
||||
$personal_dob = escapeString($_POST['personal_dob']) ;
|
||||
$personal_sex = escapeString($_POST['personal_sex']) ;
|
||||
$personal_race = escapeString($_POST['personal_race']) ;
|
||||
$personal_religion = escapeString($_POST['personal_religion']) ;
|
||||
$personal_nationality = escapeString($_POST['personal_nationality']) ;
|
||||
$personal_marital = escapeString($_POST['personal_marital']) ;
|
||||
$personal_mobile = escapeString($_POST['personal_mobile']) ;
|
||||
$personal_tel = escapeString($_POST['personal_tel']) ;
|
||||
$personal_address = escapeString($_POST['personal_address']) ;
|
||||
$personal_email = escapeString($_POST['personal_email']) ;
|
||||
$personal_transport = escapeString($_POST['personal_transport']) ;
|
||||
$personal_type_vehicle = escapeString($_POST['personal_type_vehicle']) ;
|
||||
|
||||
// set image in variable
|
||||
$personal_image = $_FILES["image"]["name"] ;
|
||||
$personal_image_type = $_FILES["image"]["type"] ;
|
||||
|
||||
// family background
|
||||
$family_father_name = escapeString($_POST['family_father_name']) ;
|
||||
$family_father_occupation = escapeString($_POST['family_father_occupation']) ;
|
||||
$family_mother_name = escapeString($_POST['family_mother_name']) ;
|
||||
$family_mother_occupation = escapeString($_POST['family_mother_occupation']) ;
|
||||
$family_spouse_name = escapeString($_POST['family_spouse_name']) ;
|
||||
$family_spouse_occupation = escapeString($_POST['family_spouse_occupation']) ;
|
||||
|
||||
// family member
|
||||
$family_member_key = $_POST['family_member_key'] ;
|
||||
$array_family_member = array() ;
|
||||
if (arrayCheck($family_member_key)){
|
||||
foreach($family_member_key as $key => $value){
|
||||
$array_family_member[] = array('name' => $_POST['family_member_name'][$value],
|
||||
'dob' => $_POST['family_member_dob'][$value],
|
||||
'occupation' => $_POST['family_member_occupation'][$value],
|
||||
'education' => $_POST['family_member_education'][$value]) ;
|
||||
}
|
||||
}
|
||||
|
||||
// family children
|
||||
$family_child_key = $_POST['family_child_key'] ;
|
||||
$array_family_child = array() ;
|
||||
if (arrayCheck($family_child_key)){
|
||||
foreach($family_child_key as $key => $value){
|
||||
$array_family_child[] = array('name' => $_POST['family_child_name'][$value],
|
||||
'dob' => $_POST['family_child_dob'][$value],
|
||||
'occupation' => $_POST['family_child_occupation'][$value],
|
||||
'education' => $_POST['family_child_education'][$value]) ;
|
||||
}
|
||||
}
|
||||
|
||||
// educational level
|
||||
$education_key = $_POST['education_key'] ;
|
||||
$array_education = array() ;
|
||||
if (arrayCheck($education_key)){
|
||||
foreach($education_key as $key => $value){
|
||||
$array_education[] = array('year' => $_POST['education_year'][$value],
|
||||
'school' => $_POST['education_name_school'][$value],
|
||||
'qualification' => $_POST['education_qualification'][$value]) ;
|
||||
}
|
||||
}
|
||||
$education_others = escapeString($_POST['education_others']) ;
|
||||
|
||||
// employment history
|
||||
$employment_key = $_POST['employment_key'] ;
|
||||
$array_employment = array() ;
|
||||
if (arrayCheck($employment_key)){
|
||||
foreach($employment_key as $key => $value){
|
||||
$array_employment[] = array('date' => $_POST['employment_date'][$value],
|
||||
'employer' => $_POST['employment_employer'][$value],
|
||||
'positionheld' => $_POST['employment_positionheld'][$value],
|
||||
'contacts' => $_POST['employment_contacts'][$value],
|
||||
'salary' => $_POST['employment_salary'][$value],
|
||||
'reasons' => $_POST['employment_reasons_leaving'][$value]) ;
|
||||
}
|
||||
}
|
||||
|
||||
// personality
|
||||
$personality_language_spoken = escapeString($_POST['personality_language_spoken']) ;
|
||||
$personality_language_written = escapeString($_POST['personality_language_written']) ;
|
||||
$personality_own_strengths = escapeString($_POST['personality_own_strengths']) ;
|
||||
$personality_own_weakness = escapeString($_POST['personality_own_weakness']) ;
|
||||
|
||||
$personality_aims = escapeString($_POST['personality_aims']) ;
|
||||
$personality_overtime = escapeString($_POST['personality_overtime']) ;
|
||||
$personality_pressure = escapeString($_POST['personality_pressure']) ;
|
||||
$personality_available_work = escapeString($_POST['personality_available_work']) ;
|
||||
$personality_contract = escapeString($_POST['personality_contract']) ;
|
||||
$personality_notice = escapeString($_POST['personality_notice']) ;
|
||||
|
||||
// salary
|
||||
$salary_last_drawn = escapeString($_POST['salary_last_drawn']) ;
|
||||
$salary_expected_salary = escapeString($_POST['salary_expected_salary']) ;
|
||||
|
||||
// references
|
||||
$references_key = $_POST['references_key'] ;
|
||||
$array_references = array() ;
|
||||
if (arrayCheck($references_key)){
|
||||
foreach($references_key as $key => $value){
|
||||
$array_references[] = array('name' => $_POST['references_name'][$value],
|
||||
'position' => $_POST['references_position'][$value],
|
||||
'contacts' => $_POST['references_contracts'][$value],
|
||||
'years' => $_POST['references_years'][$value]) ;
|
||||
}
|
||||
}
|
||||
|
||||
// aknowledgement and authorization
|
||||
$acknowledgement_certify = escapeString($_POST['acknowledgement_certify']) ;
|
||||
$acknowledgement_authorize = escapeString($_POST['acknowledgement_authorize']) ;
|
||||
$acknowledgement_event = escapeString($_POST['acknowledgement_event']) ;
|
||||
|
||||
// signature
|
||||
$application_signature = escapeString($_POST['application_signature']) ;
|
||||
$application_signature_date = TODAYDATE ;
|
||||
|
||||
// interview by
|
||||
$incharge_person = escapeString($_POST['incharge_person']) ;
|
||||
$information_interview_date = escapeString($_POST['information_interview_date']) ;
|
||||
$information_interview_comments = escapeString($_POST['information_interview_comments']) ;
|
||||
|
||||
// status
|
||||
$employment_status = escapeString($_POST['employment_status']) ;
|
||||
// keep other value in array
|
||||
$array_other_details = array('family' => array('background' => array('father_name' => $family_father_name,
|
||||
'father_occupation' => $family_father_occupation,
|
||||
'mother_name' => $family_mother_name,
|
||||
'mother_occupation' => $family_mother_occupation,
|
||||
'spouse_name' => $family_spouse_name,
|
||||
'spouse_occupation' => $family_spouse_occupation),
|
||||
'member' => $array_family_member,
|
||||
'child' => $array_family_child),
|
||||
'education' => array('school' => $array_education,
|
||||
'others' => $education_others),
|
||||
'employment' => $array_employment,
|
||||
'personality' => array('language_spoken' => $personality_language_spoken,
|
||||
'language_written' => $personality_language_written,
|
||||
'own_strengths' => $personality_own_strengths,
|
||||
'own_weakness' => $personality_own_weakness,
|
||||
'aims' => $personality_aims,
|
||||
'overtime' => $personality_overtime,
|
||||
'pressure' => $personality_pressure,
|
||||
'available_work' => $personality_available_work,
|
||||
'contract' => $personality_contract,
|
||||
'notice' => $personality_notice),
|
||||
'salary' => array('last_drawn' => $salary_last_drawn,
|
||||
'expected_salary' => $salary_expected_salary),
|
||||
'references' => $array_references,
|
||||
'acknowledgement' => array('certify' => $acknowledgement_certify,
|
||||
'authorize' => $acknowledgement_authorize,
|
||||
'event' => $acknowledgement_event),
|
||||
'application' => array('signature' => $application_signature,
|
||||
'date' => $application_signature_date),
|
||||
'interview' => array('date' => $information_interview_date,
|
||||
'comments' => $information_interview_comments)
|
||||
) ;
|
||||
$array_other_details = jsonEncodeDecode('encode', $array_other_details) ;
|
||||
$status = $_POST['status'];
|
||||
$status1 = $_POST['status1'];
|
||||
|
||||
$id = $_POST['id'];
|
||||
$descrition = $_SESSION['system_name'].'(username) ' ;
|
||||
$record = '';
|
||||
$page_id = '';
|
||||
switch ($status) {
|
||||
case 'new':
|
||||
switch ($status1) {
|
||||
case 'not-yet':
|
||||
$descrition .= 'click on application form but not submit yet';
|
||||
break;
|
||||
case 'insert':
|
||||
$descrition .= 'submit an new application form';
|
||||
break;
|
||||
default:
|
||||
$descrition .= 'click on new application form';
|
||||
break;
|
||||
}
|
||||
$page_id = '200';
|
||||
break;
|
||||
case 'edit':
|
||||
switch ($status1) {
|
||||
case 'not-yet':
|
||||
$descrition .= 'edit application form but not submit yet';
|
||||
break;
|
||||
case 'insert':
|
||||
$descrition .= 'submit an edited application form';
|
||||
break;
|
||||
default:
|
||||
$descrition .= 'click on edit application form';
|
||||
break;
|
||||
}
|
||||
$page_id = '200';
|
||||
break;
|
||||
case 'unknown':
|
||||
switch ($status1) {
|
||||
case 'not-yet':
|
||||
$descrition .= 'click on unknown application form but not submit yet';
|
||||
break;
|
||||
case 'insert':
|
||||
$descrition .= 'submit an unknown application form';
|
||||
break;
|
||||
default:
|
||||
$descrition .= 'click on unknown application form';
|
||||
break;
|
||||
}
|
||||
$page_id = '201';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($mysqli->query("INSERT INTO system_log
|
||||
(log_table, log_action, log_page_id, log_user_id, log_description, log_record, log_date) VALUES
|
||||
('employment', '".$status."', ".$page_id.", '".$_SESSION["system_id"]."', '".$descrition."', '".$array_other_details."', NOW())")){
|
||||
return "success";
|
||||
}else{
|
||||
return "fail";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include '../connect/cms-config.php' ;
|
||||
include '../requires/session.php' ;
|
||||
include '../requires/function.php' ;
|
||||
// default variable
|
||||
$type = $_GET['type'] ;
|
||||
$id = escapeString($_POST['id']) ;
|
||||
// check if not null
|
||||
if ($type != ''){
|
||||
switch($type){
|
||||
case 'logout' :
|
||||
// update query
|
||||
$mysqli->query("UPDATE system_user SET
|
||||
user_login_cookies = ''
|
||||
WHERE user_id = '".$id."'") ;
|
||||
$result = 'success' ;
|
||||
break ;
|
||||
}
|
||||
$array_result['result'] = $result ;
|
||||
// return result
|
||||
echo json_encode($array_result) ;
|
||||
exit ;
|
||||
}
|
||||
// redirect page
|
||||
header("Location: ".PATH) ;
|
||||
exit ;
|
||||
?>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
include_once '../connect/cms-config.php' ;
|
||||
include_once '../requires/function.php' ;
|
||||
|
||||
$folder = escapeString($_GET['folder']) ; // name
|
||||
$file = base64_decode(escapeString($_GET['file'])) ; // password
|
||||
$user = escapeString($_GET['user']) ; // user
|
||||
|
||||
// check login
|
||||
$result = 'failed' ;
|
||||
|
||||
if ($_SESSION['system_id'] != '' && $_SESSION['system_name'] != '' && $user == $_SESSION['system_id']){
|
||||
|
||||
if ($folder != '' && $file != ''){
|
||||
|
||||
$degrees = -90 ; //change this to be whatever degree of rotation you want
|
||||
header('Content-type: image/jpeg') ;
|
||||
|
||||
$array_folder = array('small' => '', 'medium' => 'm/', 'big' => 'b/') ;
|
||||
|
||||
foreach($array_folder as $key => $value){
|
||||
|
||||
$temp_file = 'uploads/'.$folder.'/'.$value.$file ;
|
||||
$filename = $_SERVER['DOCUMENT_ROOT'].'/'.$temp_file ; //this is the original file
|
||||
$source = imagecreatefromjpeg($filename) or notfound() ;
|
||||
$rotate = imagerotate($source, $degrees, 0) ;
|
||||
|
||||
imagejpeg($rotate,$filename) ; //save the new image
|
||||
imagedestroy($source) ; //free up the memory
|
||||
imagedestroy($rotate) ; //free up the memory
|
||||
|
||||
$array[$key] = PATH.$temp_file.'?timestamp='.time() ;
|
||||
$result = 'success' ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$array['result'] = $result ;
|
||||
echo json_encode($array) ;
|
||||
?>
|
||||
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
include '../connect/cms-config.php' ;
|
||||
include 'function.php' ;
|
||||
include 'session.php' ;
|
||||
|
||||
function getNewSalary($slip_id){
|
||||
global $mysqli;
|
||||
$query_salary = $mysqli->query("SELECT * FROM salary_slip a JOIN setting_slip_tax b ON (a.slip_id = b.slip_id) WHERE a.slip_id = '$slip_id' LIMIT 1");
|
||||
$new_salary = [];
|
||||
while($salary_result = mysqli_fetch_assoc($query_salary)){
|
||||
$new_salary[] = $salary_result;
|
||||
}
|
||||
|
||||
return $new_salary;
|
||||
}
|
||||
|
||||
function calculatePCB($new_salary){
|
||||
global $mysqli;
|
||||
$boolean_pcb = true;
|
||||
$type = 'pcb';
|
||||
$salary = $new_salary[0]['basic_salary'] + $new_salary[0]['commission'] + $new_salary[0]['allowance'] - $new_salary[0]['deduction'];
|
||||
|
||||
$marital_status = $new_salary[0]['marital_status'];
|
||||
$num_children = $new_salary[0]['num_children'];
|
||||
$spouse_working = $new_salary[0]['spouse_working'];
|
||||
if($new_salary[0]['tax_status_id'] == 1){
|
||||
if($marital_status == 'Single' || $marital_status == 'Divorced' || $marital_status == 'Widow'){
|
||||
$category = 1;
|
||||
$category2 = 'B';
|
||||
}else if($marital_status == 'Married'){
|
||||
|
||||
if($num_children == '' || $num_children == 0){
|
||||
$category2 = 'K';
|
||||
}else{
|
||||
$category2 = 'KA'.$num_children;
|
||||
}
|
||||
|
||||
if($spouse_working == 'Yes'){
|
||||
$category = 3;
|
||||
}else{
|
||||
$category = 2;
|
||||
}
|
||||
|
||||
}else{
|
||||
$boolean_pcb = false;
|
||||
}
|
||||
}else{
|
||||
$boolean_pcb = false;
|
||||
}
|
||||
if($boolean_pcb){
|
||||
$pcb = calculateTax($type, $salary, $category, $category2);
|
||||
}else{
|
||||
$pcb = 0;
|
||||
}
|
||||
|
||||
return $pcb;
|
||||
}
|
||||
|
||||
function calculateEPF($new_salary){
|
||||
global $mysqli;
|
||||
$age = $new_salary[0]['age'];
|
||||
$country = '';
|
||||
$country_id = $new_salary[0]['country_id'];
|
||||
$query_country = $mysqli->query("SELECT country_desc FROM master_country WHERE country_id = '$country_id' LIMIT 1");
|
||||
$country = mysqli_fetch_assoc($query_country)['country_desc'];
|
||||
|
||||
if($country == 'MALAYSIA'){
|
||||
$citizen = 'yes';
|
||||
}else{
|
||||
$citizen = 'yes';
|
||||
}
|
||||
|
||||
$type = 'epf';
|
||||
$salary = $new_salary[0]['basic_salary'] + $new_salary[0]['commission'] + $new_salary[0]['allowance'] - $new_salary[0]['deduction'] ;
|
||||
if($new_salary[0]['staff_epf_rate'] == '11'){
|
||||
$epf_array = calculateTaxEPF($type, $salary, $age, $citizen);
|
||||
}else if($new_salary[0]['staff_epf_rate'] == '9'){
|
||||
$epf_array = calculateTaxEPF($type, $salary, $age, $citizen);
|
||||
}else if($new_salary[0]['staff_epf_rate'] == '0'){
|
||||
$epf_array = array(
|
||||
'employer_epf' => 0,
|
||||
'staff_epf' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
return $epf_array;
|
||||
}
|
||||
|
||||
function calculateSOCSO($new_salary){
|
||||
global $mysqli;
|
||||
$socso_category_id = $new_salary[0]['socso_category_id'];
|
||||
$type = 'socso';
|
||||
$salary = $new_salary[0]['basic_salary'] + $new_salary[0]['commission'] + $new_salary[0]['allowance'] - $new_salary[0]['deduction'] ;
|
||||
if($socso_category_id == 1){
|
||||
$socso_array = calculateTaxSOCSO($type, $salary, $socso_category_id);
|
||||
}else if($socso_category_id == 2){
|
||||
$socso_array = calculateTaxSOCSO($type, $salary, $socso_category_id);
|
||||
}else{
|
||||
$socso_array = array(
|
||||
'employer_socso' => 0,
|
||||
'staff_socso' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
return $socso_array;
|
||||
}
|
||||
|
||||
function calculateEIS($new_salary){
|
||||
global $mysqli;
|
||||
$eis_status = $new_salary[0]['staff_eis_status'];
|
||||
$type = 'eis';
|
||||
$salary = $new_salary[0]['basic_salary'] + $new_salary[0]['commission'] + $new_salary[0]['allowance'] - $new_salary[0]['deduction'] ;
|
||||
if($eis_status == 1){
|
||||
$eis_array = calculateTaxEIS($type, $salary);
|
||||
}else{
|
||||
$eis_array = array(
|
||||
'employer_eis' => 0,
|
||||
'staff_eis' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
return $eis_array;
|
||||
}
|
||||
|
||||
function calculateZAKAT($new_salary){
|
||||
global $mysqli;
|
||||
$zakat_rate = $new_salary[0]['staff_zakat_rate'];
|
||||
$salary = $new_salary[0]['basic_salary'] + $new_salary[0]['commission'] + $new_salary[0]['allowance'] - $new_salary[0]['deduction'] ;
|
||||
$zakat = calculateTaxZAKAT($salary, $zakat_rate);
|
||||
|
||||
return $zakat;
|
||||
}
|
||||
|
||||
if($_POST['save_edit_salary'] == 1){
|
||||
|
||||
$slip_id = escapeString( $_POST['slip_id'] ) ;
|
||||
$type = escapeString( $_POST['type'] ) ;
|
||||
if($type == 'remark'){
|
||||
$remark = escapeString( $_POST['change_input'] ) ;
|
||||
$update = $mysqli->query("UPDATE salary_slip SET remark = '$remark' WHERE slip_id = '$slip_id'");
|
||||
|
||||
$result['status'] = 'success';
|
||||
}else{
|
||||
if($type == 'basic_salary'){
|
||||
$basic_salary = (float)$_POST['change_input'];
|
||||
$update = $mysqli->query("UPDATE salary_slip SET basic_salary = '$basic_salary' WHERE slip_id = '$slip_id'");
|
||||
}else if($type == 'commission'){
|
||||
$commission = (float)$_POST['change_input'];
|
||||
$update = $mysqli->query("UPDATE salary_slip SET commission = '$commission' WHERE slip_id = '$slip_id'");
|
||||
}else if($type == 'allowance'){
|
||||
$allowance = (float)$_POST['change_input'];
|
||||
$update = $mysqli->query("UPDATE salary_slip SET allowance = '$allowance' WHERE slip_id = '$slip_id'");
|
||||
}else if($type == 'deduction'){
|
||||
$deduction = (float)$_POST['change_input'];
|
||||
$update = $mysqli->query("UPDATE salary_slip SET deduction = '$deduction' WHERE slip_id = '$slip_id'");
|
||||
}
|
||||
|
||||
if($update){
|
||||
$new_salary = getNewSalary($slip_id);
|
||||
$new_pcb_value = calculatePCB($new_salary);
|
||||
|
||||
$epf_array = calculateEPF($new_salary);
|
||||
$new_staff_epf_value = $epf_array['staff_epf'];
|
||||
$new_employer_epf_value = $epf_array['employer_epf'];
|
||||
|
||||
$socso_array = calculateSOCSO($new_salary);
|
||||
$new_staff_socso_value = $socso_array['staff_socso'];
|
||||
$new_employer_socso_value = $socso_array['employer_socso'];
|
||||
|
||||
$eis_array = calculateEIS($new_salary);
|
||||
$new_staff_eis_value = $eis_array['staff_eis'];
|
||||
$new_employer_eis_value = $eis_array['employer_eis'];
|
||||
|
||||
$new_zakat_value = calculateZAKAT($new_salary);
|
||||
|
||||
$new_sub_total = $new_salary[0]['basic_salary'] + $new_salary[0]['commission'] + $new_salary[0]['allowance'] - $new_salary[0]['deduction'] ;
|
||||
$new_total = $new_salary[0]['basic_salary'] + $new_salary[0]['commission'] + $new_salary[0]['allowance'] - $new_salary[0]['deduction'] - $new_pcb_value - $new_staff_epf_value - $new_staff_socso_value - $new_staff_eis_value - $new_zakat_value;
|
||||
|
||||
//update tax value in db
|
||||
$update = $mysqli->query("UPDATE salary_slip SET staff_epf = '$new_staff_epf_value', employer_epf = '$new_employer_epf_value', staff_socso = '$new_staff_socso_value', employer_socso = '$new_employer_socso_value', staff_eis = '$new_staff_eis_value', employer_eis = '$new_employer_eis_value', staff_zakat = '$new_zakat_value', staff_pcb = '$new_pcb_value', sub_total = '$new_sub_total', total = '$new_total' WHERE slip_id = '$slip_id'");
|
||||
|
||||
if($update){
|
||||
$result['commission'] = $new_salary[0]['commission'];
|
||||
$result['allowance'] = $new_salary[0]['allowance'];
|
||||
$result['staff_epf'] = $new_staff_epf_value ;
|
||||
$result['staff_socso'] = $new_staff_socso_value ;
|
||||
$result['staff_eis'] = $new_staff_eis_value ;
|
||||
$result['em_epf'] = $new_employer_epf_value ;
|
||||
$result['em_socso'] = $new_employer_socso_value ;
|
||||
$result['em_eis'] = $new_employer_eis_value ;
|
||||
$result['staff_zakat'] = $new_zakat_value ;
|
||||
$result['staff_pcb'] = $new_pcb_value;
|
||||
$result['sub_total'] = $new_sub_total;
|
||||
$result['total'] = $new_total;
|
||||
$result['status'] = 'success';
|
||||
}else{
|
||||
$result['status'] = 'failed';
|
||||
}
|
||||
|
||||
}else{
|
||||
$result['status'] = 'failed';
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Author David S. Tufts
|
||||
* Company davidscotttufts.com
|
||||
*
|
||||
* Date: 05/25/2003
|
||||
* Usage: <img src="/barcode.php?text=testing" alt="testing" />
|
||||
*/
|
||||
|
||||
// For demonstration purposes, get pararameters that are passed in through $_GET or set to the default value
|
||||
$filepath = (isset($_GET["filepath"])?$_GET["filepath"]:"");
|
||||
$text = (isset($_GET["text"])?$_GET["text"]:"0");
|
||||
$size = (isset($_GET["size"])?$_GET["size"]:"20");
|
||||
$orientation = (isset($_GET["orientation"])?$_GET["orientation"]:"horizontal");
|
||||
$code_type = (isset($_GET["codetype"])?$_GET["codetype"]:"code128");
|
||||
$print = (isset($_GET["print"])&&$_GET["print"]=='true'?true:false);
|
||||
$sizefactor = (isset($_GET["sizefactor"])?$_GET["sizefactor"]:"1");
|
||||
|
||||
// This function call can be copied into your project and can be made from anywhere in your code
|
||||
barcode( $filepath, $text, $size, $orientation, $code_type, $print, $sizefactor );
|
||||
|
||||
function barcode( $filepath="", $text="0", $size="20", $orientation="horizontal", $code_type="code128", $print=false, $SizeFactor=1 ) {
|
||||
$code_string = "";
|
||||
// Translate the $text into barcode the correct $code_type
|
||||
if ( in_array(strtolower($code_type), array("code128", "code128b")) ) {
|
||||
$chksum = 104;
|
||||
// Must not change order of array elements as the checksum depends on the array's key to validate final code
|
||||
$code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","\`"=>"111422","a"=>"121124","b"=>"121421","c"=>"141122","d"=>"141221","e"=>"112214","f"=>"112412","g"=>"122114","h"=>"122411","i"=>"142112","j"=>"142211","k"=>"241211","l"=>"221114","m"=>"413111","n"=>"241112","o"=>"134111","p"=>"111242","q"=>"121142","r"=>"121241","s"=>"114212","t"=>"124112","u"=>"124211","v"=>"411212","w"=>"421112","x"=>"421211","y"=>"212141","z"=>"214121","{"=>"412121","|"=>"111143","}"=>"111341","~"=>"131141","DEL"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","FNC 4"=>"114131","CODE A"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112");
|
||||
$code_keys = array_keys($code_array);
|
||||
$code_values = array_flip($code_keys);
|
||||
for ( $X = 1; $X <= strlen($text); $X++ ) {
|
||||
$activeKey = substr( $text, ($X-1), 1);
|
||||
$code_string .= $code_array[$activeKey];
|
||||
$chksum=($chksum + ($code_values[$activeKey] * $X));
|
||||
}
|
||||
$code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]];
|
||||
|
||||
$code_string = "211214" . $code_string . "2331112";
|
||||
} elseif ( strtolower($code_type) == "code128a" ) {
|
||||
$chksum = 103;
|
||||
$text = strtoupper($text); // Code 128A doesn't support lower case
|
||||
// Must not change order of array elements as the checksum depends on the array's key to validate final code
|
||||
$code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","NUL"=>"111422","SOH"=>"121124","STX"=>"121421","ETX"=>"141122","EOT"=>"141221","ENQ"=>"112214","ACK"=>"112412","BEL"=>"122114","BS"=>"122411","HT"=>"142112","LF"=>"142211","VT"=>"241211","FF"=>"221114","CR"=>"413111","SO"=>"241112","SI"=>"134111","DLE"=>"111242","DC1"=>"121142","DC2"=>"121241","DC3"=>"114212","DC4"=>"124112","NAK"=>"124211","SYN"=>"411212","ETB"=>"421112","CAN"=>"421211","EM"=>"212141","SUB"=>"214121","ESC"=>"412121","FS"=>"111143","GS"=>"111341","RS"=>"131141","US"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","CODE B"=>"114131","FNC 4"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112");
|
||||
$code_keys = array_keys($code_array);
|
||||
$code_values = array_flip($code_keys);
|
||||
for ( $X = 1; $X <= strlen($text); $X++ ) {
|
||||
$activeKey = substr( $text, ($X-1), 1);
|
||||
$code_string .= $code_array[$activeKey];
|
||||
$chksum=($chksum + ($code_values[$activeKey] * $X));
|
||||
}
|
||||
$code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]];
|
||||
|
||||
$code_string = "211412" . $code_string . "2331112";
|
||||
} elseif ( strtolower($code_type) == "code39" ) {
|
||||
$code_array = array("0"=>"111221211","1"=>"211211112","2"=>"112211112","3"=>"212211111","4"=>"111221112","5"=>"211221111","6"=>"112221111","7"=>"111211212","8"=>"211211211","9"=>"112211211","A"=>"211112112","B"=>"112112112","C"=>"212112111","D"=>"111122112","E"=>"211122111","F"=>"112122111","G"=>"111112212","H"=>"211112211","I"=>"112112211","J"=>"111122211","K"=>"211111122","L"=>"112111122","M"=>"212111121","N"=>"111121122","O"=>"211121121","P"=>"112121121","Q"=>"111111222","R"=>"211111221","S"=>"112111221","T"=>"111121221","U"=>"221111112","V"=>"122111112","W"=>"222111111","X"=>"121121112","Y"=>"221121111","Z"=>"122121111","-"=>"121111212","."=>"221111211"," "=>"122111211","$"=>"121212111","/"=>"121211121","+"=>"121112121","%"=>"111212121","*"=>"121121211");
|
||||
|
||||
// Convert to uppercase
|
||||
$upper_text = strtoupper($text);
|
||||
|
||||
for ( $X = 1; $X<=strlen($upper_text); $X++ ) {
|
||||
$code_string .= $code_array[substr( $upper_text, ($X-1), 1)] . "1";
|
||||
}
|
||||
|
||||
$code_string = "1211212111" . $code_string . "121121211";
|
||||
} elseif ( strtolower($code_type) == "code25" ) {
|
||||
$code_array1 = array("1","2","3","4","5","6","7","8","9","0");
|
||||
$code_array2 = array("3-1-1-1-3","1-3-1-1-3","3-3-1-1-1","1-1-3-1-3","3-1-3-1-1","1-3-3-1-1","1-1-1-3-3","3-1-1-3-1","1-3-1-3-1","1-1-3-3-1");
|
||||
|
||||
for ( $X = 1; $X <= strlen($text); $X++ ) {
|
||||
for ( $Y = 0; $Y < count($code_array1); $Y++ ) {
|
||||
if ( substr($text, ($X-1), 1) == $code_array1[$Y] )
|
||||
$temp[$X] = $code_array2[$Y];
|
||||
}
|
||||
}
|
||||
|
||||
for ( $X=1; $X<=strlen($text); $X+=2 ) {
|
||||
if ( isset($temp[$X]) && isset($temp[($X + 1)]) ) {
|
||||
$temp1 = explode( "-", $temp[$X] );
|
||||
$temp2 = explode( "-", $temp[($X + 1)] );
|
||||
for ( $Y = 0; $Y < count($temp1); $Y++ )
|
||||
$code_string .= $temp1[$Y] . $temp2[$Y];
|
||||
}
|
||||
}
|
||||
|
||||
$code_string = "1111" . $code_string . "311";
|
||||
} elseif ( strtolower($code_type) == "codabar" ) {
|
||||
$code_array1 = array("1","2","3","4","5","6","7","8","9","0","-","$",":","/",".","+","A","B","C","D");
|
||||
$code_array2 = array("1111221","1112112","2211111","1121121","2111121","1211112","1211211","1221111","2112111","1111122","1112211","1122111","2111212","2121112","2121211","1121212","1122121","1212112","1112122","1112221");
|
||||
|
||||
// Convert to uppercase
|
||||
$upper_text = strtoupper($text);
|
||||
|
||||
for ( $X = 1; $X<=strlen($upper_text); $X++ ) {
|
||||
for ( $Y = 0; $Y<count($code_array1); $Y++ ) {
|
||||
if ( substr($upper_text, ($X-1), 1) == $code_array1[$Y] )
|
||||
$code_string .= $code_array2[$Y] . "1";
|
||||
}
|
||||
}
|
||||
$code_string = "11221211" . $code_string . "1122121";
|
||||
}
|
||||
|
||||
// Pad the edges of the barcode
|
||||
$code_length = 20;
|
||||
if ($print) {
|
||||
$text_height = 30;
|
||||
} else {
|
||||
$text_height = 0;
|
||||
}
|
||||
|
||||
for ( $i=1; $i <= strlen($code_string); $i++ ){
|
||||
$code_length = $code_length + (integer)(substr($code_string,($i-1),1));
|
||||
}
|
||||
|
||||
if ( strtolower($orientation) == "horizontal" ) {
|
||||
$img_width = $code_length*$SizeFactor;
|
||||
$img_height = $size;
|
||||
} else {
|
||||
$img_width = $size;
|
||||
$img_height = $code_length*$SizeFactor;
|
||||
}
|
||||
|
||||
$image = imagecreate($img_width, $img_height + $text_height);
|
||||
$black = imagecolorallocate ($image, 0, 0, 0);
|
||||
$white = imagecolorallocate ($image, 255, 255, 255);
|
||||
|
||||
imagefill( $image, 0, 0, $white );
|
||||
if ( $print ) {
|
||||
imagestring($image, 5, 31, $img_height, $text, $black );
|
||||
}
|
||||
|
||||
$location = 10;
|
||||
for ( $position = 1 ; $position <= strlen($code_string); $position++ ) {
|
||||
$cur_size = $location + ( substr($code_string, ($position-1), 1) );
|
||||
if ( strtolower($orientation) == "horizontal" )
|
||||
imagefilledrectangle( $image, $location*$SizeFactor, 0, $cur_size*$SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black) );
|
||||
else
|
||||
imagefilledrectangle( $image, 0, $location*$SizeFactor, $img_width, $cur_size*$SizeFactor, ($position % 2 == 0 ? $white : $black) );
|
||||
$location = $cur_size;
|
||||
}
|
||||
|
||||
// Draw barcode to the screen or save in a file
|
||||
if ( $filepath=="" ) {
|
||||
header ('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
} else {
|
||||
imagepng($image,$filepath);
|
||||
imagedestroy($image);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,253 @@
|
||||
<?php
|
||||
|
||||
# ========================================================================#
|
||||
#
|
||||
# Author: Jarrod Oberto
|
||||
# Version: 1.0
|
||||
# Date: 17-Jan-10
|
||||
# Purpose: Resizes and saves image
|
||||
# Requires : Requires PHP5, GD library.
|
||||
# Usage Example:
|
||||
# include("classes/resize_class.php");
|
||||
# $resizeObj = new resize('images/cars/large/input.jpg');
|
||||
# $resizeObj -> resizeImage(150, 100, 0);
|
||||
# $resizeObj -> saveImage('images/cars/large/output.jpg', 100);
|
||||
#
|
||||
#
|
||||
# ========================================================================#
|
||||
|
||||
|
||||
Class resize
|
||||
{
|
||||
// *** Class variables
|
||||
private $image;
|
||||
private $width;
|
||||
private $height;
|
||||
private $imageResized;
|
||||
|
||||
function __construct($fileName)
|
||||
{
|
||||
// *** Open up the file
|
||||
$this->image = $this->openImage($fileName);
|
||||
|
||||
// *** Get width and height
|
||||
$this->width = imagesx($this->image);
|
||||
$this->height = imagesy($this->image);
|
||||
}
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
private function openImage($file)
|
||||
{
|
||||
// *** Get extension
|
||||
$extension = strtolower(strrchr($file, '.'));
|
||||
|
||||
switch($extension)
|
||||
{
|
||||
case '.jpg':
|
||||
case '.jpeg':
|
||||
$img = @imagecreatefromjpeg($file);
|
||||
break;
|
||||
case '.gif':
|
||||
$img = @imagecreatefromgif($file);
|
||||
break;
|
||||
case '.png':
|
||||
$img = @imagecreatefrompng($file);
|
||||
break;
|
||||
default:
|
||||
$img = false;
|
||||
break;
|
||||
}
|
||||
return $img;
|
||||
}
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
public function resizeImage($newWidth, $newHeight, $option="auto")
|
||||
{
|
||||
// *** Get optimal width and height - based on $option
|
||||
$optionArray = $this->getDimensions($newWidth, $newHeight, $option);
|
||||
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
|
||||
|
||||
// *** Resample - create image canvas of x, y size
|
||||
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
|
||||
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height);
|
||||
|
||||
|
||||
// *** if option is 'crop', then crop too
|
||||
if ($option == 'crop') {
|
||||
$this->crop($optimalWidth, $optimalHeight, $newWidth, $newHeight);
|
||||
}
|
||||
}
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
private function getDimensions($newWidth, $newHeight, $option)
|
||||
{
|
||||
|
||||
switch ($option)
|
||||
{
|
||||
case 'exact':
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $newHeight;
|
||||
break;
|
||||
case 'portrait':
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
break;
|
||||
case 'landscape':
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
break;
|
||||
case 'auto':
|
||||
$optionArray = $this->getSizeByAuto($newWidth, $newHeight);
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
break;
|
||||
case 'crop':
|
||||
$optionArray = $this->getOptimalCrop($newWidth, $newHeight);
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
break;
|
||||
}
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
private function getSizeByFixedHeight($newHeight)
|
||||
{
|
||||
$ratio = $this->width / $this->height;
|
||||
$newWidth = $newHeight * $ratio;
|
||||
return $newWidth;
|
||||
}
|
||||
|
||||
private function getSizeByFixedWidth($newWidth)
|
||||
{
|
||||
$ratio = $this->height / $this->width;
|
||||
$newHeight = $newWidth * $ratio;
|
||||
return $newHeight;
|
||||
}
|
||||
|
||||
private function getSizeByAuto($newWidth, $newHeight)
|
||||
{
|
||||
if ($this->height < $this->width)
|
||||
// *** Image to be resized is wider (landscape)
|
||||
{
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
}
|
||||
elseif ($this->height > $this->width)
|
||||
// *** Image to be resized is taller (portrait)
|
||||
{
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
}
|
||||
else
|
||||
// *** Image to be resizerd is a square
|
||||
{
|
||||
if ($newHeight < $newWidth) {
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
} else if ($newHeight > $newWidth) {
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
} else {
|
||||
// *** Sqaure being resized to a square
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $newHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
private function getOptimalCrop($newWidth, $newHeight)
|
||||
{
|
||||
|
||||
$heightRatio = $this->height / $newHeight;
|
||||
$widthRatio = $this->width / $newWidth;
|
||||
|
||||
if ($heightRatio < $widthRatio) {
|
||||
$optimalRatio = $heightRatio;
|
||||
} else {
|
||||
$optimalRatio = $widthRatio;
|
||||
}
|
||||
|
||||
$optimalHeight = $this->height / $optimalRatio;
|
||||
$optimalWidth = $this->width / $optimalRatio;
|
||||
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
private function crop($optimalWidth, $optimalHeight, $newWidth, $newHeight)
|
||||
{
|
||||
// *** Find center - this will be used for the crop
|
||||
$cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
|
||||
$cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
|
||||
|
||||
$crop = $this->imageResized;
|
||||
//imagedestroy($this->imageResized);
|
||||
|
||||
// *** Now crop from center to exact requested size
|
||||
$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
|
||||
imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
|
||||
}
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
public function saveImage($savePath, $imageQuality="100")
|
||||
{
|
||||
// *** Get extension
|
||||
$extension = strrchr($savePath, '.');
|
||||
$extension = strtolower($extension);
|
||||
|
||||
switch($extension)
|
||||
{
|
||||
case '.jpg':
|
||||
case '.jpeg':
|
||||
if (imagetypes() & IMG_JPG) {
|
||||
imagejpeg($this->imageResized, $savePath, $imageQuality);
|
||||
}
|
||||
break;
|
||||
|
||||
case '.gif':
|
||||
if (imagetypes() & IMG_GIF) {
|
||||
imagegif($this->imageResized, $savePath);
|
||||
}
|
||||
break;
|
||||
|
||||
case '.png':
|
||||
// *** Scale quality from 0-100 to 0-9
|
||||
$scaleQuality = round(($imageQuality/100) * 9);
|
||||
|
||||
// *** Invert quality setting as 0 is best, not 9
|
||||
$invertScaleQuality = 9 - $scaleQuality;
|
||||
|
||||
if (imagetypes() & IMG_PNG) {
|
||||
imagepng($this->imageResized, $savePath, $invertScaleQuality);
|
||||
}
|
||||
break;
|
||||
|
||||
// ... etc
|
||||
|
||||
default:
|
||||
// *** No extension - No save.
|
||||
break;
|
||||
}
|
||||
|
||||
imagedestroy($this->imageResized);
|
||||
}
|
||||
|
||||
|
||||
## --------------------------------------------------------
|
||||
|
||||
}
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"type": "service_account",
|
||||
"project_id": "hr-system-b0af6",
|
||||
"private_key_id": "5bcb3596d437019f95b9d43e6a47c5456f9a8638",
|
||||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCouTmCxNvs14t6\nG0wZCb6lg2jOQG/cVzh1PPK38jDp88ehfljtvaCQx9ZXWrANnAZVqN9ufaL5zBS7\noT3Q6u7hO+9sakyrf70gzqgEgXEFs8Wa7/JHqChMPUmJoaDWhf/CEKGdeMGyBj4P\n9/Qt7TyQqDSpzKndx0raAVdQtybNKUrwNFO9RB7AOjuKU3FhDUKiFCZp4SllmPsJ\ntvUt3Wn/ItPhzRZLdcCR0P5+S71prwwu/5u8Xk/f1+OsC2Zgw5G62ztqbOOj4xUc\neWr6J66D0jNwBKPhf2vTINAdxzGQGiRD9iSOefP3499v+cbsUNx3Bce6lNgSJCt9\nPpz74309AgMBAAECggEABChkWWuee8yn/D9V9bv+vbdqSsLdvtFLa+AvnwbR28IN\nJlalvF4S6d5y0r5CXmN86Hl74A4qiPtVe3YyvsY7UsOWV9aawxMnxvowu8Ow1FIk\nyXemQcvMCmzsNf8Mppywu8iLIwVJyKhMuToEA2m4N1xdx91qRjPWDV9BFpUc2Ktk\nilC8YMobwiZYKyrtHH5m9eJCtdaUs4zRa1Ur0g+LFMpOh2O3g+eC+YDdN7mP6Bky\nErs403DVItMkFC82A8xLvhq5MLDPKcx6YFAlsXe/gNClhJ/lvG7OeX1aqDOqtm+U\ntA71sZXRh0qZ79hbKB5FQjropmNrg8yAIJ0nnNieRQKBgQDkhYvyg575yDGtgvGk\nGl7HTfzQg5YbarAAFgk3fw7pxrldUz70KsaGc2ixj4SXc24q8DMY2HQlGNYXBDZX\n29+pW2EE/HYlO0EY3ANj9ma1zwh/qB7SnC1eCpQ07q1qhadOfc/VhMICjuXAgN51\n63WNFTkKoXuJusEmKnihi05SQwKBgQC9AvIjKbdx9zl8MbCylEWhzVG7pl2seSnR\nPSKzLyUve+CdcN/IeAV6UIX8oZ3VpjAM2SUIQQQ7AAc0RaqLHBA0tpYQeqUh2+3i\nw6CqqX1KaP6X1uQEQooutRRFVv6vZ+zeZBU6gNb+ZA7jGn46k+PPYcXxCyN3XJ2G\nLVHBbGy6fwKBgQCBV+1cOI90xZEIqoLm5V4b5NJhmvkNT5eKlO5mkO3599bXMdUC\nEmwHka8CQT9FEbqbZxUkzO8ASEx0/pdbp0Gy89u4HMUqUZ2I2o64t7Bu213uE1RO\n1MMA5W/5fdZ94mROEvvd2KSPGh6ElOxVRg5k6kw87iWkUSYd2hApL1YHTQKBgDiQ\nkiBd0q2DnCuDv2qiHvieNpCe6De+hvo8fo77U/iS7RSQ/BfFe3YwdPi28UJIGuct\ncPy4YGi7yGwnUTOScXMlFWHXImYwqE+N1h5c3McRBugwAksYEryJqohZ0Zxy0Jt5\nfjTk6/JzxVTHz/D941Zj31YUzEdjay0FkQr+xMdHAoGBAISQ6K+tRnjAXi1Hnu/p\nWdmrem1wJrVZiVbXUJoduu/uBaexSetO+PaMniZrjZeDTYfq6DpjLbhrQB86jcj7\n0jrpy4nmgLjNU+QxKO2STrepnkDDzLhvohWkK8qBBQt95/FFfTXpH458Q97fUcS3\nJiBKfyvwllztWwch/m04964z\n-----END PRIVATE KEY-----\n",
|
||||
"client_email": "firebase-adminsdk-u5wel@hr-system-b0af6.iam.gserviceaccount.com",
|
||||
"client_id": "116658927130976853667",
|
||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||
"token_uri": "https://oauth2.googleapis.com/token",
|
||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-u5wel%40hr-system-b0af6.iam.gserviceaccount.com",
|
||||
"universe_domain": "googleapis.com"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<footer class="container-fluid footer">
|
||||
Copyright <?= date('Y', time()) ?> © <?= COMPANY ?>. Developed by <a href="http://ips.com.my" target="_blank">IPS Software Sdn. Bhd.</a>
|
||||
<a href="#" class="pull-right scrollToTop"><i class="fa fa-chevron-up"></i></a>
|
||||
</footer>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?= COMPANY ?></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="IPS Software Sdn. Bhd.">
|
||||
<meta name="creator" content="IPS Software Sdn. Bhd.">
|
||||
<meta name="robots" content="noindex,nofollow"/>
|
||||
<link type="image/ico" rel="shortcut icon" href="/images/favicon.ico">
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link rel="stylesheet" href="/css/jquery-ui.css" />
|
||||
<link rel="stylesheet" href="/css/bootstrap.css?v=<?= filemtime($_SERVER['DOCUMENT_ROOT'].'/css/bootstrap.css') ?>" />
|
||||
<link rel="stylesheet" href="/plugins/toastr/toastr.min.css">
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]><script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script><script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script><![endif]-->
|
||||
<script src="/scripts/jquery-1.8.3.js"></script><!-- JQuery v1.8.1 -->
|
||||
<script src="/scripts/jquery-ui-1.11.4.js"></script><!-- drag & drop effect -->
|
||||
<script src="/scripts/underscore-min.js"></script>
|
||||
<script src="/scripts/bootstrap.min.js"></script><!-- Bootstrap -->
|
||||
<script src="/scripts/globalize.min.js"></script><!-- Globalize -->
|
||||
<script src="/scripts/jquery.validate.js"></script><!-- validate -->
|
||||
<script src="/scripts/jquery.autocomplete.js"></script><!-- jquery autocomplete -->
|
||||
<script src="/scripts/jquery.fancybox.js"></script><!-- Fancybox -->
|
||||
<script src="/scripts/fixedThead.js"></script>
|
||||
<script src="/Ckeditor/ckeditor.js"></script><!-- Text Editor -->
|
||||
<script src="/scripts/select2.full.js"></script><!-- Select2 select box -->
|
||||
<script src="/scripts/custom.js"></script><!-- Custom JQuery -->
|
||||
<script src="/scripts/jquery.nicescroll.min.js"></script><!-- NanoScroll -->
|
||||
<script src="/scripts/bootstrap-datepicker.js"></script><!-- Date picker -->
|
||||
<script src="/scripts/jquery.unveil.js"></script><!-- lazy load effect -->
|
||||
<script src="/plugins/toastr/toastr.min.js"></script>
|
||||
<script src="/scripts/canvasjs.min.js"></script>
|
||||
<script src="/scripts/all.js?v=<?= filemtime($_SERVER['DOCUMENT_ROOT'].'/scripts/all.js') ?>"></script><!-- All -->
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key="></script>
|
||||
<script src="/scripts/all_map.js"></script><!-- All -->
|
||||
|
||||
</head>
|
||||
<body class="<?= $class_for_body ?>" >
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
if ($_SESSION["system_id"] == "" || $_SESSION["system_name"] == "" || $_SESSION["system_branch"] == "" || $_SESSION["system_permission"] == ""){
|
||||
// check cookie login
|
||||
checkCookieLogin() ;
|
||||
// redirect page
|
||||
header("Location: ".PATH."index.php") ;
|
||||
exit ;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$array = resetRequest( $_REQUEST ) ;
|
||||
$explode = explode( 'api/', $_SERVER['PHP_SELF'] ) ;
|
||||
|
||||
$access = false ;
|
||||
if ( $array['time'] > strtotime('-1 minutes') ){
|
||||
if ( hash('sha256', $array['platform'].$array['lang'].$array['branch_id'].$array['staff_id'].$array['token'].$array['time'].APIKEY) == $array['sign'] ){
|
||||
$access = true ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$access ){ header("HTTP/1.0 404 Not Found") ; exit ; }
|
||||
?>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
include_once '../connect/cms-config.php' ;
|
||||
include_once '../requires/function.php' ;
|
||||
|
||||
// check login
|
||||
if ($_SESSION['system_id'] == '' && $_SESSION['system_name'] == ''){
|
||||
|
||||
$user = escapeString($_POST['user_name']); // name
|
||||
$password = $_POST['user_password'] ; // password
|
||||
|
||||
if ($user != '' && $password != ''){
|
||||
|
||||
// query for user
|
||||
$mysqli_user = $mysqli->query("SELECT user_code FROM system_user WHERE
|
||||
user_name = '".$user."' AND user_trash = '0' LIMIT 1") ;
|
||||
// check if user exists
|
||||
if ($mysqli_user->num_rows > 0){
|
||||
// set query as array
|
||||
$row_user = $mysqli_user->fetch_array(MYSQLI_ASSOC) ;
|
||||
// encode password with md5 + code
|
||||
$code = $row_user['user_code'] ;
|
||||
// check if capcha corrent
|
||||
$password = md5(md5($password).$code) ;
|
||||
// query for user
|
||||
$mysqli_user = $mysqli->query("SELECT user_id, user_name, user_code, user_permission, user_visit_count FROM system_user WHERE
|
||||
user_name = '".$user."' AND user_password = '".$password."' AND user_trash = '0' LIMIT 1") ;
|
||||
// check if user exists
|
||||
if ($mysqli_user->num_rows > 0){
|
||||
echo 4 ;
|
||||
}else{
|
||||
echo 2 ;
|
||||
}
|
||||
}else{
|
||||
echo 2 ;
|
||||
}
|
||||
exit ;
|
||||
}
|
||||
}
|
||||
echo 'Page Error.' ;
|
||||
?>
|
||||
Reference in New Issue
Block a user