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

$selAmt = $conn->query("select * from transfer_info where trans_id = '" . $_GET['trans_id'] . "'") or die(mysql_error());
$rowAmt = $selAmt->fetch_assoc(); 

if(isset($_GET['fb'])){


if($rowUser['cust_trans_stat'] == "On"){
$prevnmbr = $rowUser['no_trans'];
$newnmbr = $prevnmbr + 1; 
$updateTran = $conn->query("update customer_info set no_trans = '$newnmbr' where customer_id = '" . $rowUser['customer_id'] . "'") or die($conn->error); 
 }


$updateAcc = $conn->query("update transfer_info set trans_stat = 'Completed' where trans_id = '" . $_GET['trans_id'] . "'") or die($conn->error);

 /**
$ins = $conn->query("insert into credit_info (transact_id, payee_name, payee_accnt, cust_name, accnt_nmb, trans_type, amt_cred, amt_dep, dat_pay) values (NULL, '" . $rowAmt['ben_name'] . "', '" . $rowAmt['to_accnt'] . "', '" . $row['fullname'] . "', '" . $rowAmt['acct_nmb'] . "', 'Transfer', 0, '" . $rowAmt['amt_trans'] . "',  '" . date("Y-m-d") . "')") or die(mysql_error());
  **/           

$to = $rowUser['email'];
$subject = 'Transfer Notification';
$from = 'support@@gmbsplc.com';
$replyto = 'support@@gmbsplc.com'; 

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$trans_id = substr(time()*rand(), 0, 14);
// Create email headers
$headers .= 'From: '. $to ."\r\n".
    'Reply-To: '. $replyto ."\r\n" .
    'X-Mailer: PHP/' . phpversion();
 
// Compose a simple HTML email message
$message = '<html><body>';
$message .= '<div style="width:200px; display:block"><img src="https://www.sgate.com/silvagate/bk/img/logo-2x.png" width="130" height="40" /></div>';
$message .= '<div><span style="color:#003399; font-size:16px; font-weight:600;">TRANSACTION ID: </span><span style="color:#990000; font-size:16px; font-weight:200;">'. $trans_id .'</span> </div>';
$message .= '<p style="color:#080;font-size:14px; font-family:Helvetica; padding;9px; margin:10px 0px 10px 0px;">Hello '. $rowUser['cust_name'] . '</p>';
$message .= '<div style=" border:1px solid rgba(0, 0, 0, 0.3); border-radius:6px; box-shadow:1px 3px 2px rgba(0, 0, 0, 0.6); padding:10px;">';
$message .= '<p style="color:#080;font-size:18px;">You have successfully wired transferred payment of '. $rowAmt['amt_trans'] . ' to '. $rowAmt['ben_name'] . ' </p>';
$message .= '<p style="color:#080;font-size:18px;">Account Number '. $rowAmt['acct_nmb'] . ', with Swiftcode: <span>'. $rowAmt['swift_code'] . '</span> </p>';
$message .='</div>';
$message .= '<div style="padding:9px;">';
$message .= '<p style="color:#000066; font-size:14px; font-weight:400">Problems with trasaction ? </p>';
$message .= '<p style="color:#000066; font-size:14px; font-weight:400">You have 24 hours from the date to contact the <a href="http://www.sgate.com/silvagate/bk/">bank</a> for Reversal  </p>';
$message .= '<p style="color:rgba(0, 0, 0, 0.3); font-size:12px;"> Pacific Western Bank  is a private Banking Division and is a leading provider of advisory and capital markets services to corporate and financial sponsor clients across the globe. With banking professionals across the Americas, Europe and Asia, we leverage our industry-specific expertise and regional market insight to serve the evolving needs of our clients. The deep sector knowledge of our industry coverage teams allows us to provide our clients with unique market insight on a full range of financing alternatives and strategic opportunities. Leveraging our leading institutional distribution platform, our goal is to provide our clients with solutions across all banking products, including initial public offerings, follow-on offerings, wall-crossed offerings, bought deals, private placements, ATMs, convertible offerings, leveraged loans, investment grade and high-yield debt offerings and all forms of advisory services.</p>';
$message .= '</div>';
$message .= '</body></html>';
 
// Sending email
if(mail($to, $subject, $message, $headers)){
   header('location:transfer-info?trans_id='. $_GET['trans_id'] .'&gt=Email-sending-successful-&-generating-code&edb=9003003993mnhd9389893493');
} else{
  header('location:transfer-info?trans_id='. $_GET['trans_id'] .'&gt=Email-sending-successful-&-generating-code&edb=9003003993mnhd9389893493');
}
}

