first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$query = "SELECT branch_id, branch_name, branch_hq FROM branch
|
||||
WHERE deleted_at IS NULL " ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
|
||||
$list = [] ;
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$row['branch_name'] = dataFilter( $row['branch_name'] ) ;
|
||||
$row['branch_hq'] = ( $row['branch_hq'] != '' ? $row['branch_hq'] : '0' ) ;
|
||||
$list[] = $row ;
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$search_query = '' ;
|
||||
$search_query .= " AND a.view_id = '".$array['id']."'" ;
|
||||
|
||||
$query = "SELECT a.view_id, a.inbox_id, a.is_read, b.from_table, b.from_id, b.title, b.description, b.content, b.view_format, b.file, b.file_type, b.video_url, b.created_at FROM staff_inbox_view a
|
||||
LEFT JOIN inbox b ON ( a.inbox_id = b.inbox_id )
|
||||
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' " . $search_query ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
$row = $mysqli_query->fetch_assoc() ;
|
||||
|
||||
$file = '' ;
|
||||
if ( $row['file'] != '' ){
|
||||
if ( $row['file_type'] == 'pdf' ){
|
||||
$file = PATH.'uploads/Inbox/'.$row['file'] ;
|
||||
}else{
|
||||
$file = PATH.'uploads/Inbox/b/'.$row['file'] ;
|
||||
}
|
||||
}
|
||||
|
||||
$row['title'] = dataFilter( $row['title'] ) ;
|
||||
$row['description'] = dataFilter( $row['description'] ) ;
|
||||
$row['content'] = dataFilter( $row['content'] ) ;
|
||||
$row['file'] = $file ;
|
||||
$row['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
|
||||
$go_page = '' ;
|
||||
$go_param = '' ;
|
||||
|
||||
$is_updateread = true ;
|
||||
|
||||
switch ( $row['from_table'] ){
|
||||
case 'task' :
|
||||
$go_page = 'TaskView' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'redeem' :
|
||||
$go_page = 'RedeemDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'], 'view_id' => '' ] ;
|
||||
break ;
|
||||
case 'staff_redeem' :
|
||||
$select_view = $mysqli->query( "SELECT redeem_id FROM staff_redeem WHERE view_id = '".$row['from_id']."' LIMIT 1" ) ;
|
||||
$main_id = '' ;
|
||||
if ( $select_view->num_rows > 0 ){
|
||||
$row_view = $select_view->fetch_assoc() ;
|
||||
$main_id = $row_view['redeem_id'] ;
|
||||
|
||||
$go_page = 'RedeemView' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $main_id, 'view_id' => $row['from_id'] ] ;
|
||||
}
|
||||
break ;
|
||||
case 'association' :
|
||||
$go_page = 'AssociationDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'], 'view_id' => '' ] ;
|
||||
break ;
|
||||
case 'staff_association' :
|
||||
$select_view = $mysqli->query( "SELECT association_id FROM staff_association WHERE view_id = '".$row['from_id']."' LIMIT 1" ) ;
|
||||
$main_id = '' ;
|
||||
if ( $select_view->num_rows > 0 ){
|
||||
$row_view = $select_view->fetch_assoc() ;
|
||||
$main_id = $row_view['association_id'] ;
|
||||
|
||||
$go_page = 'AssociationView' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $main_id, 'view_id' => $row['from_id'] ] ;
|
||||
}
|
||||
break ;
|
||||
case 'training' :
|
||||
$go_page = 'TrainingDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'], 'view_id' => '' ] ;
|
||||
break ;
|
||||
case 'staff_training' :
|
||||
$select_view = $mysqli->query( "SELECT training_id FROM staff_training WHERE view_id = '".$row['from_id']."' LIMIT 1" ) ;
|
||||
$main_id = '' ;
|
||||
if ( $select_view->num_rows > 0 ){
|
||||
$row_view = $select_view->fetch_assoc() ;
|
||||
$main_id = $row_view['training_id'] ;
|
||||
|
||||
$go_page = 'TrainingView' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $main_id, 'view_id' => $row['from_id'] ] ;
|
||||
}
|
||||
break ;
|
||||
case 'suggestion' :
|
||||
$go_page = 'SuggestionUpdate' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'grievance' :
|
||||
$go_page = 'GrievanceUpdate' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'request' :
|
||||
$go_page = 'RequestUpdate' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'staff_adjustment' :
|
||||
$go_page = 'AdjustmentDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'handbook' :
|
||||
$go_page = 'HandbookDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'staff_leave' :
|
||||
$go_page = 'LeaveDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'staff_payment_slip':
|
||||
$go_page = 'PaymentSlipUpdate' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'staff_advance' :
|
||||
$go_page = 'AdvanceUpdate' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'staff_health' :
|
||||
$go_page = 'HealthUpdate' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'holiday' :
|
||||
$go_page = 'Holiday' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => '' ] ;
|
||||
break ;
|
||||
case 'announcement' :
|
||||
$select_announcement = $mysqli->query( "SELECT is_showagree FROM announcement
|
||||
WHERE deleted_at IS NULL AND status = 'active' AND announcement_id = '".$row['from_id']."' LIMIT 1" ) ;
|
||||
if ( $select_announcement->num_rows > 0 ){
|
||||
$row_announcement = $select_announcement->fetch_assoc() ;
|
||||
if ( $row_announcement['is_showagree'] == 'yes' ){
|
||||
$select_agree = $mysqli->query( "SELECT * FROM staff_announcement
|
||||
WHERE deleted_at IS NULL AND announcement_id = '".$row['from_id']."' AND staff_id = '".$staff_info['staff_id']."' LIMIT 1" ) ;
|
||||
if ( $select_agree->num_rows == 0 ){
|
||||
$is_updateread = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$go_page = 'AnnouncementDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'outstanding-employee' :
|
||||
case 'lateness-board' :
|
||||
$go_page = 'Home' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => '', 'id' => '' ] ;
|
||||
break ;
|
||||
case 'association_gallery' :
|
||||
case 'training_gallery' :
|
||||
case 'request_gallery' :
|
||||
$select_view = $mysqli->query( "SELECT file FROM ".$row['from_table']." WHERE gallery_id = '".$row['from_id']."' LIMIT 1" ) ;
|
||||
$main_id = '' ;
|
||||
if ( $select_view->num_rows > 0 ){
|
||||
$row_view = $select_view->fetch_assoc() ;
|
||||
|
||||
$path = '' ;
|
||||
switch ( $row['from_table'] ){
|
||||
case 'association_gallery' :
|
||||
$path = 'AssociationGallery' ;
|
||||
break ;
|
||||
case 'training_gallery' :
|
||||
$path = 'TrainingGallery' ;
|
||||
break ;
|
||||
case 'request_gallery' :
|
||||
$path = 'RequestGallery' ;
|
||||
break ;
|
||||
}
|
||||
|
||||
$files = ( $row_view['file'] != '' ? [ PATH.'uploads/'.$path.'/b/'.$row_view['file'] ] : [] ) ;
|
||||
|
||||
$go_page = 'ImageZoom' ;
|
||||
$go_param = [ 'refresh' => '', 'files' => $files ] ;
|
||||
}
|
||||
break ;
|
||||
case 'form' :
|
||||
$go_page = 'FormDetails' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
case 'formresignation' :
|
||||
$go_page = 'FormResignationUpdate' ;
|
||||
$go_param = [ 'refresh' => '', 'type' => 'update', 'id' => $row['from_id'] ] ;
|
||||
break ;
|
||||
}
|
||||
|
||||
$row['go_page'] = $go_page ;
|
||||
$row['go_param'] = $go_param ;
|
||||
|
||||
$data['list'] = $row ;
|
||||
|
||||
// update is read
|
||||
if ( $row['is_read'] == '0' && $is_updateread ) {
|
||||
$mysqli->query( "UPDATE staff_inbox_view SET
|
||||
is_read = '1'
|
||||
WHERE view_id = '".$row['view_id']."'" ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$search_query = '' ;
|
||||
if ( $array['search']!= '' ){
|
||||
$search_query .= " AND b.title LIKE '%".$array['search']."%'" ;
|
||||
}
|
||||
if ( $array['searchstatus'] != '' ){
|
||||
$get_status = '' ;
|
||||
switch ( $array['searchstatus'] ){
|
||||
case 'unread' :
|
||||
$get_status = '0' ;
|
||||
break ;
|
||||
case 'read' :
|
||||
$get_status = '1' ;
|
||||
break ;
|
||||
}
|
||||
$search_query .= " AND a.is_read = '".$get_status."'" ;
|
||||
}
|
||||
|
||||
$query = "SELECT a.view_id, a.inbox_id, a.is_read, b.title, b.description, b.created_at FROM staff_inbox_view a
|
||||
LEFT JOIN inbox b ON ( a.inbox_id = b.inbox_id )
|
||||
WHERE a.deleted_at IS NULL AND b.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' " . $search_query ;
|
||||
$mysqli_query = $mysqli->query( $query . " ORDER BY b.created_at DESC LIMIT " . getLimit( $current ) ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
|
||||
$list = [] ;
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$row['title'] = dataFilter( $row['title'] ) ;
|
||||
$row['description'] = dataFilter( $row['description'] ) ;
|
||||
$row['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
$list[] = $row ;
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// total inbox
|
||||
$mysqli_query = $mysqli->query( "SELECT COUNT( a.view_id ) as total FROM staff_inbox_view a
|
||||
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' AND a.is_read = '0'" ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
$row = $mysqli_query->fetch_assoc() ;
|
||||
$count_inbox = $row['total'] ;
|
||||
}
|
||||
$data['count_inbox'] = $count_inbox ;
|
||||
|
||||
|
||||
// mark notification as 0
|
||||
$mysqli->query( "UPDATE staff_notification SET badge = '0' WHERE staff_id = '".$staff_info['staff_id']."'" ) ;
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '202' ;
|
||||
|
||||
if ( $mysqli->query( "UPDATE staff_inbox_view SET
|
||||
is_read = '1'
|
||||
WHERE deleted_at IS NULL AND staff_id = '".$staff_info['staff_id']."'" ) ){
|
||||
$status = '200' ;
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$list = [] ;
|
||||
|
||||
$query = "SELECT a.code, a.file, a.created_at, b.title, b.content FROM profile_achievement a
|
||||
LEFT JOIN profile_achievement_translation b ON ( a.achievement_id = b.achievement_id )
|
||||
WHERE deleted_at IS NULL AND b.lang = '".$array['lang']."'" ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
$status = '200' ;
|
||||
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$temp = [] ;
|
||||
$temp['code'] = dataFilter( $row['code'] ) ;
|
||||
$temp['title'] = dataFilter( $row['title'] ) ;
|
||||
$temp['content'] = dataFilter( $row['content'] ) ;
|
||||
$temp['file'] = ( $row['file'] != '' ? PATH.'uploads/ProfileAchievement/b/'.$row['file'] : '' ) ;
|
||||
$temp['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
$list[] = $temp ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$list = [] ;
|
||||
|
||||
$query = "SELECT * FROM profile_tier
|
||||
WHERE deleted_at IS NULL " ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
$status = '200' ;
|
||||
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$temp = [] ;
|
||||
$temp['title'] = dataFilter( $row['title'] ) ;
|
||||
$temp['sub'] = dataFilter( $row['sub'] ) ;
|
||||
$temp['content'] = dataFilter( $row['content'] ) ;
|
||||
$temp['file'] = ( $row['file'] != '' ? PATH.'uploads/ProfileTier/b/'.$row['file'] : '' ) ;
|
||||
$temp['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
$list[] = $temp ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
|
||||
$search_query = '' ;
|
||||
if ( $array['search'] != '' ){
|
||||
$search_query .= " AND ( a.remark LIKE '%".$array['search']."%' )" ;
|
||||
}
|
||||
|
||||
$query = "SELECT a.movement_id, a.from_table, a.before_amount, a.amount, a.balance, a.remark, a.created_at FROM staff_point_movement a
|
||||
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' " . $search_query ;
|
||||
$mysqli_query = $mysqli->query( $query . " ORDER BY a.movement_id DESC LIMIT " . getLimit( $current ) ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
|
||||
$list = [] ;
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$list[] = $row ;
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
$html = '' ;
|
||||
$list = [] ;
|
||||
|
||||
$total_accumulated = 0 ;
|
||||
$total_redeem = 0 ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
|
||||
if ( $array['iswebview'] == 'no' ){
|
||||
|
||||
|
||||
// get point list
|
||||
$query = "SELECT a.point_id, a.file, a.created_at, b.title, b.content FROM profile_point a
|
||||
LEFT JOIN profile_point_translation b ON ( a.point_id = b.point_id )
|
||||
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."'" ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
$status = '200' ;
|
||||
|
||||
$row = $mysqli_query->fetch_assoc() ;
|
||||
$temp = [] ;
|
||||
$temp['title'] = dataFilter( $row['title'] ) ;
|
||||
$temp['content'] = dataFilter( $row['content'] ) ;
|
||||
$temp['file'] = ( $row['file'] != '' ? PATH.'uploads/ProfilePoint/b/'.$row['file'] : '' ) ;
|
||||
$temp['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
$list = $temp ;
|
||||
}
|
||||
|
||||
|
||||
// get total accumulated point
|
||||
// 'system','staff_point_movement_cutoff','task','redeem','adjustment','training'
|
||||
$select_movement = $mysqli->query( "SELECT SUM( amount ) as total FROM staff_point_movement
|
||||
WHERE staff_id = '".$staff_info['staff_id']."' AND from_table IN ( 'system','task','adjustment','training' ) AND created_at LIKE '%".date('Y', time())."-%'" ) ;
|
||||
if ( $select_movement->num_rows > 0 ){
|
||||
$data_movement = $select_movement->fetch_assoc() ;
|
||||
$total_accumulated = $data_movement['total'] ;
|
||||
}
|
||||
|
||||
// get total redeem
|
||||
$select_movement = $mysqli->query( "SELECT SUM( amount ) as total FROM staff_point_movement
|
||||
WHERE staff_id = '".$staff_info['staff_id']."' AND from_table IN ( 'redeem' ) AND created_at LIKE '%".date('Y', time())."-%'" ) ;
|
||||
if ( $select_movement->num_rows > 0 ){
|
||||
$data_movement = $select_movement->fetch_assoc() ;
|
||||
$total_redeem = $data_movement['total'] ;
|
||||
$total_redeem = numberFormat( $total_redeem < 0 ? -( $total_redeem ) : 0 ) ;
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
$data['total_accumulated'] = $total_accumulated ;
|
||||
$data['total_redeem'] = $total_redeem ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// direct echo
|
||||
if ( $array['iswebview'] == 'yes' ){
|
||||
require( $require_path.'languages/'.$array['lang'].'.php' ) ;
|
||||
|
||||
$search_year = ( $array['search_year'] != '' ? $array['search_year'] : date('Y') ) ;
|
||||
$search_type = ( $array['search_type'] != '' ? $array['search_type'] : 'personal' ) ;
|
||||
|
||||
$staff_settings = $staff_info['staff_settings'] ;
|
||||
|
||||
$months = [] ;
|
||||
$months_name = [ $lang['Jan'], $lang['Feb'], $lang['Mar'], $lang['Apr'], $lang['May'], $lang['Jun'], $lang['Jul'], $lang['Aug'], $lang['Sep'], $lang['Oct'], $lang['Nov'], $lang['Dec'] ] ;
|
||||
for ( $a = 1 ; $a <= 12 ; $a++ ){ $months[$a] = 0 ; }
|
||||
|
||||
// monthly report = by personal or whole branch
|
||||
$array_report = [
|
||||
'personal' => [
|
||||
'yes' => $months
|
||||
],
|
||||
] ;
|
||||
|
||||
$filtertype = [] ;
|
||||
foreach ( $array_report as $k => $v ){
|
||||
if ( $k == $search_type ){
|
||||
$filtertype[] = $k ;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $filtertype as $k => $v ){
|
||||
|
||||
$search_query = " AND ( a.staff_id = '".$staff_info['staff_id']."' )" ;
|
||||
|
||||
$select_task = $mysqli->query( "SELECT SUM(a.staff_point_achievement) as total, MONTH(a.reported_at) as month FROM staff_monthly_achievement a
|
||||
WHERE a.deleted_at IS NULL AND a.reported_at LIKE '%".$search_year."%' ".$search_query."
|
||||
GROUP BY MONTH(a.reported_at)" ) ;
|
||||
if ( $select_task->num_rows > 0 ){
|
||||
while ( $row_report = $select_task->fetch_assoc() ){
|
||||
$array_report[$v]['yes'][$row_report['month']] = $row_report['total'] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$html .= '
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="'.PATH.'css/bootstrap.css?v='.filemtime($require_path.'css/bootstrap.css').'" />
|
||||
<script src="'.PATH.'scripts/chart.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="report_chart_main">
|
||||
|
||||
<div class="report_chart_filter_year">
|
||||
<a href="?search_year='.( $search_year - 1 ).resetGetParams($array, [ 'search_year' ]).'" class="report_chart_filter_year_button">
|
||||
<i class="fa fa-chevron-left" aria-hidden="true"></i>
|
||||
</a>
|
||||
<span class="report_chart_filter_year_span">'. $search_year .'</span>
|
||||
<a href="?search_year='.( $search_year + 1 ).resetGetParams($array, [ 'search_year' ]).'" class="report_chart_filter_year_button">
|
||||
<i class="fa fa-chevron-right" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>' ;
|
||||
|
||||
foreach ( $array_report as $kreport => $vreport ){
|
||||
|
||||
if ( $kreport == $search_type ){
|
||||
|
||||
$title = $lang['By '.ucwords($kreport).' Report'] ;
|
||||
$titlename = $title.' ( '.$lang['Year'].' '.$search_year.' )' ;
|
||||
|
||||
$html .= '
|
||||
<div class="report_chart_line">
|
||||
<canvas id="myChart'.$kreport.'"></canvas>
|
||||
</div>
|
||||
<script>
|
||||
const ctx'.$kreport.' = document.getElementById("myChart'.$kreport.'") ;
|
||||
const config'.$kreport.' = {
|
||||
type : "line",
|
||||
data : {
|
||||
datasets : [
|
||||
{
|
||||
label : "'.$lang['Completed Task'].'",
|
||||
data : [ "'.implode( '", "', $vreport['yes'] ).'" ]
|
||||
}
|
||||
],
|
||||
labels : [ "'.implode( '", "', $months_name ).'" ]
|
||||
},
|
||||
options: {
|
||||
responsive : true,
|
||||
maintainAspectRatio : false,
|
||||
plugins : {
|
||||
legend : {
|
||||
position : "top",
|
||||
},
|
||||
title : {
|
||||
display : true,
|
||||
text : "'.$titlename.'"
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
new Chart( ctx'.$kreport.', config'.$kreport.' ) ;
|
||||
</script>' ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '
|
||||
</div>
|
||||
</body>
|
||||
</html>' ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $array['iswebview'] == 'yes' ){
|
||||
echo $html ;
|
||||
exit ;
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
$html = '' ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$list = [] ;
|
||||
|
||||
if ( $array['iswebview'] == 'no' ){
|
||||
|
||||
$query = "SELECT a.file, a.created_at, b.title, b.content FROM profile_star a
|
||||
LEFT JOIN profile_star_translation b ON ( a.star_id = b.star_id )
|
||||
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."'" ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
$status = '200' ;
|
||||
|
||||
$row = $mysqli_query->fetch_assoc() ;
|
||||
$temp = [] ;
|
||||
$temp['title'] = dataFilter( $row['title'] ) ;
|
||||
$temp['content'] = dataFilter( $row['content'] ) ;
|
||||
$temp['file'] = ( $row['file'] != '' ? PATH.'uploads/ProfileStar/b/'.$row['file'] : '' ) ;
|
||||
$temp['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
$list = $temp ;
|
||||
}
|
||||
$data['list'] = $list ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// direct echo
|
||||
if ( $array['iswebview'] == 'yes' ){
|
||||
$get_monthly = getMonthlyAchievement( date('Y', time()), $staff_info['staff_id'] ) ;
|
||||
$get_star[] = [ 'Month', 'Star' ] ;
|
||||
foreach ( $get_monthly as $k => $v ){
|
||||
$get_star[] = [ date('m', strtotime($v['reported_at'])), $v['staff_star'] ] ;
|
||||
}
|
||||
|
||||
$html .= '
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
||||
<style> td{ padding: 5px; } </style>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
google.charts.load(\'current\', {\'packages\':[\'bar\']});
|
||||
google.charts.setOnLoadCallback(drawStuff);
|
||||
|
||||
function drawStuff() {
|
||||
var data = new google.visualization.arrayToDataTable( '.json_encode( $get_star ).' ) ;
|
||||
|
||||
var options = {
|
||||
chart: { title: \'Yearly Star Report\' },
|
||||
bars: \'vertical\'
|
||||
} ;
|
||||
var chart = new google.charts.Bar(document.getElementById(\'barchart\')) ;
|
||||
chart.draw(data, options);
|
||||
};
|
||||
</script>
|
||||
|
||||
<div style="padding: 0 20px;">
|
||||
<div id="barchart" style="width: 100%; height: 500px;"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>' ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $array['iswebview'] == 'yes' ){
|
||||
echo $html ;
|
||||
exit ;
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$list = [] ;
|
||||
|
||||
$query = "SELECT a.tier_id, a.file, a.created_at, b.title, b.sub, b.content 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 = '".$array['lang']."' ORDER BY a.sortable ASC" ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
$status = '200' ;
|
||||
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$temp = [] ;
|
||||
$temp['tier_id'] = dataFilter( $row['tier_id'] ) ;
|
||||
$temp['title'] = dataFilter( $row['title'] ) ;
|
||||
$temp['sub'] = dataFilter( $row['sub'] ) ;
|
||||
$temp['content'] = dataFilter( $row['content'] ) ;
|
||||
$temp['file'] = ( $row['file'] != '' ? PATH.'uploads/ProfileTier/b/'.$row['file'] : '' ) ;
|
||||
$temp['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
$list[] = $temp ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '206' ;
|
||||
|
||||
if ( $mysqli->query( "UPDATE staff SET
|
||||
deleted_at = '".TODAYDATE."'
|
||||
WHERE staff_id = '".$staff_info['staff_id']."'" ) ){
|
||||
$status = '200' ;
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_path.'extensions/sms.php' ) ;
|
||||
require( $require_path.'extensions/mailer.php' ) ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '300' ;
|
||||
|
||||
if ( $array['current'] != '' && $array['password'] != '' && $array['confirm'] != '' ){
|
||||
$status = '284' ;
|
||||
|
||||
$password = passwordEncrypt( $array['current'] ) ;
|
||||
$mysqli_staff = $mysqli->query("SELECT staff_id, staff_idno, staff_name, staff_shortname, staff_username, staff_email, staff_mobileno, staff_image, job_position_id, job_section_id, staff_point_achievement, staff_point, staff_wallet, staff_tier, staff_achievement, staff_star FROM staff
|
||||
WHERE deleted_at IS NULL AND ( staff_date_resigned IS NULL OR staff_date_resigned = '0000-00-00' ) AND staff_id = '".$staff_info['staff_id']."' AND staff_password = '".$password."' LIMIT 1") ;
|
||||
if ( $mysqli_staff->num_rows > 0 ){
|
||||
$status = '286' ;
|
||||
|
||||
if ( $array['password'] == $array['confirm'] ){
|
||||
$status = '285' ;
|
||||
|
||||
if ( strlen( $array['password'] ) >= 6 ){
|
||||
|
||||
$status = '205' ;
|
||||
|
||||
$password = $staff_info['staff_id'].strPad( 6, rand(000000, 999999) ) ;
|
||||
$enc_password = passwordEncrypt( $array['password'] ) ;
|
||||
|
||||
if ( $mysqli->query( "UPDATE staff SET
|
||||
staff_password = '".$enc_password."'
|
||||
WHERE staff_id = '".$staff_info['staff_id']."'" ) ){
|
||||
|
||||
$status = '208' ;
|
||||
|
||||
$mailer = new Mailer() ;
|
||||
$mailer->from = EMAILNOREPLY ;
|
||||
$mailer->to = [ $staff_info['staff_email'] ] ;
|
||||
$mailer->subject = 'Change password' ;
|
||||
$mailer->body = 'Your new password was success change to ' . $array['password'] ;
|
||||
if ( $mailer->send() ){
|
||||
$status = '200' ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
Reference in New Issue
Block a user