<?php
include('../config/config.php');
include('../classes/classDoctor.php');
include('../classes/classAppointment.php');
include('../classes/classPatient.php');


try
{
	$retrieveDocOb = new classDoctor;
	$retrieveDocOb->setLocationID($_SESSION['security']['location_id']);
	$doc_array = $retrieveDocOb->retrieveAllDoctors();
}
catch(MyException $e)
{
	$error_message = $e->getUserMsg();
}

$date = $_SESSION['temp']['date'];
try
{
	$retrieveAppOb = new classAppointment;
	$retrieveAppOb->setLocationID($_SESSION['security']['location_id']);
	$retrieveAppOb->setAppDate($date);
	$app_array = $retrieveAppOb->retrieveAllDoctorAppointmentsDetail();
}
catch(MyException $e)
{
	$error_message = $e->getUserMsg();
}

/*echo '<pre>';
print_r($app_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"><!-- 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" -->DOCTORS APPOINTMENTS<!-- InstanceEndEditable --></h2>
            </header>

  <br />
  
<!-- InstanceBeginEditable name="main" -->
  <!-- page start-->
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
              		<tr>
              
                <td width="10%" valign="bottom"></td>
                <td width="90%" align="right">
                <div class="col-md-5" style="float: right;">
                <div class="profile-nav alt">
                  <section class="panel">
                    <div class="user-heading alt clock-row terques-bg" style="min-height:0px;">
                      <p class="text-left">Appointments on:</p>
                      <h1><?php echo date('d F Y',strtotime($date));?></h1>
                    </div>
                  </section>
                </div>
              </div>
          		</td>
                
              </tr>
            	</table>
                <table class="bottomBorder" cellpadding="0" cellspacing="0" width="100%">
                    
                    <thead>
                        <tr>
                        	<th width="20%" align="left">Doctor</th>
                        	<th width="60%" align="left">Appointments</th>
                        </tr>
                    </thead>
                    
                    <tbody>
                    <?php
					if(isset($app_array[0]['doctor_id']))
					{
						for($ap=0;$ap<count($app_array);$ap++)
						{
							
							$doc_name = ucwords($app_array[$ap]['title'].'. '.$app_array[$ap]['doc_fname'].' '.$app_array[$ap]['doc_lname']);
							$doc_id = $app_array[$ap]['doctor_id'];
							?>
							<tr>
								<td align="left"><?php echo $doc_name;?><br>
                                </td>
								
								<td align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <?php
								for($app=0;$app<count($app_array[$ap]['apps']);$app++)
								{
									$app_timein = date('h:i A',$app_array[$ap]['apps'][$app]['app_timein']);
									$app_timeout = date('h:i A',$app_array[$ap]['apps'][$app]['app_timeout']);
									
									$patOb = new classPatient;
									?>
									<tr>
										<td><?php echo $app_timein.' - '.$app_timeout.' '.$patOb->retrievePatientNameByPatientID($app_array[$ap]['apps'][$app]['patient_id']); ?></td>
									</tr>
									<?php
								}
								?>
								</table></td>
								
								
                                
							</tr>
                            
                           
							<?php
						}
					}
					else
					{
						?>
                    	
                        <?php
					}
					?>
                    </tbody>
                    
                    </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>
<script type="text/javascript" src="../datepicker/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../datepicker/jquery-ui.js"></script>