?>
<!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']; ?> - Validate Transfer </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">
     
     <link href="mcss/style.css" rel="stylesheet">
     <link href="mcss/xtrastyle.css" rel="stylesheet">
       <link href="mcss/responsive.css" rel="stylesheet">
     
     <!-- 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]-->

<style type="text/css">
  .loadstat{
    margin-top: 40px;
    margin-bottom: 8px;
  }
</style>
</head>

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

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

            <!-- /.navbar-header -->
            
            <!-- /.navbar-static-side -->
    

        <div id="page-wrapper" style="width: 100%; margin-left: 40px;">
          <?php
        if(isset($_GET['msg'])){
          echo "<a href='personal' class='close-msg'>X</a>";
       echo "<div class='alert alert-info' id='warningdiv'>" . $_GET['msg'] . "</div>";
        }
          ?>         

           <div class="row">
            <div class="col-lg-10">
              <!-- /.panel -->
              <div class=" panel-default">
                <!-- /.panel-heading -->
                <div class="panel-body">
                                        
                 <div class="pInfo">
                         
                   <div class="transT" style="margin-top: 50px;">
                   
               <hr>
               <h3 class="style10">Transfer details</h3>

               <img src="img/sucessful-transfer.png" width="306" height="40">
               
                         <h6 style="font-family: 'Calibri'; font-size: 1.17em; color: rgba(0, 0, 0, 0.5); ">For any issues or enquires you can contact Support Desk at <strong>info@gwblc.com</strong> </h6>

               <div class="spinDiv">


  
  <table width="100%" cellpadding="0" cellspacing="0" class="baltable">
               <tr>
                <th><div align="left" class="style1 style14 style3 style4 style1">Recipient Account Number</div></th>
                <th><div align="left" class="style15 style3 style4 style1">Full name</div></th>
                <th><div align="left" class="style15 style3 style4 style1">Bank Name</div></th>             
                <th><div align="left" class="style15 style3 style4 style1">Swift Code</div></th>             
                <th><div align="left" class="style15 style3 style4 style1">Amount Transfered</div></th>             
              </tr>
                            <?php
              $seldel = $conn->query("select * from transfer_info where trans_id = '" . $_GET['trans_id'] . "'") or die(mysql_error());
                            if(!$seldel->num_rows){
              ?>
                            <tr>
                            <td colspan="5" bgcolor="#FFFFFF"><span class="style4">Sorry there is no transaction for this account </span></td>
                      </tr>
                            <?php
              }else{
              $rowDel= $seldel->fetch_array();
                            ?>
              <tr >
                            <td height="56" bgcolor="#FFFFFF" style="border-bottom:1px solid #333333;"><span class="style4"><?php echo $rowDel['to_accnt']; ?></span></td>
                            <td bgcolor="#FFFFFF" style="border-bottom:1px solid #333333;"><span class="style4"><?php echo $rowDel['ben_name']; ?></span></td> 
                 <td bgcolor="#FFFFFF" style="border-bottom:1px solid #333333;"><span class="style4"><?php echo $rowDel['bank_name']; ?></span></td> 
                           <td bgcolor="#FFFFFF" style="border-bottom:1px solid #333333;"><span class="style4"><?php echo $rowDel['swift_code']; ?></span></td>
                             <td bgcolor="#FFFFFF" style="border-bottom:1px solid #333333;"><span class="style4"><?php echo  getCurrency($rowcurr['curr_type']). number_format($rowDel['amt_trans'], 2, '.', ','); ?></span></td>
                      </tr>
                           <?php
               }
               
               ?>
<tr>
<td colspan="7">&nbsp;</td>
</tr>
<tr>

<td colspan="7"><a href="cp?trans_info=Transaction completed" style="font-size:14px; color:#003399;" class="">Close</a>&nbsp;&nbsp; |&nbsp;&nbsp; <a href="transfer?db=new transfer&tID=8739plT38300202992" style="font-size:14px; color:#003399;" class="">New transfer</a></td>
</tr>
              </table>

  
</div>
                </div>       
                
                        </div>
                  <!-- /.row -->
                </div>
                <!-- /.panel-body -->
              </div>
             
            </div>
            <!-- /.col-lg-8 -->
            <!-- /.col-lg-4 -->
          </div>
         
    <!-- 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>
<script type="text/javascript" src="js/script.js"></script>
    <!-- Custom Theme JavaScript -->
    <script src="mz/dist/js/sb-admin-2.js"></script>


</body>

</html>
