


<?php include 'auth_header.php'; ?>

   <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.6/jspdf.plugin.autotable.min.js"></script> 
  
	

<!-- partial -->
      <div class="main-panel">
        <div class="content-wrapper">
            
             
            
            
          <div class="row">
      
   
            <div class="col-lg-12 grid-margin stretch-card">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title">Account Statement <button  style="color:white;"  onclick="generate()" class="badge badge-success" >Print Statement</button></h4>
                  <p class="card-description">
                    To view Cash Deposit History   <button  style="color:white;" id="myBtn" class="badge badge-danger">Click Here</button> 
                    
                    
                   
                    
                 
                  </p>
                  <div class="table-responsive" >
                    
                      
                      
                      
                <table  class="table table-striped" id="dataexample">
                  
                    
               
                         
                         
                    <thead>
                        
                       <tr>
                   <th colspan="7" style="text-align:center; font-weight:700;"><h6> BANK ADDRESS: &nbsp;&nbsp; <?php echo $site_address; ?>  </h6></th>  
               </tr>
                     
              <tr>
                   <th colspan="7" style="text-align:center; font-weight:700"><h6>ACCOUNT NAME:&nbsp;&nbsp; <?php echo $row['fname']; ?> <?php echo $row['lname']; ?> &nbsp;&nbsp;&nbsp;&nbsp; ACCOUNT NUMBER: &nbsp;&nbsp; <?php echo $row['acc_no']; ?>  </h6></th> 
                 </tr>  
                        
                        
                        
                        <tr>
            		
            		  <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Amount</th>
                      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Reciever</th>
                       <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Acc/NO</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Transfer Type</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Bank</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Country</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Description</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Date/Time</th>
                      <th>Type</th>
                      <th class="text-secondary opacity-7">Status</th>
            		 
            		</tr>
            		
            		</thead>
            
            		  
            			<tbody>
            			    
            			       <?php 
				$uname = $_SESSION['uname'];
				$email = $row['email'];
				$his = $reg_user->runQuery("SELECT * FROM transfer WHERE email = '$email' ORDER BY id DESC LIMIT 200");
				$his->execute(array(":uname"=>$_SESSION['uname']));
				while($rows = $his->fetch(PDO::FETCH_ASSOC)){?>
            			    <tr>
            			    
             <td scope="row"><?php echo $row['currency']; ?> <?php echo $rows['amount']; ?>.00</td>
						<td><?php echo $rows['acc_name']; ?></td>
						<td><?php echo $rows['acc_no']; ?></td>
						<td><?php echo $rows['transtype']; ?></td>
						<td><?php echo $rows['bank_name']; ?></td>
						<td><?php echo $rows['cout']; ?></td>
						<td><?php echo $rows['remarks']; ?></td>
						<td><?php echo $rows['routing']; ?></td>
						<td><div class="badge badge-danger"><?php echo $rows['type']; ?></div></td>
						<td><div class="badge badge-success"><?php echo $rows['status']; ?></div></td>
                      </tr>
               <?php } ?>
            	
            
               
                    </table>
                  </div>
                </div>
              </div>
            </div>
            
            
            
         
          </div>
        </div>
        
        
        
        
        
        
  
 
<!-- The Modal -->
<div id="myModal" class="modal">

  <!-- Modal content -->
  <div class="modal-content">
    <span class="close">&times;</span>
   
   
    <div class="table-responsive">
                    
                      
                      <h3 syle="color:darkgreen; font-weight:700;">CASH DEPOSIT STATEMENT</h3>
                      
                <table  class="table table-striped">
                    <thead><tr>
            		
            		 <th>REF No.</th> 
						<th>TYPE</th>
						<th>AMOUNT</b></th>
						<th>TO/FROM</th>
						<th>DESCRIPTION</th>
						<th>DATE/TIME</th>
						<th>STATUS</th>
            		 
            		</tr></thead>
            
            		  
            			<tbody>
            			    
           <?php 
				$uname = $_SESSION['uname'];
				$debcre = $reg_user->runQuery("SELECT * FROM alerts WHERE uname = '$uname'");
				$debcre->execute();
				while($rows = $debcre->fetch(PDO::FETCH_ASSOC)){?>
            			    <tr>
            			    
             <td>REF10023<?php echo $rows['id']; ?> </td>
						<td><?php echo $rows['type']; ?></td>
						<td><?php echo $rows['amount']; ?></td>
						<td><?php echo $rows['sender_name']; ?></td>
						<td><?php echo $rows['remarks']; ?></td>
						<td><?php echo $rows['date']; ?> &nbsp;<?php echo $rows['time']; ?></td>
						<td><div class="badge badge-success">SUCCESS</div></td>
                      </tr>
               <?php } ?>
            	
            
               
                    </table>
                  </div>
   
   
   
  </div>

</div>

 
<style>
 
/* The Modal (background) */
.modal {
    padding-left:150px;
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
  background-color: #fefefe;
  margin: auto;
  
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
}

/* The Close Button */
.close {
  color: #aaaaaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}
</style>


<script>
// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal 
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
</script>      
        
  
  
  
  
  
 
	 <script type="text/javascript"> 
 
 
function generate() {  
    var doc = new jsPDF('p', 'pt', 'letter');  
    var htmlstring = '';  
    var tempVarToCheckPageHeight = 0;  
    var pageHeight = 0;  
    pageHeight = doc.internal.pageSize.height;  
    specialElementHandlers = {  
        // element with id of "bypass" - jQuery style selector  
        '#bypassme': function(element, renderer) {  
            // true = "handled elsewhere, bypass text extraction"  
            return true  
        }  
    };  
    margins = {  
        top: 150,  
        bottom: 60,  
        left: 40,  
        right: 40,  
        width: 600  
    };  
    var y = 20;  
    doc.setLineWidth(2);  
   
    
     doc.text(200, y = y + 30," <?php echo $site_title; ?> Account Statement"); 
 
    doc.autoTable({  
        html: '#dataexample',  
        startY: 70,  
        theme: 'striped',  
        columnStyles: {  
            0: {  
                cellWidth: 30,  
            },  
            1: {  
                cellWidth: 120,  
            },  
            2: {  
                cellWidth: 70,  
            },
            3: {  
                cellWidth: 80,  
            },
            4: {  
                cellWidth: 80,  
            },
            5: {  
                cellWidth: 80,  
            },
            6: {  
                cellWidth: 80,  
            }
       
        },  
        styles: {  
            minCellHeight: 20  
        }  
    })  
    doc.save('account_statement.pdf');  
}  
</script>  
  
  
  
  
  
  
  
  
  
  
        
        <?php include 'auth_footer.php'; ?>
        
        