<?php 
include('pdf_header.php');
error_reporting(E_ERROR | E_PARSE);
// include('includes/config/config.php');
// include('includes/functions.php');
include("pdf_ohc_header.php");
include ('log_entry.php');
?>
<table width="100%" >
<tr><div style="font-size:12px">
<td width="25%" align="left"> Run Date : <?php  echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size:20px"><strong>Training Schedule List</strong></td>
<td width="30%" align="left"> User : <?php  echo $username ?></td>
</tr>
</table>
<table border="1">
<?php 
$sql=base64_decode($filterkey);
//echo $sql;
$result = @mysqli_query($conn,$sql);
//echo $result;
  //echo $result;

  ?><tr bgcolor='#eeeeee'><th width=8%>Id</th><th width=15%>Employee Name</th><th width=12%>Training Name</th><th width=15%>From Date (Schedule)</th><th width=15%>To Date (Schedule)</th><th width=12%>Trainer Name</th><th width=12%>Training Location</th><th width=12%>Status</th>
</tr><?php 

while($row_traning=mysqli_fetch_array($result)){
	
	
	$emp_assign_training_id=$row_traning['emp_assign_training_id'];
if($row_traning['status']=="N"){
	$status="Not Completed";
}else if($row_traning['status']=="Y"){
	$status="Completed";
}else{
    $status="No So";
}
	
$emp_name="";	
$emp_name=getTableFieldValue('patient_master','patient_name','id',$row_traning['emp_id']);
 $query_schedule = "select * from  training_schedule where schedule_id='".$row_traning['training_schedule_id']."' ";
	  //echo   $query_schedule;
                              $result_schedule = @mysqli_query($conn,$query_schedule);
							   while($rows_schedule = mysqli_fetch_assoc($result_schedule)){
								   $training_name=getTableFieldValue('training_master','training_name','training_master_id',$rows_schedule['training_id']);
								   $from_date=  date_format(date_create($rows_schedule['from_date']),"d-M-Y");
								   $to_date=date_format(date_create($rows_schedule['to_date']),"d-M-Y");
									$trainer_name=$rows_schedule['trainer_name'];
									$training_location=$rows_schedule['location'];
							   	 //$training_schedule= $training_name.'('.$rows_schedule['trainer_name'].','.date_format(date_create($row_training['from_date']),"d-M-Y").' '.date_format(date_create($row_training['to_date']),"d-M-Y").')'; 
							     
							   }
	
    ?><tr><td><?php  echo  $row_traning['emp_assign_training_id']?></td><td><?php  echo $emp_name?></td><td><?php  echo  $training_name?></td><td><?php  echo $from_date?></td><td><?php  echo $to_date ?></td><td><?php  echo $trainer_name?></td><td><?php  echo $training_location?></td><td><?php  echo $status?></td>
</tr><?php 
}
?>
</table>
<?php 
include('pdf_footer.php');
?>