<?php include("../config/config.php"); ?>
<?php $type = $_POST['report']; ?>
<?php 

	$report = mysql_query("SELECT * FROM books WHERE section = '$type' OR status = '$type'") or die(mysql_error());
	$count = 0;
	WHILE($data = mysql_fetch_array($report)){
	$count++;
	}

	if($count>0){
		
	?>
<div class="report_header"><h4>Republic of the Philippines</h4>
<h3>Technological University of the Philippines - Visayas</h3>
<h4>Captain Sabi St., Zone II</h4>
<h4>Talisay City, Negros Occidental</h4><br />
<?php if($type == 'L'){ ?>
<h4>Report For All Lost Books</h4>
<?php }else if($type == 'R'){ ?>
<h4>Report For All Lost Subject for Replacement Books</h4>
<?php }else if($type == 'E'){ ?>
<h4>Report For All Lost Existing</h4>
<?php }else{ ?>
<h4>Report For All Books</h4>
<?php } ?>

</div>

		<table class="print">
			<tr>
				<th>TITLE</th>
				<th>AUTHOR</th>
				<th>ISBN NUMBER</th>
				<th>ClASS NUMBER</th>
			</tr>
		<?php
		$report = mysql_query("SELECT * FROM books WHERE section = '$type' OR status = '$type'") or die(mysql_error());
		$count=0;
		 WHILE($data = mysql_fetch_array($report)){ 
		 $count++;
		 ?>
			<tr>
			<td><?php echo $data['title']; ?></td>
			<td><?php echo $data['author']; ?></td>
			<td><?php echo $data['isbn_no']; ?></td>
			<td><?php echo $data['call_number']; ?></td>
			</tr>
		<?php } ?>
		<tfoot>
		<tr>
		<td colspan="7" style="text-align: right;">Total of <?php echo $count; ?> Items.</td>
		</tr>
		</tfoot>
		</table>

<script>
$(document).ready( function() {

})
</script>

<?php 
	}else{
		echo 0;
	}
?>