<?php session_start();
include_once ('conn/session.php');
require_once ('conn/controller.php');
 if (!isset($_SESSION['uname'])) {
    header("Location: user_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);  
  
  
  
if(isset($_GET['id'])){
	
$id=$_GET['id'];
$stmt = $reg_user->runQuery("SELECT * FROM beneficiary WHERE id='$id'");
$stmt->execute();
$rowb = $stmt->fetch(PDO::FETCH_ASSOC);
}
 
?>










<?php  
if (isset($_POST['acc_name'])) { 
    $_SESSION['acc_name'] = $_POST['acc_name'];
}

if (isset($_POST['amount'])) { 
    $_SESSION['amount'] = $_POST['amount'];
}
if (isset($_POST['racc_no'])) { 
    $_SESSION['racc_no'] = $_POST['racc_no'];
}
 
if (isset($_POST['bank_name'])) { 
    $_SESSION['bank_name'] = $_POST['bank_name'];
}
if (isset($_POST['type'])) { 
    $_SESSION['type'] = $_POST['type'];
}
if (isset($_POST['swift'])) { 
    $_SESSION['swift'] = $_POST['swift'];
}

if (isset($_POST['routing'])) { 
    $_SESSION['routing'] = $_POST['routing'];
}
 

if (isset($_POST['remarks'])) { 
    $_SESSION['remarks'] = $_POST['remarks'];
}
 
 

?> 

<?php 

if (isset($_POST['rname'])) { 
    $_SESSION['rname'] = $_POST['rname'];
}
if (isset($_POST['rbank'])) { 
    $_SESSION['rbank'] = $_POST['rbank'];
}
if (isset($_POST['racc'])) { 
    $_SESSION['racc'] = $_POST['racc'];
}
if (isset($_POST['remail'])) { 
    $_SESSION['remail'] = $_POST['remail'];
}
if (isset($_POST['rswift'])) { 
    $_SESSION['rswift'] = $_POST['rswift'];
}
if (isset($_POST['baddress'])) { 
    $_SESSION['baddress'] = $_POST['baddress'];
}
if (isset($_POST['iban'])) { 
    $_SESSION['iban'] = $_POST['iban'];
}
if (isset($_POST['rcurrency'])) { 
    $_SESSION['rcurrency'] = $_POST['rcurrency'];
}
if (isset($_POST['rtype'])) { 
    $_SESSION['rtype'] = $_POST['rtype'];
}
if (isset($_POST['rcountry'])) { 
    $_SESSION['rcountry'] = $_POST['rcountry'];
}
?>

 <?php include 'auth_header.php'; ?>
 
 
 
 
 
 
 
 
  <!-- partial -->
      <div class="main-panel">        
        <div class="content-wrapper">
          <div class="row">
             
            
        
            
            
            <div class="col-md-6 grid-margin stretch-card">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title"><img src="icon/local.png"  height="40px"/> Account to Account Transfer</h4>
                  <p class="card-description">
                   Fill all Details
                  </p>
                  
                 <form  autocomplete="off" method="POST" action="transfer_processing_samebank.php">  
                  
                  <div class="form-group">
                    <div class="input-group">
                      <div class="input-group-prepend">
                        <span class="input-group-text">Debit Account</span>
                      </div>
                    	<select  class="form-control"  required style="color:black;">
                    <option value="<?php echo $row['acc_no']; ?>"><?php echo $row['acc_no']; ?> | <?php echo $row['currency']; ?><?php echo $english_format_number = number_format( $row['a_bal'] , 2, '.', ','); ?></option>
                   
                        </select>  
                    </div>
                  </div>
                  <div class="form-group">
                       <span id="sprytf_amount">
                    <div class="input-group">
                        
                      <div class="input-group-prepend">
                        <span class="input-group-text bg-primary text-white">Amount (<?php echo $row['currency']; ?>)</span>
                      </div>
                      
                      <input id="amount" class="form-control" placeholder="100.99" name="amount" type="number" required>
                    
                      <div class="input-group-append">
                        <span class="input-group-text">.00</span>
                      </div>
                          
                    </div>
                      <span class="textfieldRequiredMsg">Sending Amount is required.</span>
                    			<span class="textfieldMinCharsMsg">minimum of $10.</span> 
                    		</span>
                  </div>
                  <div class="form-group">
                       <span id="sprytf_remarks">
                    <div class="input-group"> 
                      <textarea id="remarrks" class="form-control" maxlength="100" rows="5" name="remarks" placeholder="Enter Transfer Description(s)" required></textarea>
			
                    </div>
                    		<span class="textfieldRequiredMsg">Purpose of Transfer is required.</span>
            			<span class="textfieldMinCharsMsg">min of 15 characters.</span> 
                  </div>
                  
                  <input id="email" class="form-control"   value="<?php echo $_SESSION['racc']; ?>" name="racc_no" type="hidden" required>
                 <input id="email" class="form-control"   value="<?php echo $_SESSION['rname']; ?>" name="acc_name"  type="hidden" required>
					
	                <input id="input-last-name" value="<?php echo $site_initial; ?>" name="bank_name" type="hidden" required>
                    <input type="hidden" class="form-control" name="uname" value="<?php echo $row['email']; ?> "/>
                    <input class="form-control" placeholder="Bank Address" name="swift" type="hidden" value="<?php echo $site_routing; ?>" required>
                    <input type="hidden" class="form-control"  name="routing" value="<?php echo date("h:i A d M Y"); ?>" > 
                  
                  
                    
                    
                    <button type="submit" class="btn btn-danger mb-2"><i class=" 	fa fa-sign-in"></i>  Transfer</button>
                 </form>
               
                  
                </div>
              </div>
            </div>
            <div class="col-md-6 grid-margin stretch-card">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title">Beneficiary Details</h4>
                  <p class="card-description">Verified Details of the beneficiary</p>
                  <form>
                    <div class="row">
                      <div class="col-md-6">
                        <div class="form-group">
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="checkbox" class="form-check-input" checked>
                              <?php echo $_SESSION['racc']; ?>
                            </label>
                          </div>
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="checkbox" class="form-check-input" checked>
                             <?php echo $_SESSION['rname']; ?>
                            </label>
                          </div>
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="checkbox" class="form-check-input"  checked>
                              Account to Account
                            </label>
                          </div>
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="checkbox" class="form-check-input" checked>
                              Instant Transfer
                            </label>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group">
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="radio" class="form-check-input" name="optionsRadios" id="optionsRadios1" checked value="">
                             <?php echo $_SESSION['baddress']; ?>
                            </label>
                          </div>
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="radio" class="form-check-input" name="optionsRadios" id="optionsRadios2" value="option2" checked>
                              <?php echo $_SESSION['rcountry']; ?>
                            </label>
                          </div>
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="radio" class="form-check-input" name="optionsRadios2" id="optionsRadios3" value="option3" checked >
                              <?php echo $_SESSION['rcurrency']; ?>
                            </label>
                          </div>
                          <div class="form-check">
                            <label class="form-check-label">
                              <input type="radio" class="form-check-input" name="optionsRadio2" id="optionsRadios4" value="option4"  checked>
                              <?php echo $_SESSION['remail']; ?>
                            </label>
                          </div>
                        </div>
                      </div>
                    </div>
                  </form>
                </div>
                
              </div>
            </div>
        
             
          
     
          </div>
        </div>
        <!-- content-wrapper ends -->
 
 
 
 
 
 
 
 
 
  <?php include 'auth_footer.php'; ?>