<?php

session_start();
?>

<?php 
$db = retrieveRecordsDb();
$rs = receiveRoutingMessages($db, $_SESSION['department']);
$nm = $rs->num_rows;
if (isset($_GET['iN'])) {
    if ($nm > $_GET['iN']) {
        $nm = $_GET['iN'];
    }
}
if (isset($iN)) {
    if ($nm > $iN) {
        $nm = $iN;
    }
}
if ($nm > 0) {
    ?>

<div class="panel-group" id="accordion">

<div class="panel panel-default">
<table class="table table-striped table-hover table-bordered"  width=100% >
<thead>
<tr>
<td>
<h3 class=""><a data-toggle="collapse" data-parent="#accordion" href="#collapsePending">Documents Needing Reply <?php 
    echo "(" . $nm . ")";
echo $message;
?>
            <span class="tools pull-right">
				<a class="fa fa-cogs"  data-toggle="modal" href="#myModal2"></a>

                <a href="javascript:;" class="fa fa-chevron-down"></a>
                <a href="javascript:;" class="fa fa-times"></a>
             </span>
        </header>
        <div class="panel-body">
        <div class="adv-table">
		
		
		<?php 
$db = connectDb();
$rs = receiveRoutingMessages($db, $_SESSION['division_code']);
$nm = $rs->num_rows;
?>
	
		<span id='test' name='test'></span>
        <table  class="display table table-bordered table-striped" id="pending_dt" name='pending_dt'>
			<thead>
			<tr>
			<th>Office Code</th>
			<th>Document Date</th>
			<th>Subject</th>
			<th>Reference Number</th>
			<th>Action Taken</th>
			<th>Action Date</th>
			<th>Request Status</th>
			<th>Action</th>