<?php
include('dbConfig.php');
session_start();
if(isset($_SESSION['username']) && isset($_SESSION['name']))
{
    $username=$_SESSION['username'];
    $name=$_SESSION['name'];
}
else
{
     echo '<META http-equiv="refresh" content="0;logout.php">';
}


if(isset($_POST['Pname'])){
$Pname=$_POST['Pname'];
$fhname=$_POST['fhname'];
$contact1=$_POST['contact1'];
$contact2=$_POST['contact2'];
$email=$_POST['email'];
$dob=$_POST['dob'];
$age=$_POST['age'];
$gender=$_POST['Gender'];
$blood=$_POST['Blood'];
$wt=$_POST['Weight'];
$height=$_POST['Height'];
$Aadhaar=$_POST['Aadhaar'];
$Address=$_POST['Address'];
$Address.=", ".$_POST['City'];
$Address.=", ".$_POST['State'];
$Address.=", ".$_POST['Country'];
$Mark=$_POST['Mark'];
$CaseType=$_POST['CaseType'];
$Consultant=$_POST['Consultant'];
$PatientType=$_POST['PatientType'];
$WardType=$_POST['WardType'];
$AdmitDate=$_POST['AdmitDate'];
$AdmitTime=$_POST['AdmitTime'];
$AdvanceAmount=$_POST['AdvanceAmount'];  
$PaymentMode=$_POST['PaymentMode'];
$InsuranceName=$_POST['InsuranceName'];
$InsuranceNo=$_POST['InsuranceNo'];
$Photo=$_FILE['Photo'];
$fileName=$_FILES['Photo']['name'];
                        $fileTmpName=$_FILES['Photo']['tmp_name'];
                        $fileSize=$_FILES['Photo']['size'];
                        $fileError=$_FILES['Photo']['error'];
                        $fileType=$_FILES['Photo']['type'];

                        $fileExt=explode('.',$fileName);
                        $fileActualExt=strtolower(end($fileExt));
                        $allowed=array('jpg','jpeg','png','JPG','JPEG','PNG');

                        if(in_array($fileActualExt, $allowed))
                        {
                            if($fileError ===0){
                                if($fileSize<=3000000){
                                    $PfileNameNew=uniqid('',true).".".$fileActualExt;

    
                                    $fileDestination = 'assets/PatientPhotos/'.$PfileNameNew;
                                    move_uploaded_file($fileTmpName, $fileDestination);  
                                }
                                else{
                                    echo "Your File Size is large";
                                }

                            }else{
                                    echo "Error Uploading File";
                                }
                            
                        }





}
?>

<!DOCTYPE html>
<html>
<head>
  <title>
    
  </title>
  <meta charset="UTF-8">
  <link href="assets/img/favicon.png" rel="icon">
  <link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">
  <script src='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css'>
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'>
  <!-- Google Fonts -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:300,400,500,700,800|Montserrat:300,400,700" rel="stylesheet">
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'>
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css'>

  <!-- Vendor CSS Files -->
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/vendor/ionicons/css/ionicons.min.css" rel="stylesheet">
  <link href="assets/vendor/animate.css/animate.min.css" rel="stylesheet">
  <link href="assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="assets/vendor/venobox/venobox.css" rel="stylesheet">
  <link href="assets/vendor/owl.carousel/assets/owl.carousel.min.css" rel="stylesheet">
  <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <script src="https://code.jquery.com/jquery.min.js"></script>
  <script src="jquery.dependent.fields.js"></script>
  <!-- Template Main CSS File -->
  <link href="assets/css/style.css" rel="stylesheet">
  <script src="https://code.jquery.com/jquery.min.js"></script>
<script src="jquery.dependent.fields.js"></script>
</head>
<body>

