- CodeIgniter 4 framework setup with SQL Server database config - Models: Control, Test, Dept, Result, Daily/ Monthly entry models - Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints - Views: CRUD pages with modal dialogs, dashboard, reports - Database: Migrations for control test and daily/monthly result tables - Legacy v1 PHP application preserved in /v1 directory - Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
204 lines
6.8 KiB
PHP
204 lines
6.8 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
<?php
|
|
require("../config.php");
|
|
$dates = $_POST['dates'];
|
|
$lastday = date("t", strtotime($dates));
|
|
$testid = $_POST['test'];
|
|
$sql = "select cva, ba, tea, name, method, unit from DICT_TEST where id='$testid'";
|
|
$stmt = sqlsrv_query( $conn1, $sql );
|
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC );
|
|
$cva = $row[0];
|
|
$ba = $row[1];
|
|
$tea = $row[2];
|
|
$testname = $row[3];
|
|
$method = $row[4];
|
|
$unit = $row[5];
|
|
## Control 1
|
|
$data1 = getData($control1, $dates, $testid, $lastday);
|
|
$data2 = getData($control2, $dates, $testid, $lastday);
|
|
$data3 = getData($control3, $dates, $testid, $lastday);
|
|
$length = count($data1['result']);
|
|
$length_2 = count($data2['result']);
|
|
$length_3 = count($data3['result']);
|
|
if($length_2 > $length) { $length = $length_2; }
|
|
if($length_3 > $length) { $length = $length_3; }
|
|
// repair jumping control
|
|
$key1 = array_keys($data1['resultx']);
|
|
$key2 = array_keys($data2['resultx']);
|
|
$key3 = array_keys($data3['resultx']);
|
|
$keys = array_merge($key1,$key2,$key3);
|
|
$keys = array_unique($keys);
|
|
asort($keys);
|
|
/*
|
|
echo "<pre>";
|
|
print_r($data1['resultx']);
|
|
print_r($data2['resultx']);
|
|
print_r($keys);
|
|
echo "</pre>";
|
|
*/
|
|
?>
|
|
<head>
|
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
|
<link rel='stylesheet' href='../assets/normalize.min.css' />
|
|
<link rel='stylesheet' href='../assets/style_report.css' />
|
|
<script src="../assets/Chart.min.js"></script>
|
|
<style>
|
|
#title { text-align:center; }
|
|
#title, #info, #result, #footer, #resultdata { margin-bottom:0.5cm; }
|
|
#footer {width : 100%;}
|
|
</style>
|
|
</head>
|
|
<body style='-webkit-print-color-adjust: exact;'>
|
|
<div id='page'>
|
|
<div id='title'>
|
|
<h3><b>QC Internal</b></h3>
|
|
<h3>Kimia Klinik</h3>
|
|
<h5>TRISENSA DIAGNOSTIC CENTRE</h5>
|
|
</div>
|
|
|
|
<div id='info'>
|
|
<table>
|
|
<tr>
|
|
<th>INSTITUTION</th> <td>Laboratorium Gleneagles</td>
|
|
<th>Instrument</th> <td colspan='3'>TMS 50i</td>
|
|
</tr>
|
|
<tr>
|
|
<th>TEST NAME</th> <td><?=$testname;?></td>
|
|
<th>Control</th> <td colspan='3'>C 1 :<?=$data1['name'];?> / C 2 : <?=$data2['name'];?> / C 3 : <?=$data3['name'];?> </td>
|
|
</tr>
|
|
<tr>
|
|
<th>REAGENT</th> <td> </td>
|
|
<th>Lot No.</th> <td colspan='3'>Lot 1 : <?=$data1['lot'];?> / Lot 2 : <?=$data2['lot'];?> / Lot 3 : <?=$data3['lot'];?></td>
|
|
</tr>
|
|
<tr>
|
|
<th>METHOD</th> <td><?=$method;?></td>
|
|
<th>VALUES</th> <td>-2S</td> <td>TARGET</td> <td>+2S</td>
|
|
</tr>
|
|
<tr>
|
|
<th>UNIT</th> <td><?=$unit;?></td>
|
|
<th>VALUES</th>
|
|
<td style='text-align:center;'><?=$data1['-2s'];?></td> <td style='text-align:center;'><?=$data1['mean'];?></td> <td style='text-align:center;'><?=$data1['+2s'];?></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td> <td></td>
|
|
<th></th>
|
|
<td style='text-align:center;'><?=$data2['-2s'];?></td> <td style='text-align:center;'><?=$data2['mean'];?></td> <td style='text-align:center;'><?=$data2['+2s'];?></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td> <td></td>
|
|
<th></th>
|
|
<td style='text-align:center;'><?=$data3['-2s'];?></td> <td style='text-align:center;'><?=$data3['mean'];?></td> <td style='text-align:center;'><?=$data3['+2s'];?></td>
|
|
</tr>
|
|
<tr>
|
|
<th>PERIODE</th> <td colspan='5'><?=$dates;?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div id='resultdata'>
|
|
<table>
|
|
<tr>
|
|
<th>Tanggal</th> <th>Hasil 1</th> <th>Hasil 2</th> <th>Hasil 3</th>
|
|
</tr>
|
|
<?php
|
|
for($i = 1 ; $i<=$lastday; $i++) {
|
|
if( isset($data1['result'][$i]) ) {
|
|
if( is_numeric($data1['result'][$i]) ) { $res1 = number_format($data1['result'][$i],3); }
|
|
} else { $res1 = ''; }
|
|
if( isset($data2['result'][$i]) ) {
|
|
if( is_numeric($data2['result'][$i]) ) { $res2 = number_format($data2['result'][$i],3); }
|
|
} else { $res2 = ''; }
|
|
if( isset($data3['result'][$i]) ) {
|
|
if( is_numeric($data3['result'][$i]) ) { $res3 = number_format($data3['result'][$i],3); }
|
|
} else { $res3 = ''; }
|
|
if( $res1 != '' || $res2 !='' || $res3!='' ) { echo "<tr> <td style='text-align:center'>$i</td> <td>$res1</td> <td>$res2</td> <td>$res3</td> </tr>"; }
|
|
}
|
|
?>
|
|
</table>
|
|
</div>
|
|
|
|
<div id='resultimg'>
|
|
<canvas id="myChart"></canvas>
|
|
</div>
|
|
|
|
<div id='footer'>
|
|
<table>
|
|
<tr> <th colspan='4'>QC 1 PERFORMANCE</th> <th colspan='4'>QC 2 PERFORMANCE</th> </tr>
|
|
<tr>
|
|
<td>MEAN</td> <td><?=$data1['means'];?></td> <td>SD</td> <td><?=$data1['sds'];?></td>
|
|
<td>MEAN</td> <td><?=$data2['means'];?></td> <td>SD</td> <td><?=$data2['sds'];?></td>
|
|
<td>MEAN</td> <td><?=$data3['means'];?></td> <td>SD</td> <td><?=$data3['sds'];?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>CV %</td> <td><?=$data1['cv'];?></td> <td>CV <sub>A</sub></td> <td><?=$cva;?></td>
|
|
<td>CV %</td> <td><?=$data2['cv'];?></td> <td>CV <sub>A</sub></td> <td><?=$cva;?></td>
|
|
<td>CV %</td> <td><?=$data3['cv'];?></td> <td>CV <sub>A</sub></td> <td><?=$cva;?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>BIAS %</td> <td><?=$data1['bias'];?></td> <td>B<sub>A</sub> %</td> <td><?=$ba;?></td>
|
|
<td>BIAS %</td> <td><?=$data2['bias'];?></td> <td>B<sub>A</sub> %</td> <td><?=$ba;?></td>
|
|
<td>BIAS %</td> <td><?=$data3['bias'];?></td> <td>B<sub>A</sub> %</td> <td><?=$ba;?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>TE %</td> <td><?=$data1['te'];?></td> <td>TE<sub>A</sub></td> <td><?=$tea;?></td>
|
|
<td>TE %</td> <td><?=$data2['te'];?></td> <td>TE<sub>A</sub></td> <td><?=$tea;?></td>
|
|
<td>TE %</td> <td><?=$data3['te'];?></td> <td>TE<sub>A</sub></td> <td><?=$tea;?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
const ctx = document.getElementById('myChart');
|
|
ctx.height = 700;
|
|
const labels = [ <?php for ($i=1; $i<=$length; $i ++) { echo "$i,"; } ?> ];
|
|
const data = {
|
|
labels: labels,
|
|
datasets: [{
|
|
axis: 'y', label: 'QC1', fill: false, backgroundColor: 'rgba(0, 0, 255, 0.5)', borderColor: 'rgb(0, 0, 255)', borderWidth: 1,
|
|
data: [
|
|
<?php
|
|
$res1 = '';
|
|
//foreach($data1['resultx'] as $res) {
|
|
foreach($keys as $key) {
|
|
if(isset($data1['resultx'][$key])) {
|
|
$res = $data1['resultx'][$key];
|
|
$res1 .= number_format($res,3).',';
|
|
} else { $res1 .= 'null,'; }
|
|
}
|
|
$res1 = rtrim($res1,',');
|
|
echo "$res1";
|
|
?>
|
|
]}, {
|
|
axis: 'y', label: 'QC2', fill: false, backgroundColor: 'rgba(0, 0, 0, 0.5)', borderColor: 'rgb(0, 0, 0)', borderWidth: 1,
|
|
data: [
|
|
<?php
|
|
$res1 = '';
|
|
//foreach($data2['resultx'] as $res) {
|
|
foreach($keys as $key) {
|
|
if(isset($data2['resultx'][$key])) {
|
|
$res = $data2['resultx'][$key];
|
|
$res1 .= number_format($res,3).',';
|
|
} else { $res1 .= 'null,'; }
|
|
}
|
|
$res1 = rtrim($res1,',');
|
|
echo "$res1";
|
|
?>
|
|
]}
|
|
]
|
|
};
|
|
const config = {
|
|
type: 'line',
|
|
data: data,
|
|
options: {
|
|
indexAxis: 'y',
|
|
scales: {
|
|
xAxis : { min:-4, max:4 }
|
|
},
|
|
},
|
|
};
|
|
const myChart = new Chart(ctx, config);
|
|
</script>
|
|
</html>
|