tinyqc/v1/inc/report_1c.php
mahdahar ff90e0eb29 Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- 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
2026-01-14 16:49:27 +07:00

145 lines
3.7 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];
$data = getData($control1, $dates, $testid, $lastday);
$length = count($data['result']);
?>
<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 Name</th> <td colspan='3'><?=$data['name'];?> </td>
</tr>
<tr>
<th>REAGENT</th> <td> </td>
<th>Lot No.</th> <td colspan='3'><?=$data['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>
<td></td> <td style='text-align:center;'><?=$data['-2s'];?></td> <td style='text-align:center;'><?=$data['mean'];?></td> <td style='text-align:center;'><?=$data['+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</th>
</tr>
<?php
$i = 1;
foreach($data['result'] as $day => $res) {
if( is_numeric($res) ) { $res = number_format($res,3); }
echo "<tr> <td style='text-align:center;'>$day</td> <td>$res</td> </tr>";
}
?>
</table>
</div>
<div id='resultimg'>
<canvas id="myChart"></canvas>
</div>
<div id='footer'>
<table>
<tr> <th colspan='4'>QC PERFORMANCE</th> </tr>
<tr>
<td>MEAN</td> <td><?=$data['means'];?></td>
<td>SD</td> <td><?=$data['sds'];?></td>
</tr>
<tr>
<td>CV %</td> <td><?=$data['cv'];?></td>
<td>CV <sub>A</sub></td> <td><?=$cva;?></td>
</tr>
<tr>
<td>BIAS %</td> <td><?=$data['bias'];?></td>
<td>B<sub>A</sub> %</td> <td><?=$ba;?></td>
</tr>
<tr>
<td>TE %</td> <td><?=$data['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: 'Hasil QC',
data: [
<?php
foreach($data['resultx'] as $res) {
if($res != null) { $res = number_format($res,3); }
echo "$res, ";
}
?>
],
fill: false,
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgb(255, 99, 132)',
borderWidth: 1
}]
};
const config = {
type: 'line',
data: data,
options: {
indexAxis: 'y',
scales: {
xAxis : { min:-4, max:4 }
},
},
};
const myChart = new Chart(ctx, config);
</script>
</html>