Files
simrs-jatim/ranap/save_perjalanan_penyakit.php
2024-04-19 14:04:41 +07:00

89 lines
3.1 KiB
PHP

<?php
if(!session_id()) {
session_start();
include '../core/main.php';
include _DOCROOT_.'include/function.php';
}
?>
<?php
if(!empty($_GET['opt'])){
if($_GET['opt']=="del"){
execute("delete from t_pp where idxpp =".$_GET['idxpp']);
}
}
if(!empty($_POST['id_admission'])) {
$id_admission = $_POST['id_admission'];
}else {
$id_admission = $_GET['id_admission'];
}
if(isset($_POST['konsultasi'])) {
if(empty($_POST['konsultasi'])) {
echo "<div style='border:1px solid #DF7; width:95%; padding:5px; margin:5px; color:#F30; background-color:#FFF;' align='left'>";
echo "Isian Belum Lengkap<br>";
if($_POST['konsultasi']=="") {
echo"- Form Konsultasi Belum Diisi<br>";
}
echo "</div>";
}else {
$nomr = $_POST['nomr'];
$noruang = $_POST['noruang'];
$date=date("d/m/Y");
execute("INSERT INTO t_pp(IDXRANAP,NOMR,IDXKDRUANGRANAP,TANGGAL,KONSULTASI,NIP) VALUES($id_admission,'$nomr','$noruang',NOW(),'{$_POST['konsultasi']}','{$_SESSION['NIP']}')");
echo "<div class='alert alert-success' role='alert'>Input Data Sukses!</strong></div>";
}
}
?>
<div id="valid">
<div id="head_report" style="display:none" align="center">
<div align="center" style="clear:both; padding:20px">
<div style="letter-spacing:-1px; font-size:16px; font:bold;"><?=strtoupper($header1)?></div>
<div style="letter-spacing:-2px; font-size:24px; color:#666; font:bold;"><?=strtoupper($header2)?></div>
<div><?=$header3?><br /><?=$header4?></div>
<hr style="margin:5px;" />
</div>
</div>
<table width="95%" style="margin:10px;" border="0" class="table table-hover table-bordered table-striped table-sm" cellspacing="1" cellspading="1">
<tr align="center" class="bg-success text-light">
<th width="11%">Tanggal / Jam</th>
<th width="40%">Konsultasi</th>
<th width="13%">NIP</th>
<th width="5%">Aksi</th>
</tr>
<?php
// view data
$sql = "SELECT * FROM t_pp WHERE IDXRANAP = '".$id_admission."' ORDER BY IDXPP DESC LIMIT 10";
$qry = $db->query($sql);
$count = 0;
if($qry->numRows() > 0){
foreach($qry->fetchAll() as $data) {
?>
<tr <?php echo "class =";
$count++;
if ($count % 2) {
echo "tr1";
}
else {
echo "tr2";
}
?>>
<td><?=$data['TANGGAL'];?></td>
<td><?=$data['KONSULTASI'];?></td>
<td><?=$data['NIP'];?></td>
<td>
<a href="#" onclick="javascript: MyAjaxRequest('valid_perjalanan_penyakit','ranap/save_perjalanan_penyakit.php?idxpp=<?=$data['IDXPP']?>&amp;id_admission=<?=$data['IDXRANAP']?>&amp;opt=del'); return false;" ><input type="button" class="btn btn-outline-primary text" value="Batal"/></a></td>
</tr>
<?php
}
} ?>
</table>
</div>
<input type="button" class="btn btn-success text" value="PRINT" onclick="printIt()" />