<?php
session_start();
date_default_timezone_set('Asia/Jakarta');
//$nm=$_SESSION["Patname"];
include('koneksi.php');
//$patVoc="";

$dok=$pol=$tipe="";
//$tipe = $_POST['tipeN'];
//$dok=$_POST['dok'];
$dok=$_SESSION["dok"];
//$pol=$_POST['pol'];
$pol=$_SESSION["pol"];
//$nom=$_SESSION["nomor"];
$nom=$_SESSION['nomer'];
$tgl=date('m/d/Y');
$tgljam=date("Y-m-d H:i:s");
$upd="update antrian_dokter
		set TglSelesai = '".$tgljam."'
		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) = '".$tgl."'
and nomor =  '".$nom."'";
$stmt1 = sqlsrv_query( $koneksi, $upd);  

if ($stmt=== false) {  
   //echo "<script>window.history.back()</script>";
   echo "Row insertion failed.\n";  
    die(print_r(sqlsrv_errors(), true));  
} else {  
    //echo "Row insertion failed.\n";  
    //die(print_r(sqlsrv_errors(), true));  
	//echo "<script>window.history.back()</script>";
echo("<script>location='utama.php'</script>");
} 
sqlsrv_free_stmt($stmt);  
sqlsrv_free_stmt($stmt1);  
sqlsrv_close($koneksi);  


?>