<?php require "_header.php";?>
<script language="javascript" type="text/javascript">
document.getElementById("main-content").style.display = 'none';
</script>

<div id="main-report" align="center">

<?php
/*echo "<pre>";
print_r($_SESSION);
exit;*/
if($_SESSION['aCollegeId']!="" && isset($_SESSION['aCollegeId'])) 
{
		$header_row_string = "Book Issue Report";
?>

	<center><h4 style="width:80%; padding:5px" ><?php print $header_row_string; ?></h4></center>
    <br/><br/>
 	
<?php  
		$qry = "SELECT 
					lbm.book_registerno, 
					lbm.book_name,
					lbm.book_author,
					issue_late_reason,
					DATE_FORMAT(issue_date,'%d/%m/%Y') As issuedate, 
					DATE_FORMAT(issue_returnlastdate,'%d/%m/%Y') As issue_returnlastdate, 
					DATE_FORMAT(issue_returndate,'%d/%m/%Y') As issue_returndate, 
					lim.member_type, lim.member_id,issue_returnfine
				FROM 
					lms_bookmaster lbm , 
					lms_issuedetail lid, 
					lms_issuemaster lim 
				WHERE 
					lim.member_type='1' AND 
					lim.member_id='".$_SESSION['student_id']."' AND 
					lbm.school_id ='1' AND 
					lid.school_id ='1' AND 
					lim.school_id ='1' AND 
					lid.issue_id = lim.issue_id AND 
					lbm.book_registerid = lid.book_registerid AND 
					lbm.book_id = lid.book_id ORDER BY issue_date DESC "; 
			$result1=dbQuery($qry);
			if(dbRows($result1)>0) {	
?>
	
    <table width="80%" cellspacing="0" cellpadding="0" class="table-report" border="1">
     <thead>
      <tr style="background-color:#CCC;">
	    <th align="center" width="5%" style="text-align:center">Sr No</th>
        <th align="center" width="8%" style="text-align:center">Book Reg.No</th>
        <th align="left" width="20%" style="text-align:left">&nbsp;Book Name</th>
        <th align="left" width="10%" style="text-align:left">&nbsp;Author Name</th>
        <th align="center" width="8%" style="text-align:center">Issue Date</th>
        <th align="center" width="8%" style="text-align:center">Due Date</th>
        <th align="center" width="8%" style="text-align:center">Date of Submission</th>
        <th align="center" width="8%" style="text-align:center">Fine</th>
        <th align="center" width="20%" style="text-align:center">Reason</th>
      </tr>
    </thead> 
<?php 
	
	$srno=1;
	while($row1=dbArray($result1))
	{
	extract($row1);
	$style="";
	if($issue_returndate=="00/00/0000"){
		$style="color:#FF0000";
	}
?>
	<tr style="<?php echo $style; ?>">
		<td align="center" style="text-align:center"><?php echo $srno;?></td>
        <td align="center" style="text-align:center"><?php echo $book_registerno;?></td>
		<td align="left"  style="text-align:left">&nbsp;<?php echo $book_name;?></td>
        <td align="left"  style="text-align:left">&nbsp;<?php echo $book_author;?></td>
		<td align="center" style="text-align:center"><?php echo $issuedate;?></td>
		<td align="center"  style="text-align:center"><?php echo $issue_returnlastdate;?></td>
        <td align="center"  style="text-align:center"><?php echo ($issue_returndate=="00/00/0000"?'':$issue_returndate);?></td>
        <td align="center"  style="text-align:center"><?php echo ($issue_returnfine==0?'-':$issue_returnfine);?></td>
        <td align="left"  style="text-align:left">&nbsp;<?php echo $issue_late_reason;?></td>
        
    </tr>
					    
	<?php $srno++; 
        }
    }
	else {
		 echo "<b>No Book issued</b>";
	}
	?>
      </table>
      
<?php
} else {
		 echo "<b>No Data Found</b>";
}
  
?>
</div>
<?php require "_footer.php";?>
