<script type="text/javascript">
var xmlHttp;
function showUp1(str){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Browser tidak support HTTP Request");
return;
}
var url="getUp1.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=SC1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function SC1() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("txt1").innerHTML=xmlHttp.responseText ;
}
}
function showUp2(str1){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Browser tidak support HTTP Request");
return;
}
//var str2= document.getElementById("poliklinik").value;
var str2= findSelection("poliklinik");
alert(str1+"#"+str2);
var url="getUp2.php";
url=url+"?t="+str1+"&p="+str2;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=SC2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function SC2() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("txt2").innerHTML=xmlHttp.responseText ;
}
}
function findSelection(field) {
var test = document.myForm.poliklinik;
var sizes = test;
for (i=0; i < sizes.length; i++) {
if (sizes[i].checked==true) {
return sizes[i].value;
}
}
}
function showUp3(str){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Browser tidak support HTTP Request");
return;
}
var url="getUp3.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=SC3;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function SC3() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("txt3").innerHTML=xmlHttp.responseText ;
}
}
function GetXmlHttpObject(){
var xmlHttp=null;
try{xmlHttp=new XMLHttpRequest();}
catch (e){
try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
}
return xmlHttp;
}
</script>
****************************
<form action="" name="myForm" method="post" enctype="multipart/form-data">
<input type="text" name="nomor_rm" id="nomor_rm" value="" placeholder="Nomor Rekammendis" title="Nomor Rekammendis" onChange="showUp1(this.value)">
++++++++++++++++++++++++++++++++++
<input type="radio" name="poliklinik" id="poliklinik" checked="checked" value="POLI UMUM"/>POLI UMUM
<input type="radio" name="poliklinik" id="poliklinik" value="POLI GIGI" />POLI GIGI
<input type="date" name="tanggal_kunjungan" class="form-control form-control-user" id="tanggal_kunjungan" value="" placeholder="Tanggal Kunjungan" title="Tanggal Kunjungan" onChange="showUp2(this.value)">
</form>
getUp1.php
<?php
require_once"konmysqli.php";
$nomor_rm=$_GET["q"];
if(strlen($nomor_rm)>5){
$sql="select * from `$tbpasien` where `nomor_rm`='$nomor_rm'";
$d=getFieldM($conn,$sql);
$id_pasien=$d["id_pasien"];
$nama_pasien=$d["nama_pasien"];
$no_identitas=$d["no_identitas"];
$tanggal_lahir=$d["tanggal_lahir"];
$jenis_kelamin=$d["jenis_kelamin"];
$alamat=$d["alamat"];
$email=$d["email"];
$telepon=$d["telepon"];
$username=$d["username"];
$password=$d["password"];
$nomor_rm=$d["nomor_rm"];
$asuransi=$d["asuransi"];
$awal = date_create($tanggal_lahir);
$akhir = date_create();
$diff = date_diff( $awal, $akhir );
$usia=$diff->y ;
echo "<b>$nama_pasien (NIK $no_identitas)</b><br>Alamat: $alamat, Telp $telepon |$jenis_kelamin #$usia Thn";
}
?>
###############################
getUp2.php
<?php
require_once"konmysqli.php";
$tanggal=$_GET["t"];
$poliklinik=$_GET["p"];
$id_jadwal="";
$hr=date('l', strtotime($tanggal));
$hari="Minggu";
if($hr=="Sunday"){$hari="Minggu";}
else if($hr=="Monday"){$hari="Senin";}
else if($hr=="Tuesday"){$hari="Selasa";}
else if($hr=="Wednesday"){$hari="Rabu";}
else if($hr=="Thrusday"){$hari="Kamus";}
else if($hr=="Friday"){$hari="Jumat";}
else if($hr=="Saturday"){$hari="Sabtu";}
?>
<select class="form-control" name="id_jadwal" onChange="showUp3(this.value)">
<option disabled>Pilih Jadwal <?php echo $poliklinik;?> + <?php echo $hari;?></option>
<?php
$s="select * from `tb_jadwal` where `poliklinik`='$poliklinik' and `hari`='$hari' order by `jam` asc";
$q=getDataM($conn,$s);
foreach($q as $d){
$id_jadwal0=$d["id_jadwal"];
$jam=$d["jam"];
$poliklinik=$d["poliklinik"];
$hari=$d["hari"];
$dokter=$d["dokter"];
echo"<option value='$id_jadwal0' ";if($id_jadwal0==$id_jadwal){echo"selected";} echo">$poliklinik $dokter |$hari $jam </option>";
}
?>
</select>
######################################
getUp3.php
<?php
require_once"konmysqli.php";
$id_jadwal=$_GET["q"];
$tanggal_kunjungan=$_GET["t"];
$tgl=WKTM($tanggal_kunjungan);
$sql="select `nomor_antrian` from `$tbkunjungan` where `id_jadwal`='$id_jadwal' and `tanggal_kunjungan`='$tanggal_kunjungan' order by `id_kunjungan` desc";
$ada=getJumM($conn,$sql);
if($ada>0){
$d=getFieldM($conn,$sql);
$nomor_antrian=$d["nomor_antrian"]+1;
}
else{
$nomor_antrian=1;
}
echo "<b><i>Nomor Antrian Anda Untuk $tgl : </i><h2><font color='blue'>No. $nomor_antrian</font></h2></b>";
?>