<?php
session_start();
include_once ('../include/session.php');
require_once '../include/class.user.php';
if(!isset($_SESSION['uname'])){
header("Location: login.php");
exit(); 
}
$reg_user = new USER();

$stmt = $reg_user->runQuery("SELECT * FROM account WHERE uname=:uname");
$stmt->execute(array(":uname" => $_SESSION['uname']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);

$email = $row['email'];
$temp = $reg_user->runQuery("SELECT * FROM transfer WHERE email = '$email' ");
$temp->execute(array(":uname" => $_SESSION['uname']));
$rows = $temp->fetch(PDO::FETCH_ASSOC);


?>
<style>
        /* General styles for print */
        @media print {
            body * {
                visibility: hidden;
                position: relative;
            }
            .printSection, .printSection * {
                visibility: visible;
            }
            .printSection {
                position: fixed;
                left: 0;
                top: 0;
                width: 100%;
            }
        }
    </style>
  <?php include 'header.php'; ?>
 
 <!---begin of Mobile View Here   only from -->
 
       <?php include 'mobmenu.php'; ?>
  
  <!---End of Mobile View Here   only from -->
   
  
  
   <!---begin of Main Menu View View Here   only from -->
   <?php include 'mainmenu.php'; ?>

     <!---End of Main Menu View Here   only from -->
     
     
     
  <div class="container-fluid mt--7">
    
 
 
 
 
 
 
 
 
 
 
 
 
 
      <div class="row">
          
          
        <div class="col"><br><br>
          <div class="card shadow">
         <div class="card-header border-0" style="background-color:<?php echo $tab; ?>; color:<?php echo $tab_font; ?>;">
              <h3 class="mb-0">Transaction Statement:    <input type='button' id='btn' class="btn btn-warning" value='Print Statement' button onclick="window.print()";' ></h3>
            </div>
            <div class="table-responsive printSection">
              <table class="table align-items-center table-flush">
                <thead class="thead-light">
                  <tr>
                      
                        <th class="no-sort" style="width:1%">#</th> 
						<th scope="col">AMOUNT</th>
						<th scope="col">RECIEVING ACCOUNT AND NAME</th>
						<th scope="col">TYPE</th>
						<th scope="col">BANK</th>
						<th scope="col">DESCRIPTION</th>
						<th scope="col">DATE/TIME</th>
						<th scope="col">STATUS</th>
						
					 
                  </tr>
                </thead>
                <tbody>
             <?php 
				$uname = $_SESSION['uname'];
				$email = $row['email'];
				$his = $reg_user->runQuery("SELECT * FROM transfer WHERE email = '$email'");
				$his->execute(array(":uname"=>$_SESSION['uname']));
				while($rows = $his->fetch(PDO::FETCH_ASSOC)){?>
                  
                 
                  <tr> 
                        <td><?php echo $rows['id']; ?></td>
						<td scope="row"><?php echo $row['currency']; ?> <?php echo $rows['amount']; ?></td>
						<td><?php echo $rows['uname']; ?> - <?php echo $rows['acc_name']; ?></td>
						<td><?php echo $rows['transtype']; ?></td>
						<td><?php echo $rows['bank_name']; ?></td>
						<td><?php echo $rows['remarks']; ?></td>
						<td><?php echo $rows['cout']; ?></td>
						<td><?php echo $rows['status']; ?></td>
                  </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            
          </div>
        </div>
      </div>
 
 
 
 
 
 
 
 
 
 
      <div class="row mt-5">
        <div class="col">
          <div class="card bg-default shadow">
            <div class="card-header border-0" style="background-color:<?php echo $tab; ?>; color:<?php echo $tab_font; ?>;">
              <h3 class="text-white mb-0">Transfer History Associated with your Account</h3>
            </div>
            <div class="table-responsive">
              <table class="table align-items-center table-flush">
                <thead class="thead-light">
                  <tr>
                    <th class="no-sort" style="width:1%">Ref No.</th>
						
						<th scope="col">TYPE</th>
						<th scope="col">AMOUNT <b>(<?php echo $row['currency']; ?>)</b></th>
						<th scope="col">TO/FROM</th>
						<th scope="col">DESCRIPTION</th>
						<th scope="col">DATE/TIME</th> 
                  </tr>
                </thead>
                <tbody>
                    	<?php 
				$uname = $_SESSION['uname'];
				$debcre = $reg_user->runQuery("SELECT * FROM alerts WHERE uname = '$uname'");
				$debcre->execute();
				while($rows = $debcre->fetch(PDO::FETCH_ASSOC)){?>
                  <tr>
                    
                       <td scope="row"><?php echo $rows['id']; ?>
                              </td>
						<td><?php echo $rows['type']; ?></td>
						<td><?php echo $rows['amount']; ?></td>
						<td><?php echo $rows['sender_name']; ?></td>
						<td><?php echo $rows['remarks']; ?></td>
						<td><?php echo $rows['date']; ?> &nbsp;<?php echo $rows['time']; ?></td>
                  </tr>
                  
                  <?php } ?>
                 
                  
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
 
 
 
 
 
 <br>
 
 
 
 
     
      <!-- Footer -->
       <?php include 'footercopyright.php'; ?>
      
     