<?php require_once('head.php'); ?>

  <body>
  <!-- container section start -->
  <section id="container" class="">
      
	<?php require_once('header.php'); ?>	

	<?php require_once('sidebar.php'); ?>
      
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">

			  <div class="row">
                  <div class="col-lg-12">
                      <!--breadcrumbs start -->
                      <ul class="breadcrumb">
                          <li><a href="dashboard.php"><i class="icon_house_alt"></i> Accounts</a></li>
                          <li class="active"> Transfers</li>
						  <li class="pull-right"> <i class="icon_calendar"></i>
							 <?php echo date('l jS F Y'); ?></li>
                      </ul>
                      <!--breadcrumbs end -->
                  </div>
              </div>
			  
			  <div class="row">
					<div class="col-lg-12">
					<section class="panel panel-body">
					<h3><?php echo WEB_NAME ?></h3>
					<h4>ACCOUNT TRANSFERS</h4>
					  <div class="col-lg-6 col-sm-6">
					  <h3>
						<?php echo $row['user_acc']; ?>
					  </h3>
					  <p>ACCOUNT NUMBER</p>
					  </div>
					  <div class="col-lg-6 col-sm-6">
					  <h3>
						<?php echo $_SESSION['currency']; ?> 
						<?php
						$credit = sum_credits($_SESSION['user_acc']);
						$debit = sum_debits($_SESSION['user_acc']);
						$bal = $credit - $debit;
						echo number_format($bal,2);
						?>
					  </h3>
					  <p>TOTAL AVAILABLE BALANCE</p>
					  </div>
					</section>
					</div>
              </div>
			  
				<?php

				$sql = "SELECT * FROM `".TRANF_TABLE_NAME."` WHERE user_name='{$_SESSION['user_login']}' AND user_acc='{$_SESSION['user_acc']}' ORDER BY tranf_id DESC LIMIT 1";
				$stmt = $pdo->query($sql);
				$row = $stmt->fetch(PDO::FETCH_ASSOC);

				?>
			  
			  <div class="row">
                  <div class="col-lg-12">
                      <!--account status start -->
                      <div class="alert fade in alert-danger">
							<i class="icon-check"></i> <strong>Transfer :</strong> To ( <?php echo $row['rcv_acc']; ?> ) <?php echo $row['rcv_name']; ?> in <?php echo $row['rcv_bk']; ?>. ( FAILED )
						</div>

                      <!--account status end -->
                  </div>
              </div>
			  
			  <!-- Recent Transactions Starts -->
			  <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              Transfer Details (Transfer encountered an error)
                          </header>

                          <div class="table-responsive">
                            <table class="table">
                              <thead>
                              </thead>
                              <tbody>
                                <tr>
									<td style="width:30%;"><strong>Date: </strong></td>
									<td><strong><?php echo date('jS F Y', strtotime($row['atmpt_date'])); ?></strong></td>
								</tr>
								
								<tr>
									<td style="width:30%;"><strong>Sender's Account: </strong></td>
									<td><strong><?php echo $_SESSION['user_acc']; ?></strong></td>
								</tr>
								
								<tr>
									<td style="width:30%;"><strong>Amount: </strong></td>
									<td><strong><?php echo $_SESSION['currency']; ?> <?php echo number_format($row['atmpt_amt'],2); ?></strong></td>
								</tr>
								
								<tr>
									<td style="width:30%;"><strong>Beneficiary's Name: </strong></td>
									<td><strong><?php echo $row['rcv_name']; ?></strong></td>
								</tr>
								
								<tr>
									<td style="width:30%;"><strong>Beneficiary's Financial Company: </strong></td>
									<td><strong><?php echo $row['rcv_bk']; ?></strong></td>
								</tr>
								
								<tr>
									<td style="width:30%;"><strong>Account Number: </strong></td>
									<td><strong><?php echo $row['rcv_acc']; ?></strong></td>
								</tr>
								
								<tr>
									<td style="width:30%;"><strong>Transfer Code: </strong></td>
									<td><strong><?php echo $row['rcv_code']; ?></strong></td>
								</tr>
								
								<tr>
									<td style="width:30%;"><strong>Transfer Status: </strong></td>
									<td><strong><?php if ($row['status'] == "1") { echo "Completed"; }else{ echo "Incompleted";} ?></strong></td>
								</tr>

								<tr>
									<td style="width:30%;"><strong>Remark: </strong></td>
									<td><strong><?php if ($row['result'] == "1") { echo '<span class="label label-success">SUCCESS</span>'; }else{ echo "FAILED";} ?></strong></td>
								</tr>
                              </tbody>
                            </table>
                          </div>

                      </section>
                  </div>
              </div>
			  <!-- Recent Transactions end -->

              

          </section>
      </section>
      <!--main content end-->
  </section>
  <!-- container section start -->

    <!-- javascripts -->
    <script src="js/jquery.js"></script>
    <script src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.9.2.custom.min.js"></script>
    <!-- bootstrap -->
    <script src="js/bootstrap.min.js"></script>
    <!-- nice scroll -->
    <script src="js/jquery.scrollTo.min.js"></script>
    <script src="js/jquery.nicescroll.js" type="text/javascript"></script>
    <!-- charts scripts -->
    <script src="assets/jquery-knob/js/jquery.knob.js"></script>
    <script src="js/jquery.sparkline.js" type="text/javascript"></script>
    <script src="assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>
    <script src="js/owl.carousel.js" ></script>
    <!-- jQuery full calendar -->
    <script src="assets/fullcalendar/fullcalendar/fullcalendar.min.js"></script>
    <!--script for this page only-->
    <script src="js/calendar-custom.js"></script>
    <!-- custom select -->
    <script src="js/jquery.customSelect.min.js" ></script>
    <!--custome script for all page-->
    <script src="js/scripts.js"></script>
    <!-- custom script for this page-->
    <script src="js/sparkline-chart.js"></script>
    <script src="js/easy-pie-chart.js"></script>


  </body>
</html>