<?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']; ?> | PWB </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" >
          

          <div class="row">
            <div class="col-lg-12">
              <!-- /.panel -->
              <div class="panel panel-default">
                <!-- /.panel-heading -->
                <div class="panel-body">
                  <div class="row">
                   <div class="col-lg-12">
               <?php
       if($rowUser['cust_name'] ==""){
         echo "<div class='alert alert-warning'>You have not completed your profile. To complete your profile, Click the link below. 
            <span><a href='update-profile'> Complete profile </a></span>
          </div>";  
          }
           ?>  
            </div> 
               </div>
                  <div class="row">
                    <div class="col-lg-6">
                      
         <div class="bal-st block-grp">
         <div class="row">
          <div class="col-lg-12 col-md-12 col-sm-12">
          <div class="date_cover">
            <?php echo date(" l d, M Y "); ?>
          </div>
         <div class="bal-div">
         <span class="c-wal-bal">
          Available Balance  
         </span>
          <span class="bal-div-styl">
          <?php echo getCurrency($rowcurr['curr_type']).number_format(getBalance($rowUser['acct_nmb']), 2, '.', ','); ?>
         </span>
       </div>
          
         </div>
      </div>

            
          </div>

                      <!-- /.table-responsive -->
                    </div>
                    <!-- /.col-lg-4 (nested) -->
                  <div class="col-lg-6">
                   <div class="sect-div">
                     <h4>Transaction history</h4>
                      <p>Details of transactions are sorted according to dates  Transactions  was made </p>
                      <div class="details-content">  
                      <div class="m-items">
                      Transaction Date:  <span><?php echo date(" l d, M Y ", strtotime($trans_date)); ?></span>
                      </div>
                      <div class="m-items">
                      Amount:  <span><?php echo getCurrency($rowcurr['curr_type']). number_format($amt_trans, 2, '.', ','); ?></span>
                      </div>
                      <div class="m-items">
                      Status:  <span><?php echo $trans_stat; ?></span>
                      </div>
                     </div>
                   </div> 
                  </div>   

                        <!-- /.col-lg-8 (nested) -->
                  </div>
                  <!-- /.row -->
                </div>
                <!-- /.panel-body -->
              </div>
             
            </div>
            <!-- /.col-lg-8 -->
            <!-- /.col-lg-4 -->
          </div>
          <!-- /.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 -->
                <table width="100%" cellpadding="0" cellspacing="0" class="baltable table table-responsive">
               <tr>
                               <th height="41" bgcolor="#828386"><div align="left" class="style1 style3 style1 style1">Account Name</div></th>
                      <th bgcolor="#828386"><div align="left" class="style5 style1">Account Number</div></th>
                      <th bgcolor="#828386"><div align="left" class="style5 style1">Swift code</div></th>             
                      <th bgcolor="#828386"><div align="left" class="style5 style1">Balance</div></th>             
                      <th bgcolor="#828386"><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($conn->error);
    
                                if(!$selBank->num_rows){
                                ?>
                                <tr>
                                <td height="29" 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 height="37" bgcolor="#FFFFFF"><?php echo $rowBank['cust_name']; ?></td>
                                <td bgcolor="#FFFFFF"><?php echo $rowBank['accnt_nmb']; ?></td> 
                                 <td bgcolor="#FFFFFF"><?php echo $rowUser['swift_code']; ?></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>
                <!-- /.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>
</body>

</html>