<section>
	<div class="row">
		<div class="col-md-2"></div>
		<div class="col-md-8">
			

	<div class="shadow p-3 mb-5 bg-light rounded">
	<h2>Patient Information</h2>
	<table class="table table-striped">
	<tr>
		<td>Name</td>
		<td><? echo $Pname;?></td>
	</tr>
	<tr>
		<td>Father/Husband Name</td>
		<td><? echo $fhname;?></td>
	</tr>
	<tr>
		<td>Contact No.</td>
		<td><? echo $contact1;?></td>
	</tr>
	<tr>
		<td>Emergency Contact No.</td>
		<td><? echo $contact2;?></td>
	</tr>
	<tr>
		<td>Email Id</td>
		<td><? echo $email;?></td>
	</tr>
	<tr>
		<td>Date of Birth</td>
		<td><? echo $dob;?></td>
	</tr>
	<tr>
		<td>Age</td>
		<td><? echo $age;?></td>
	</tr>
	<tr>
		<td>Gender</td>
		<td><? echo $gender;?></td>
	</tr>
	<tr>
		<td>Blood Group</td>
		<td><? echo $blood;?></td>
	</tr>
	<tr>
		<td>Body Weight</td>
		<td><? echo $wt;?></td>
	</tr>
	<tr>
		<td>Height</td>
		<td><? echo $height;?></td>
	</tr>
	<tr>
		<td>Aadhaar ID</td>
		<td><? echo $Aadhaar;?></td>
	</tr>
	<tr>
		<td>Address</td>
		<td><? echo $Address;?></td>
	</tr>
	<tr>
		<td>Identification Mark</td>
		<td><? echo $Mark;?></td>
	</tr>
	<tr>
		<td>Consultant</td>
		<td><? echo $Consultant;?></td>
	</tr>
	<tr>
		<td>Patient Type</td>
		<td><? echo $PatientType;?></td>
	</tr>
	<tr>
		<td>Case Type</td>
		<td><? echo $CaseType;?></td>
	</tr>
	<tr>
		<td>Admitted Ward</td>
		<td><? echo $WardType;?></td>
	</tr>
	
	<tr>
		<td>Admit Date</td>
		<td><? echo $AdmitDate;?></td>
	</tr>
	<tr>
		<td>Admit Time</td>
		<td><? echo $AdmitTime;?></td>
	</tr>
	<tr>
		<td>Advance Amount</td>
		<td><? echo $AdvanceAmount;?></td>
	</tr>
	<tr>
		<td>Payment Mode</td>
		<td><? echo $PaymentMode;?></td>
	</tr>
	<?if($PaymentMode=="Insurance"){
	echo "<tr><td>Insurance Name / Number</td>";
	echo "<td>$InsuranceName, $InsuranceNo</td></tr>";
	}

	if($PfileNameNew!=""){
			echo "<tr><td>Patient Photo</td>";
			echo "<td><img src=\"assets/PatientPhotos/$PfileNameNew\" width=\"70px\" height=\"70px\"></td></tr>";
		}
		?>
</table>
<form action="store.php" method="POST">
	<input type="hidden" name="Pname" value="<? echo $Pname;?>">
	<input type="hidden" name="fhname" value="<? echo $fhname;?>">
	<input type="hidden" name="contact1" value="<? echo $contact1;?>">
	<input type="hidden" name="contact2" value="<? echo $contact2;?>">
	 <input type="hidden" name="email" value="<? echo $email;?>">
	 <input type="hidden" name="age" value="<? echo $age;?>">
	 <input type="hidden" name="dob" value="<? echo $dob;?>">
	 <input type="hidden" name="Gender" value="<? echo $gender;?>">
	 <input type="hidden" name="Blood" value="<? echo $blood;?>">
	 <input type="hidden" name="Weight" value="<? echo $wt;?>">
	 <input type="hidden" name="Height" value="<? echo $height;?>">
	 <input type="hidden" name="Aadhaar" value="<? echo $Aadhaar;?>">
	 <input type="hidden" name="Address" value="<? echo $Address;?>">
	 <input type="hidden" name="Mark" value="<? echo $Mark;?>">
	 <input type="hidden" name="Photo" value="<? echo $PfileNameNew;?>">
	 <input type="hidden" name="Consultant" value="<? echo $Consultant;?>">
	 <input type="hidden"  name="PatientType" value="<? echo $PatientType;?>">
	 <input type="hidden"  name="WardType" value="<? echo $WardType;?>">
	 <input type="hidden"  name="CaseType" value="<? echo $CaseType;?>">
	 <input type="hidden" name="AdmitDate" value="<? echo $AdmitDate;?>">
	 <input type="hidden" name="AdmitTime" value="<? echo $AdmitTime;?>">
	 <input type="hidden" name="AdAmount" value="<? echo $AdvanceAmount;?>">
	 <input type="hidden" name="PaymentMode" value="<? echo $PaymentMode;?>">
	 <input type="hidden" name="InsuranceName" value="<? echo $InsuranceName;?>">
	 <input type="hidden" name="InsuranceNo" value="<? echo $InsuranceNo;?>">
     <input type="hidden" name="preparedby" value="<? echo $name;?>">
	 <button type="submit" class="btn btn-primary">Confirm and Save</button>
	 <button type="button" class="btn btn-danger" onclick="history.back()" style="padding:7px 50px;">Edit</button>
</form>
		</div>
		<div class="col-md-2"></div>
	</div>
</div>
</section>
 <script src='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'></script>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
  <script src="assets/vendor/jquery/jquery.min.js"></script>
  <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="assets/vendor/jquery.easing/jquery.easing.min.js"></script>
  <script src="assets/vendor/php-email-form/validate.js"></script>
  <script src="assets/vendor/wow/wow.min.js"></script>
  <script src="assets/vendor/venobox/venobox.min.js"></script>
  <script src="assets/vendor/owl.carousel/owl.carousel.min.js"></script>
  <script src="assets/vendor/jquery-sticky/jquery.sticky.js"></script>
  <script src="assets/vendor/superfish/superfish.min.js"></script>
  <script src="assets/vendor/hoverIntent/hoverIntent.js"></script>
  <script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
  <script src="assets/js/main.js"></script>
</body>
</html>
