<?php
include('../config/config.php');
include("../classes/classPatient.php");
include("../classes/classImages.php");

/*echo '<pre>';
print_r($_SESSION);
echo '</pre>';*/

if(isset($_GET['pid'])&&$_GET['pid']!='')
{
	$patient_auto_id = base64_decode($_GET['pid']); 
	try
	{
		$retrievePatientOb = new classPatient;
		$retrievePatientOb->setPatientAutoID($patient_auto_id);
		$patient_array = $retrievePatientOb->retrievePatientByPatientID();
		
		$imageRetrieveOb = new classImages;
		$imageRetrieveOb->setPatientAutoID($patient_array[0]['patient_auto_id']);
		$image_id = $imageRetrieveOb->fetchImageOfPatient();
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}
}





/*echo '<pre>';
print_r($patient_array);
echo '</pre>';
exit;*/

?>
<!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"><!-- InstanceBegin template="/Templates/print.dwt.php" codeOutsideHTMLIsLocked="false" -->
<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 href="../datepicker/jquery-ui.css" rel="stylesheet" >  
    <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 style="background:#FFF; padding:0px 0px 0; height:auto;">
  <table cellspacing="0" cellpadding="0" width="100%" border="0" style="font-size:11px;">
    <tbody>
      <tr>
        <td align="left" style="background:#fff;"><img alt="" src="../images/org_print_logos/<?php echo $_SESSION['security']['org_id']?>.png" style="width:100%;"></td>
      </tr>
    </tbody>
  </table>
  
</br>

</div>

<div class="row">
          <section class="panel">
            <header class="panel-heading">
              <h2><!-- InstanceBeginEditable name="title" -->PATIENT CARD<!-- InstanceEndEditable --></h2>
            </header>

  <br />
  
<!-- InstanceBeginEditable name="main" -->
  <!-- page start-->
  
  <table border="0" cellpadding="0" cellspacing="0" width="40%">
    <tr>
      <td valign="top">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-bottom:1px solid #999;">
          <tr>
            <td width="30%" rowspan="3" valign="top">
            <?php
			if(isset($image_id))
					{
						
						?>
                    	<img style="height:78px; width:70px;" src="../images/patient_images/<?php echo $image_id;?>.jpg">
                        <?php
					}
                    else
                    {
                    	?>
                    	<img src="../images/photo.png" style="height:78px; width:70px;">
                        <?php
                    }
			?>
            </p></td>
            <td width="70%" >
            
            <table width="100%" border=0 cellpadding="2" cellspacing="2">
            	<tr>
            <td>MR#: <?php if(isset($patient_array[0]['patient_id'])){echo $patient_array[0]['patient_id'];}?></td>
          </tr>
         		<tr>
            <td>Name: <?php if(isset($patient_array[0]['patient_fname'])){echo ucwords($patient_array[0]['patient_fname']);}?> <?php if(isset($patient_array[0]['patient_lname'])){echo ucwords($patient_array[0]['patient_lname']);}?></td>
          </tr>
          		<tr>
            <td>Date of Birth: <?php if(isset($patient_array[0]['dob'])){echo $patient_array[0]['dob'];}?> Age: </td>
          </tr>
          		<tr>
            <td>Registration Date: <?php if(isset($patient_array[0]['reg_date'])){echo date('d M Y',$patient_array[0]['reg_date']);}else{echo date('d M Y',time());}?></td>
          </tr>
        	</table>
    </tr>
  </table>
  <!-- page end-->
  
<!-- InstanceEndEditable -->
</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>-->

   <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>
<!-- InstanceEnd --></html>