110 lines
3.7 KiB
PHP
110 lines
3.7 KiB
PHP
<?php
|
|
$search_query = str_replace( 'a.branch_id', 'a.employment_branch', $user_branch_permission_sql_a ) ;
|
|
|
|
|
|
$department_lists = [] ;
|
|
$select_departments = $mysqli->query( "SELECT a.department_id, b.department_desc FROM setting_department a
|
|
LEFT JOIN setting_department_translation b ON ( a.department_id = b.department_id )
|
|
WHERE a.deleted_at IS NULL AND b.lang = 'en'" ) ;
|
|
if ( $select_departments->num_rows > 0 ){
|
|
while ( $row_department = $select_departments->fetch_assoc() ){
|
|
$department_lists[$row_department['department_id']] = dataFilter( $row_department['department_desc'] ) ;
|
|
}
|
|
}
|
|
|
|
// reject report
|
|
$reject_lists = [] ;
|
|
$select_employment = $mysqli->query( "SELECT
|
|
COUNT(a.employment_department) as total,
|
|
a.employment_department
|
|
FROM staff_employment a
|
|
WHERE a.deleted_at IS NULL AND a.employment_trash = '0' AND a.employment_modified LIKE '%" . $date_time . "%'
|
|
AND a.employment_status IN ( 'Processing Rejected', 'Reject' )
|
|
" . $search_query . "
|
|
GROUP BY a.employment_department" ) ;
|
|
if ( $select_employment->num_rows > 0 ){
|
|
while ( $row_employment = $select_employment->fetch_assoc() ){
|
|
$get_department = $department_lists[$row_employment['employment_department']] ;
|
|
$get_department = ( $get_department == '' ? 'Cross Department' : $get_department ) ;
|
|
|
|
$reject_lists[] = [
|
|
'label' => $get_department,
|
|
'y' => floatval( $row_employment['total'] )
|
|
] ;
|
|
}
|
|
}
|
|
|
|
|
|
// complete report
|
|
$complete_lists = [] ;
|
|
$select_employment = $mysqli->query( "SELECT
|
|
COUNT(a.employment_department) as total,
|
|
a.employment_department
|
|
FROM staff_employment a
|
|
WHERE a.deleted_at IS NULL AND a.employment_trash = '0' AND a.employment_modified LIKE '%" . $date_time . "%'
|
|
AND a.employment_status IN ( 'Confirmation' )
|
|
" . $search_query . "
|
|
GROUP BY a.employment_department" ) ;
|
|
if ( $select_employment->num_rows > 0 ){
|
|
while ( $row_employment = $select_employment->fetch_assoc() ){
|
|
$get_department = $department_lists[$row_employment['employment_department']] ;
|
|
$get_department = ( $get_department == '' ? 'Cross Department' : $get_department ) ;
|
|
|
|
$complete_lists[] = [
|
|
'label' => $get_department,
|
|
'y' => floatval( $row_employment['total'] )
|
|
] ;
|
|
}
|
|
}
|
|
?>
|
|
|
|
<script>
|
|
window.onload = function() {
|
|
|
|
// reject chart
|
|
var rejectchart = new CanvasJS.Chart("rejectContainer", {
|
|
animationEnabled: true,
|
|
title: {
|
|
text: "Total of Rejected Staff Application"
|
|
},
|
|
data: [{
|
|
type: "pie",
|
|
startAngle: 240,
|
|
yValueFormatString: "##0",
|
|
indexLabel: "{label} {y}",
|
|
dataPoints: <?= json_encode($reject_lists) ?>
|
|
}]
|
|
});
|
|
rejectchart.render() ;
|
|
|
|
|
|
|
|
// complete chart
|
|
var completechart = new CanvasJS.Chart("completeContainer", {
|
|
animationEnabled: true,
|
|
title: {
|
|
text: "Total of Completed Staff Application"
|
|
},
|
|
data: [{
|
|
type: "pie",
|
|
startAngle: 240,
|
|
yValueFormatString: "##0",
|
|
indexLabel: "{label} {y}",
|
|
dataPoints: <?= json_encode($complete_lists) ?>
|
|
}]
|
|
});
|
|
completechart.render() ;
|
|
}
|
|
</script>
|
|
|
|
|
|
<div class="dashboard_section">
|
|
<div class="row dashboard_chart">
|
|
<div class="col-sm-6">
|
|
<div id="rejectContainer" class="chart_div"></div>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<div id="completeContainer" class="chart_div"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|