<?php
    include('loginsession.php');
    error_reporting(E_ALL);
    $filename = __FILE__;  //---Nama file saat ini
    if (strlen(__FILE__) > 48) {$filename = substr(__FILE__, 48);}
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filename')");
//-------------
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//ID" "http://www.w3.org/TR/html4/frameset.dtd">
<html lang="id">
<head>
    <title>DETAIL PASIEN</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/style.css">
	<link href="images/balance.ico" rel="icon" type="image/icon" />
	<style>
		a { text-decoration: none; color:inherit;}
		a:hover {color:#FF00FF;}   /* Mouse over link */
		
    </style>	
</head>

<body>

<?php
//ambil data berdasarkan parameter GET id
$b = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM novia_abc_biodata where id='$_GET[id]'"));

//Script Umur
$sa = date("Y");
$si = $b['birthday'];
$dti = new DateTime($si);
$currdate_ = $dti->format('Y');
$umur = $sa-$currdate_;
if ($umur > 150) $umur1 = "";
if ($umur < 150) $umur1 = " (".$umur.")";
//--------

?>

	<table width="100%" max-width="600px" cellpadding="5" align="center">
		<tbody>
			<tr class="dua">
				<td width="14%"><a href="biodata.php?id=<?php echo $b["id"]-1;?>" title="Lihat pasien dengan MR yang lebih kecil"><button style="padding : 10px; width:100%"> < </button></a></td>
				<td width="21%"><a href="status-view.php?id=<?php echo $b["id"];?>" title="Dartar untuk berobat hari ini"><button style="padding : 10px; width:100%">STATUS</button></a></td>
				<td width="30%"><a href="index.php?id=<?php echo $b["id"];?>" title="Kembali ke halaman awal"><button style="padding : 10px; width:100%">HOME</button></a></td>
				<td width="21%"><a href="daftar-sekarang.php?id=<?php echo $b["id"];?>" title="Dartar untuk berobat hari ini"><button style="padding : 10px; width:100%">DAFTAR SEKARANG</button></a></td>
				<td width="14%"><a href="biodata.php?id=<?php echo $b["id"]+1;?>" title="Lihat pasien dengan MR yang lebih besar"><button style="padding : 10px; width:100%"> > </button></a></td>
			</tr>
		</tbody>
	</table>
	
<table width="100%" max-width="600px" cellpadding="5" align="center">
    <tr class="satu">
		<td colspan="3" style='text-transform:uppercase' align="center">
			<h1><?php echo "Biodata - ".$b['mr']; ?> - <?php echo $b['name'].$umur1;?></h1>
		</td>
	</tr>
    <tr class="head" align="left">
		<th width="150">Parameter</th>
        <th>Biodata Pasien</th>
    </tr>
    <tr class="satu"><td colspan="3"></td></tr>
    <tr class="dua">
        <td width="130">MR</td>
        
        <td><?php echo $b['mr']; ?>   </td>
    </tr>
    <tr class="satu">
        <td>Nama</td>
        <td><?php echo $b['name'];?></td>
    </tr>
    <tr class="dua">
        <td>Handphone</td>
		<td><a href="https://wa.me/<?php echo $b["phone_wa"]; ?>"><?php echo $b["phone_wa"]; ?></a></td>
		
    </tr>
    <tr class="satu">
        <td>Telepon Lainnya</td>
        <td><?php echo $b['phone_home'];?></td>
    </tr>
    <tr class="dua">
        <td>Alamat</td>
        <td><?php echo $b['street_address'];?></td>
    </tr>
    <tr class="satu">
        <td>Kelurahan</td>
        
        <td><?php echo $b['kelurahan'];?></td>
    </tr>
    <tr class="dua">
        <td>Kecamatan</td>
        
        <td><?php echo $b['kecamatan'];?></td>
    </tr>
    <tr class="satu">
        <td>Kota</td>
        
        <td><?php echo $b['city'];?></td>
    </tr>
    <tr class="dua">
        <td>Provinsi</td>
        
        <td><?php echo $b['state'];?></td>
    </tr>
    <tr class="satu">
        <td>Kode Pos</td>
        
        <td><?php echo $b['kode_pos'];?></td>
    </tr>
    <tr class="dua">
        <td>Email</td>
        
        <td><?php echo $b['email'];?></td>
    </tr>
    <tr class="satu">
        <td>Pertama Datang</td>
        
        <td><?php echo $b['firstcome'];?></td>
    </tr>
    
    <tr class="satu">
        <td>Terakhir Datang</td>
        
        <td><?php echo $b['lastcome'];?></td>
    </tr>
    
    <tr class="dua">
        <td>Tanggal Lahir</td>
        
        <td><?php echo $b['birthday'];?></td>
    </tr>
    <tr class="satu">
        <td>Tinggi Badan</td>
        
        <td><?php echo $b['height'];?></td>
    </tr>
	
    <tr class="dua">
        <td>Kunjungan Tahun 2020</td>
        
        <td><?php echo $b['freq']." kali";?></td>
    </tr>
    <tr class="satu">
        <td>Catatan</td>
        
        <td><?php echo $b['note'];?></td>
    </tr>
</table>

	<table width="100%" max-width="600px" cellpadding="5" align="center">
		<tbody>
			<tr class="dua">
				<td width="14%"><a href="biodata.php?id=<?php echo $b["id"]-1;?>" title="Lihat pasien dengan MR yang lebih kecil"><button style="padding : 10px; width:100%"> < </button></a></td>
				<td width="21%"><a href="status-print.php?id=<?php echo $b["id"];?>" title="Print Status Pasien"><button style="padding : 10px; width:100%">PRINT STATUS</button></a></td>
				<td width="21%"><a href="biodata_edit.php?id=<?php echo $b["id"];?>" title="Edit data pasien"><button style="padding : 10px; width:100%">EDIT</button></a></td>
				<td width="14%"><a href="biodata.php?id=<?php echo $b["id"]+1;?>" title="Lihat pasien dengan MR yang lebih besar"><button style="padding : 10px; width:100%"> > </button></a></td>
			</tr>
		</tbody>
	</table>


</body>
</html>