<?php 
session_start();
$nomer=$polino=$dok=$tipe="";
$tipp="";
if( empty($_SESSION["dok"]) ){
$dok = $_POST["dok"];
$polino = $_POST['pol'];
//$tipe = $_POST['tipe'];
$_SESSION["dok"] = $dok;
$_SESSION["pol"] = $polino;
//$_SESSION["tipe"] = $tipe;
}
else {
	 $dok = $_SESSION["dok"];
 $polino = $_SESSION["pol"];
 //$tipe = $_SESSION["tipe"];
}

if( empty($_SESSION["nomer"])){
$_SESSION["nomer"] = "";
}
else {
	 $nomer = $_SESSION["nomer"];
}

if( empty($_SESSION["tipp"])){
$_SESSION["tipp"] = "";
}
else {
	 $tipp = $_SESSION["tipp"];
}

if( empty($_SESSION["tipe"])){
$_SESSION["tipe"] = "";
}
else {
	 $tipe = $_SESSION["tipe"];
}
//if( empty($_SESSION["dok"])){
//$_SESSION["dok"] = "";
//}
//else {
//	 $dok = $_SESSION["dok"];
//}
//if( empty($_SESSION["polino"])){
//$_SESSION["polino"] = "";
//}
//else {
//	 $polino = $_SESSION["polino"];
//}

//echo($al);
//echo($nm);
//include("cekVerif.php")
include('koneksi.php');
date_default_timezone_set('Asia/Jakarta');
//echo 'Indonesian Timezone: ' . date('d-m-Y H:i:s');

 ?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="style.css">
<meta charset="utf-8">
<title>Layar Utama Poli</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<?php include 'style.php' ?>
	<style>
table {
    border-collapse: collapse;
    border: 1px solid black;
}
</style>
<!-- Kode menampilkan peringatan untuk mengaktifkan javascript-->
<div align="center"><noscript>
   <div style="position:fixed; top:0px; left:0px; z-index:3000; height:100%; width:100%; background-color:#FFFFFF">
   <div style="font-family: Arial; font-size: 17px; background-color:#00bbf9; padding: 11pt;">Mohon aktifkan javascript pada browser untuk mengakses halaman ini!</div></div>
</noscript></div>
 
<!--Kode untuk mencegah seleksi teks, block teks dll.-->
<script type="text/javascript">
function disableSelection(e){if(typeof e.onselectstart!="undefined")e.onselectstart=function(){return false};else if(typeof e.style.MozUserSelect!="undefined")e.style.MozUserSelect="none";else e.onmousedown=function(){return false};e.style.cursor="default"}window.onload=function(){disableSelection(document.body)}
</script>
 
<!--Kode untuk mematikan fungsi klik kanan di blog-->
<script type="text/javascript">
function mousedwn(e){try{if(event.button==2||event.button==3)return false}catch(e){if(e.which==3)return false}}document.oncontextmenu=function(){return false};document.ondragstart=function(){return false};document.onmousedown=mousedwn
</script>
 
<style type="text/css">
* : (input, textarea) {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
 
}
</style>
<style type="text/css">
img {
     -webkit-touch-callout: none;
     -webkit-user-select: none;
    }
</style>
 
<!--Kode untuk mencegah shorcut keyboard, view source dll.-->
<script type="text/javascript">
window.addEventListener("keydown",function(e){if(e.ctrlKey&&(e.which==65||e.which==66||e.which==67||e.which==73||e.which==80||e.which==83||e.which==85||e.which==86)){e.preventDefault()}});document.keypress=function(e){if(e.ctrlKey&&(e.which==65||e.which==66||e.which==67||e.which==73||e.which==80||e.which==83||e.which==85||e.which==86)){}return false}
</script>
<script type="text/javascript">
document.onkeydown=function(e){e=e||window.event;if(e.keyCode==123||e.keyCode==18){return false}}
</script>
</head>
<script src="jquery-3.3.1.js" type="text/javascript"></script>
<script src="jquery-ui.js" type="text/javascript"></script>
<link href="jquery-ui.css" rel="stylesheet" type="text/css">
<script src="jquery.chained.min.js"></script>
       
<form name=formVerif action="ulang.php" method="post">
	
	<h3>
	Dokter : 
      <?php 
	  $sql2="select name from doctor where doctcode = '".$dok."'";
$result2 = sqlsrv_query($koneksi, $sql2);
$r2=sqlsrv_fetch_array($result2);
	$_SESSION["dokname"] = $r2['name'];
	  echo $r2['name'];
?>
<br><br>
	
	
	
Poli Nomor : <?php 
	  echo $polino;
?>
</h3>
	
	
	Nomor Antrian : <select name="nomorr" id="nomorr" class="form-control" required/>
		<!--<option value=""></option>-->
		<option value='<?php echo $nomer?>' selected='selected'><?php echo $nomer?></option>
	<?php 
	//$tgl = date('mm/dd/YYYY');
	$tgl=date('m/d/Y');
	$sql = "select distinct '' as panggil, isnull(nomor, '') as nomor, 
				'' as datang, SUBSTRING(nomor, 2, 1) as ini, SUBSTRING(nomor, 3, 1) as separator, 
				cast(cast(right(nomor, 3) as int) as varchar(50)) as nom, case when isnull(tglselesai, '1/1/1900') = '1/1/1900' then '' else ' Selesai' end as Selesai
				
from ANTRIAN_DOKTER
where doctcode = '".$dok."' 
and cast(cast(month(tgl) as varchar(2)) + '/' + 
	cast(day(tgl) as varchar(2)) + '/'+ 
	cast(year(tgl) as varchar(4)) as datetime) = dbo.condate('".$tgl."')
order by nomor asc";
$hasil = sqlsrv_query($koneksi, $sql);
while($data=sqlsrv_fetch_array($hasil)){
	//echo "<script>document.getElementById(uu).innerHTML = document.getElementById(poli).value;
    ?>
		
                    <option id="nomorr" class="<?php echo $data['tipeN']; ?>" value="<?php echo $data['nomor']; ?>">
                        <?php echo $data['nomor'] . $data['Selesai']; ?>
                    </option>
                <?php
                }
                ?>
    </select>
	
	<br>
	
	<h1 align=center >
	<?php
	echo strtoupper($nomer);
	?>
	</h1>
	 <script>
            $("#nomorr").chained("#tipeN");
            //$("#kecamatan").chained("#kota");
        </script>
	<br><br>
	<!--
	  <input type="button" class="btn btn-block btn-primary btn-lg" name="button1" onClick="location='ulang.php'" value="Panggil"/> 
<br><br>
-->
	  <input type="Submit" class="btn btn-block btn-primary btn-lg" name="Submit" value="Panggil"/> 
	  <br><br>
	 <input type="button" class="btn btn-block btn-primary btn-lg" name="button3" onClick="location='updselesai.php'" value="Selesai Diperiksa Dokter"/> 
	  <br><br>
	  <input type="button" class="btn btn-block btn-primary btn-lg" name="button2" onClick="location='index.php'" value="Menu"/> 
	 <br><br>
	 
	 </form>
	         
	<footer>
                 <p align=center>&copy; 2024 - RSI Purwodadi</p>
            </footer>
</html>