first commit
This commit is contained in:
@@ -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' ) ;
|
||||
?>
|
||||
Reference in New Issue
Block a user