<?php

require __dir__ . '/init.php';

template::get_header();

$user = help::get_user( $email );

?>
	
	<?php template::title( "Statement Of Account For {$user['acctno']}" ); ?>

	<div class='card'>
		<div class='card-body'>
		
			<div class="table-responsive">
				<table class="display table table-hover table-striped" data-table="advance">
					<thead>
						<tr >
							<th>TXN-TYPE</th>
							<th>AMOUNT</th>
							<th>DESCRIPTION</th>
							<th>TO-ACCT/FROM-ACCT</th>
							<th>STATUS</th>
							<th>TXN-DATE</th>
							<th>REFERENCE NO</th>
							<th>ACTION</th>
						</tr>
					</thead>
					<tbody>
						<?php 
						
							$sql= "
								SELECT * FROM tbl_transaction 
								WHERE account='{$user['acctno']}'
							";
							
							$result = mysqli_query($link,$sql);
							
							if(mysqli_num_rows($result) > 0){
								while($row = mysqli_fetch_assoc($result)){  
							 
									$msg = (!empty($row['session'])) ? "online" : "offline";
									$ver = (!empty($row['verify'])) ? "verified" : "not verified";
									
							 ?>
						<tr class="info">
							<td><?php echo $row['tx_type'];?></td>
							<td><?php echo $row['amount'];?></td>
							<td class="center"><?php echo $row['description'];?></td>
							<td><?php echo $row['to_accno'];?></td>
							<td><?php echo $row['status'];?></td>
							<td><?php echo $row['date'];?></td>
							<td><?php echo $row['tx_no'];?></td>
							<td>
								<a href="view-statement.php?refno=<?php echo $row['tx_no']?>" class="btn btn-info">
									<span class="fas fa-pencil-alt"></span>
								</a>
							</td>
						</tr>
						<?php
								}
							}
						?>          
					</tbody>
				</table>
			</div>

		</div>
	</div>
	
<?php template::get_footer(); ?>  