<?php 
session_start();
include('conn_auth.php');
include('customInfo.php');
include 'outputfunction.php';
?>

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
     <meta name="author" content="PWB">
    <meta name="keyword" content="Investment, Pacific Western, Finance, Co-operate world, Bank"> 
    <meta name="description" content="Pacific Western">
    <meta property="og:title" content="PWB">
    <meta property="og:description" content="Pacific Western">
    

<title><?php echo $rowUser['cust_name']; ?> | Account Statement </title>

 <link href="img/favicon.png" rel="icon">
    <!-- Bootstrap Core CSS -->
    <link href="mz/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="mz/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="mz/dist/css/sb-admin-2.css" rel="stylesheet" type="text/css">

    <link href="mz/dist/css/main_page.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="mz/vendor/morrisjs/morris.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="lib/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

      
     
     <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body style="font-size: 14px;">

    <div id="wrapper">
       <!-- first tpp div for main page-->
            <?php include('m_header.php'); ?>

            <!-- /.navbar-header -->
           <?php  include('sidbar.php'); ?>
            <!--Navbar is here incase there will  be navigator <?php  include('sidebar.php'); ?> bar -->
            <!-- /.navbar-static-side -->
        </nav>

        <div id="page-wrapper" >
          
  <!-- /.row -->
           <div class="row" style="margin-top: 30px;">
              <!-- /.col-lg-8 -->
            <div class="col-lg-12">
                 <!-- /.col-lg-4 -->
          <div class="col-lg-12">
             <div class="panel panel-default">
                <div class="panel-heading">
                <!-- /.panel-heading -->
                  <div class="pInfo">
                       <div>
    
    <h2>Account Summary</h2>
                               
<table width="100%"  class="baltable table table-responsive">
                           <tr>
                           <th height="41" bgcolor="#007EB6"><div align="left" class="style1 style3 style1">Account Name</div></th>
                           <th bgcolor="#007EB6"><div align="left" class="style5 style1">Account Number</div></th>
                           <th bgcolor="#007EB6"><div align="left" class="style5 style1">Sort code</div></th>             
                           <th bgcolor="#007EB6"><div align="left" class="style5 style1">Balance</div></th>             
                           <th bgcolor="#007EB6"><div align="left" class="style5 style1">Available</div></th>             
                            </tr>
                            <?php
              $selBank = $conn->query("select *, sum(amt_cred) as totalCredit, sum(amt_dep) as totalDebit from credit_info where accnt_nmb = '" . $rowUser['acct_nmb'] . "' group by accnt_nmb") or die(mysql_error());

                            if(!$selBank->num_rows){
              ?>
                            <tr>
                            <td height="25" colspan="5" bgcolor="#FFFFFF"><span class="style7">Sorry there is no transaction for this account </span></td>
                            </tr>
                            <?php
              }else{
              $rowBank = $selBank->fetch_assoc();
                            ?>
              <tr>
                            <td bgcolor="#FFFFFF"><?php echo $rowBank['cust_name']; ?></td>
                            <td bgcolor="#FFFFFF"><?php echo $rowBank['accnt_nmb']; ?></td> 
                 <td bgcolor="#FFFFFF">&nbsp;</td> 
                           <td bgcolor="#FFFFFF"><span class="balinfo"><?php echo getCurrency($rowcurr['curr_type']); echo number_format($rowBank['totalCredit']-$rowBank['totalDebit'], 2, '.', ','); ?></span></td>
                             <td bgcolor="#FFFFFF"><span class="balinfo"><?php echo getCurrency($rowcurr['curr_type']); echo number_format($rowBank['totalCredit']-$rowBank['totalDebit'], 2, '.', ','); ?></span></td>
                           </tr>
                           <?php
               }
               ?>
                            </table>
                                    
              <div style="margin:5px 0px 0px 10px; color:#333333;" ><h5 class="style7">Minin statment</h5> 
                  </div>
                            <div style="margin:5px 0px 0px 10px; color:#333333;" ><span class="style7">Select account</span>
                              <hr /> </div>
                            <div style="padding:9px;">I<span class="style7">tems shown from today's data are subject to confirmation and maybe reversed from your account.
                            </span><br>
</div>
                  
                  <table width="100%" class="baltable table table-responsive">
<tr>
                    <th bgcolor="#007EB6"><div>Date</div></th>
                  <th bgcolor="#007EB6"><div>Transaction type</div></th>
                  <th bgcolor="#007EB6"><div>Description</div></th>
                     <th bgcolor="#007EB6"><div>Credit</div></th>             
                     <th bgcolor="#007EB6"><div>Debits</div></th>             
                    </tr>
                            <?php
              $seldel = $conn->query("select * from credit_info where accnt_nmb = '" . $rowUser['acct_nmb'] . "' order by transact_id DESC") or die(mysql_error());
                            if(!$seldel->num_rows){
              ?>
                            <tr>
                            <td height="27" colspan="5" bgcolor="#FFFFFF"><span class="style7">Sorry there is no transaction for this account </span></td>
                      </tr>
                            <?php
              }else{
              while($rowDel= $seldel->fetch_array()){;
              
              ?>
            <tr>
            <td><?php echo $rowDel['dat_pay']; ?></td>
            <td><?php echo $rowDel['trans_type']; ?></td>
            <td><?php echo $rowDel['narratn']; ?></td> 
            <td><?php  echo $rowDel['amt_cred']==0?"":getCurrency($rowcurr['curr_type']) . number_format($rowDel['amt_cred'], 2, '.', ','); ?></td> 
            <td><?php echo $rowDel['amt_dep'] == 0?"": getCurrency($rowcurr['curr_type']). number_format($rowDel['amt_dep'], 2, '.', ','); ?></td>
            </tr>
              <?php
               }
               }
               ?>
            </table>
                            
                                   
            </div>
                        </div>
                <!-- /.panel-body -->
              </div>
          </div>
          </div>    

        </div>
        <!-- /#page-wrapper -->  

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="mz/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="mz/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="mz/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Morris Charts JavaScript -->
    <script src="mz/vendor/raphael/raphael.min.js"></script>
    <script src="mz/vendor/morrisjs/morris.min.js"></script>
    <script src="mz/data/morris-data.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="mz/dist/js/sb-admin-2.js"></script>
   <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
   <script src="https://bitcoinaverage.com/js/widgetGenerator/widgetUserScript.js"></script>
</body>

</html>
