317 lines
15 KiB
PHP
317 lines
15 KiB
PHP
<style>
|
|
.table-containerdm {
|
|
width: 50%;
|
|
/* Set the desired width */
|
|
height: 1000px;
|
|
/* Set the desired height */
|
|
overflow: auto;
|
|
border: 1px solid #ccc;
|
|
/* Optional: adds a border around the container */
|
|
}
|
|
|
|
.table-containerdm>table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.table-containerdm>table>th,
|
|
td {
|
|
padding: 8px;
|
|
/* text-align: left; */
|
|
border: 1px solid #ddd;
|
|
}
|
|
|
|
.table-containerdm>table>th {
|
|
background-color: #f2f2f2;
|
|
}
|
|
</style>
|
|
<div class="row" style="font-size: large;">
|
|
<div class="col-sm-12 wizard-card" style="margin: 20px 17px 0px 13px; padding:20px 0 20px 25px;">
|
|
<div class="box box-success">
|
|
|
|
<div class="box box-success ">
|
|
<div class="box-header box-header-flat">
|
|
<h5 class="box-title lighter">
|
|
<a role="button" data-toggle="collapse" href="#collapse_check_health_index" aria-expanded="false" aria-controls="collapseOne" id="ali">
|
|
Annual medical examination- Analysis report: WC & BC - <?php echo $year; ?>
|
|
</a>
|
|
</h5>
|
|
</div>
|
|
<div id="collapse_check_health_index" class="panel-collapse collapse">
|
|
<div class="box-body">
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<?php
|
|
$mergedArray = array_merge($first_array, $second_array, $three_array, $four_array, $five_array, $six_array);
|
|
// print_r($mergedArray);
|
|
$countM = 0;
|
|
$countF = 0;
|
|
$Age18to30 = 0;
|
|
$Age31to40 = 0;
|
|
$Age41to50 = 0;
|
|
$Age51toAbove = 0;
|
|
$DepartmentId = array();
|
|
// $commaSperated = implode(",", $mergedArray);
|
|
echo $commaSperated;
|
|
foreach ($mergedArray as $key => $empid) {
|
|
$Gender = getFieldFromTable('gender', 'patient_master', 'id', $empid);
|
|
$Dobwithage = calculateAgewithoutLable(getFieldFromTable('dob', 'patient_master', 'id', $empid));
|
|
if ($Gender == 'M') {
|
|
$countM++;
|
|
} else if ($Gender == 'F') {
|
|
$countF++;
|
|
}
|
|
|
|
if ($Dobwithage >= 18 && $Dobwithage <= 30) {
|
|
$Age18to30++;
|
|
} else if ($Dobwithage >= 31 && $Dobwithage <= 40) {
|
|
$Age31to40++;
|
|
} else if ($Dobwithage >= 41 && $Dobwithage <= 50) {
|
|
$Age41to50++;
|
|
} else if ($Dobwithage >= 51) {
|
|
$Age51toAbove++;
|
|
}
|
|
|
|
$dept = getFieldFromTable('dept_id', 'patient_master', 'id', $empid);
|
|
|
|
$departName = getFieldFromTable('dept_name', 'department', 'dept_id', $dept);
|
|
// $DepartmentId[] = $dept;
|
|
|
|
if (isset($DepartmentId[$departName])) {
|
|
$DepartmentId[$departName]++;
|
|
} else {
|
|
$DepartmentId[$departName] = 1;
|
|
}
|
|
}
|
|
|
|
// $DepartmentUniqueName = array_unique($DepartmentName);
|
|
|
|
// print_r($DepartmentId);
|
|
|
|
?>
|
|
<table class="table table-bordered" style="border: 1px solid black;">
|
|
|
|
<tr>
|
|
<th colspan="2" style="background-color: #ABEBC6;">
|
|
<h3>
|
|
Gender Distribution
|
|
</h3>
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<th style="font-size: 1.5rem;">Gender</th>
|
|
<th style="font-size: 1.5rem;">Numbers</th>
|
|
</tr>
|
|
<tr>
|
|
<td>Male</td>
|
|
<td><?php echo $countM; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Female</td>
|
|
<td><?php echo $countF; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Total</td>
|
|
<td><?php echo $countM + $countF; ?></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<canvas id="myChart_Gender" width="300" height="120"></canvas>
|
|
<script>
|
|
var ctx = document.getElementById('myChart_Gender').getContext('2d');
|
|
var myChart = new Chart(ctx, {
|
|
type: 'doughnut',
|
|
data: {
|
|
labels: ['Male', 'Female'],
|
|
datasets: [{
|
|
label: 'Gender Distribution',
|
|
data: [<?php echo $countM; ?>, <?php echo $countF; ?>],
|
|
backgroundColor: [
|
|
'rgba(255, 99, 132, 0.2)',
|
|
'rgba(54, 162, 235, 0.2)',
|
|
'rgba(255, 206, 86, 0.2)',
|
|
'rgba(75, 192, 192, 0.2)'
|
|
],
|
|
borderColor: [
|
|
'rgba(255, 99, 132, 1)',
|
|
'rgba(54, 162, 235, 1)',
|
|
'rgba(255, 206, 86, 1)',
|
|
'rgba(75, 192, 192, 1)'
|
|
],
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
<br><br>
|
|
<table class="table table-bordered">
|
|
<tr>
|
|
<th colspan="2" style="background-color: #ABEBC6;">
|
|
<h3>
|
|
|
|
Age Distribution
|
|
</h3>
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<th>Age</th>
|
|
<th>Count</th>
|
|
</tr>
|
|
<tr>
|
|
<td>18 To 30</td>
|
|
<td><?php echo $Age18to30; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>31 To 40</td>
|
|
<td><?php echo $Age31to40; ?></td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td>41 To 50</td>
|
|
<td><?php echo $Age41to50; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>51 Above</td>
|
|
<td><?php echo $Age51toAbove; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Total</td>
|
|
<td><?php echo $TotalAge = $Age18to30 + $Age31to40 + $Age41to50 + $Age51toAbove; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
Average age
|
|
</td>
|
|
<td><?php
|
|
$Age18to30MidPoint = (18 + 30) / 2;
|
|
$Age31to40MidPoint = (31 + 40) / 2;
|
|
$Age41to50MidPoint = (41 + 50) / 2;
|
|
$Age51toAboveMidPoint = (51 + 100) / 2;
|
|
|
|
$totalCountMultiplication18to30 = $Age18to30MidPoint * $Age18to30;
|
|
$totalCountMultiplication31to40 = $Age31to40MidPoint * $Age31to40;
|
|
$totalCountMultiplication41to50 = $Age41to50MidPoint * $Age41to50;
|
|
$totalCountMultiplication51toAbove = $Age51toAboveMidPoint * $Age51toAbove;
|
|
|
|
$GrandTotal = $totalCountMultiplication18to30 + $totalCountMultiplication31to40 + $totalCountMultiplication41to50 + $totalCountMultiplication51toAbove;
|
|
|
|
echo round($GrandTotal / $TotalAge); ?></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<canvas id="myChart" width="300" height="120"></canvas>
|
|
|
|
<script>
|
|
var ctx = document.getElementById('myChart').getContext('2d');
|
|
var myChart = new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: ['18-30', '31-40', '41-50', '51+'],
|
|
datasets: [{
|
|
label: 'Age Count',
|
|
data: [<?php echo $Age18to30 . ',' . $Age31to40 . ',' . $Age41to50 . ',' . $Age51toAbove; ?>],
|
|
backgroundColor: [
|
|
'rgba(255, 99, 132, 0.2)',
|
|
'rgba(54, 162, 235, 0.2)',
|
|
'rgba(255, 206, 86, 0.2)',
|
|
'rgba(75, 192, 192, 0.2)'
|
|
],
|
|
borderColor: [
|
|
'rgba(255, 99, 132, 1)',
|
|
'rgba(54, 162, 235, 1)',
|
|
'rgba(255, 206, 86, 1)',
|
|
'rgba(75, 192, 192, 1)'
|
|
],
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<h3 style="background-color: #ABEBC6; padding: 20px; text-align: center;font-size: 2.3rem;">
|
|
Man Power Distribution Across Department
|
|
</h3>
|
|
<div style="height: 1100px; overflow-y: scroll;">
|
|
<canvas id="manpowerChart" height=1100></canvas>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<script>
|
|
var ctx = document.getElementById('manpowerChart').getContext('2d');
|
|
var manpowerChart = new Chart(ctx, {
|
|
type: 'bar',
|
|
|
|
data: {
|
|
labels: [<?php foreach ($DepartmentId as $key => $value) {
|
|
echo '"' . $key . '",';
|
|
} ?>],
|
|
|
|
datasets: [{
|
|
label: 'Count of Employees',
|
|
data: [<?php foreach ($DepartmentId as $key => $value) {
|
|
echo $value . ',';
|
|
} ?>],
|
|
backgroundColor: ' #ABEBC6',
|
|
borderColor: '#ABEBC6',
|
|
borderWidth: 1,
|
|
|
|
|
|
}]
|
|
},
|
|
|
|
options: {
|
|
indexAxis: 'y',
|
|
scales: {
|
|
x: {
|
|
beginAtZero: true
|
|
},
|
|
y: {
|
|
ticks: {
|
|
autoSkip: false,
|
|
},
|
|
beginAtZero: true
|
|
}
|
|
},
|
|
plugins: {
|
|
legend: {
|
|
position: 'bottom'
|
|
}
|
|
},
|
|
maintainAspectRatio: false,
|
|
}
|
|
|
|
});
|
|
</script>
|