<?php 
include('../config/config.php');
include("../classes/classShift.php");
include("../classes/classDoctor.php");
include("../classes/classVisits.php");
include('../classes/classPatient.php');
include("../classes/classImages.php");
include('../classes/classTransaction.php');

if(isset($_GET['patientid'])&&isset($_GET['visitid']))
{
	$_SESSION['temp']['patient_id'] = base64_decode($_GET['patientid']);
	$_SESSION['temp']['visit_id'] = base64_decode($_GET['visitid']);
	$_SESSION['temp']['image_id'] = base64_decode($_GET['imageid']);
	//header("Location:mgmtvisits.php");
}

if(isset($_SESSION['temp']['patient_id'])&&$_SESSION['temp']['patient_id']!='')
{
	$patient_id = $_SESSION['temp']['patient_id'];
}

if(isset($_SESSION['temp']['visit_id'])&&$_SESSION['temp']['visit_id']!='')
{
	$visit_id = $_SESSION['temp']['visit_id'];
}

if(isset($_SESSION['temp']['image_id'])&&$_SESSION['temp']['image_id']!='')
{
	$image_id = $_SESSION['temp']['image_id'];
}

try
{
	$retrieveVisitPrecOb = new classVisits;
	$retrieveVisitPrecOb->setVisitID($visit_id);
	$visit_array = $retrieveVisitPrecOb->retrieveVisitByVisitID();
	
	$doctorOb = new classDoctor;
	$doctorOb->setDoctorID($visit_array[0]['doctor_id']);
	$doctor_detail = $doctorOb->retrieveDoctorByDoctorID();
	
	$doctor_name = $doctor_detail[0]['title'].'. '.$doctor_detail[0]['doc_fname'].' '.$doctor_detail[0]['doc_lname'];
	///////////// retrieve patient single data ///////////////////////////////
	
	$retrievePatientOb = new classPatient;
	$retrievePatientOb->setPatientAutoID($patient_id);
	$patient_single_detail = $retrievePatientOb->retrievePatientByPatientID();
	
	$patient_age = $retrievePatientOb->age_from_dob($patient_single_detail[0]['dob']);
	
	$imageOb = new classImages;
	$imageOb->setPatientAutoID($patient_id);
	$pat_image_id = $imageOb->fetchImageOfPatient();
	
	
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}	


/*echo '<pre>';
print_r($images_array);
echo '</pre>';
*/?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link rel="shortcut icon" href="../images/favicon.png">
    <title>Med2TEC Hospital Management Information System</title> 
    <link href="../css/print.css" rel="stylesheet">
    <link rel="stylesheet" href="../datepicker/jquery-ui.css">  
    <script type="text/javascript" src="../datepicker/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="../datepicker/jquery-ui.js"></script> 
</head>

<body> 
<div align="right"> 
 <SCRIPT LANGUAGE="JavaScript">  
if (window.print) {
document.write('<form class="no-print"><input type=button name=print value="Print" onClick="window.print()"></form>');
}
</script></div>

<section class="wrapper">

<div class="row">
          <section class="panel">
            <header class="panel-heading">
              <h2>Patient Name: <?php if(isset($patient_single_detail[0]['patient_fname'])||$patient_single_detail[0]['patient_lname']){echo $patient_single_detail[0]['patient_fname'].' '.$patient_single_detail[0]['patient_lname'];}else{echo 'Outdoor';}?>
 <?php
                if(isset($image_id))
                {
                    ?>
                    <div style="float:left; width:100%;">
                        <?php
                        
							$imageOb = new classImages;
							$imageOb->setImageID($image_id);
							$image_info = $imageOb->fetchImageByimageID();
                            ?>
  <br />
  Test Name: <?php echo ucwords($image_info[0]['image_name']);?>
  <br />
  Requested by: <?php echo $doctor_name;?>
  <br />
  Results entered on: <?php echo date('d M Y',$image_info[0]['time_stamp']);?>
  <br /></h2>
            </header>
   <br /> <br />
   
  <img src="../images/visitor_images/<?php echo $image_id;?>.jpg" width="100%">
                                
            <?php
                    
                }
                else
                {
                    ?>
                    <span style="float:left; margin-top:10px; width:100%;">
                        No Image Found!
                    </span>
                    <?php
                }
                ?>
                
                
</section>
</div>

<!--<p align="center" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; margin-top:260px;"><strong><!--317 A-1, Nursery Stop, Township, Lahore. 
Ph: 042-35151666</strong><br />
For Appointment call at 042-35151666 (bring your Patient ID Card) </p>-->


<style>


#block{
    display:block;
    margin:auto;
    position:absolute;
	float:right;
    }

#text {
    padding:0;
    margin:0;
    position:relative;
    font-size:9px;
    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    -ms-transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
	left: 880px; top: 348px; 
}
</style> 
<div class="sidepop" style="float:right;">
    <div class="sidepopbutton stemp"><div style="color: rgb(0, 0, 0); text-align: right; font-size: 10px; margin-top: 4px; position: absolute; right: 180px;">© Software by Softusion Inc. 0322 6155 219</div>   
    </div>
</div>

<!--<div class="sidepop" style="float:right;">
    <div class="sidepopbutton stemp"><div style="color:#000; text-align:right; font-size:9px;">© Software designed by Softusion Inc. Contact us at 0322 6155 219</div>   
    </div>
</div>-->


          
</body>
</html>