103 lines
3.8 KiB
PHP
103 lines
3.8 KiB
PHP
<!DOCTYPE html>
|
|
<?php
|
|
date_default_timezone_set('Asia/Jakarta'); //Menyesuaikan waktu dengan tempat kita tinggal
|
|
$tanggal = DATE('d-M-Y');
|
|
$jam = Date('H:i');
|
|
header("Content-Type: application/vnd-ms-excel");
|
|
header("Content-Disposition: attachment; filename=pelaporan_insiden_knc_$tanggal-jam_$jam.xls");
|
|
header("Pragma: no-cache");
|
|
header("Expires: 0");
|
|
include "../model/koneksi.php";
|
|
|
|
$awal = date('Y-m-d H:i:s', strtotime($_GET['awal']));
|
|
$akhir = date('Y-m-d H:i:s', strtotime($_GET['akhir']));
|
|
|
|
?>
|
|
<html>
|
|
|
|
<head>
|
|
<title></title>
|
|
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" />
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
|
$tanggal = DATE('d-M-Y');
|
|
$jam = Date('H:i');
|
|
?>
|
|
<table class='table table-striped table-bordered ' width='100%' cellspacing='0' style='font-size: 12px;' border="1">
|
|
<thead>
|
|
|
|
<div style='font-size:12pt; font-weight:bold;'>
|
|
<center>
|
|
PELAPORAN INSIDEN knc
|
|
<p>periode <?= $awal; ?> -s/d- <?= $akhir; ?></p>
|
|
</center>
|
|
</div>
|
|
<tr style="background-color: cadetblue; align-content:center;">
|
|
<th style='width:1%'>No</th>
|
|
<th style='width:15%'>Tanggal masuk</th>
|
|
<th style='width:15%'>Register</th>
|
|
<th style='width:1%'>Num</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$query = "SELECT * FROM tb_indikator_mutu WHERE tanggal BETWEEN '$awal' AND '$akhir'";
|
|
$query_insiden = mysqli_query($openinmut, "$query AND insiden=1 AND keterangan='knc'");
|
|
$no = 0;
|
|
while ($data = mysqli_fetch_assoc($query_insiden)) {
|
|
$no++;
|
|
echo "<tr class='table table-striped table-bordered' style='font-size:10pt; font-weight:bold;'>";
|
|
echo " <td>$no</td>";
|
|
echo " <td>" . date('d-m-Y H:i', strtotime($data['tanggal'])) . "</td>";
|
|
echo " <td>$data[register]</td>";
|
|
echo " <td>$data[insiden]</td>";
|
|
|
|
echo " </tr>";
|
|
?>
|
|
|
|
<?php } ?>
|
|
</tbody>
|
|
</table><br>
|
|
<table class='table table-striped table-bordered table-hover datatable' width='100%' cellspacing='0' style='font-size: 12px;' border="1" align="center">
|
|
<thead>
|
|
<tr>
|
|
<th style='width:1%'>Numerator</th>
|
|
<th style='width:1%'>Denumerator</th>
|
|
<th style='width:15%'>Percentage</th>
|
|
<th style='width:5%'>Target</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<div>
|
|
<?php
|
|
$num_insiden = mysqli_num_rows(mysqli_query($openinmut, "$query AND insiden=1 AND keterangan='knc'"));
|
|
$denum_insiden = mysqli_num_rows(mysqli_query($openinmut, "SELECT * FROM tb_indikator_mutu WHERE tanggal BETWEEN '$awal' AND '$akhir' AND insiden_ctrl=1 AND keterangan='knc'"));
|
|
|
|
echo "<tr class='table table-striped table-bordered' style='font-size:10pt; font-weight:bold;' align='center'>";
|
|
echo " <td>$num_insiden</td>";
|
|
echo " <td>$denum_insiden</td>";
|
|
if ($denum_insiden > 0) {
|
|
$per_insiden = number_format((($num_insiden / $denum_insiden) * 100), 2);
|
|
echo " <td>$per_insiden %</td>";
|
|
} else {
|
|
echo " <td>-</td>";
|
|
}
|
|
echo " <td>100 %</td>";
|
|
echo " </tr>";
|
|
?>
|
|
</div>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php
|
|
//tutup koneksi
|
|
mysqli_close($openinmut);
|
|
|
|
?>
|
|
</body>
|
|
|
|
</html>
|