<?php require ("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> 
  
				
                                    
           
  
 
 
 <br><br>
 
 
 <div class="container-fluid py-4">
 
  <div class="row">
        <div class="col-12">
          <div class="card my-4">
            <div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
              <div class="bg-gradient-primary shadow-primary border-radius-lg pt-4 pb-3">
                <h4 class="text-white text-capitalize ps-3">Account Statement</h4>
               &nbsp; &nbsp;&nbsp;<input type="button" onclick="generate()" class="btn btn-success"  value="Export To PDF" />
              </div>
            </div>
            
            
            
            <div class="card-body px-0 pb-2">
              <div class="table-responsive p-0">
                
                
                
                <table class="table align-items-center mb-0" id="dataexample">
                    
    <div class="card-body" x-data="BankApp()" x-init="init()">




<img class="brand-img d-none d-sm-block" src="../img/LOGO.png" alt="brand" style="max-height: 40px; max-width: 200px;" />




 <?php
	 
	
 $id = $_GET['id'];

 $ordsql = "SELECT * from transactions WHERE id = ". $id; 
// $ordsql = "SELECT * from pawn WHERE id = ". $id; 

$ordres = mysql_query($ordsql);
$ordrow = mysql_fetch_assoc($ordres);
	
        // from A left join B on A     
				 
	echo"
	
<div>";


        
if($ordrow['tran_type'] == 1) {
        echo " <h2 class='hk-pg-title font-weight-600' style='color:red'>Debit Transaction Receipt</h2>";
    }
    
    
    elseif($ordrow['tran_type'] == 2) {
        echo " <h2 class='hk-pg-title font-weight-600' style='color:green'>Credit Transaction Receipt</h2>";
    }
  
  
  if($ordrow['tran_type2'] == 1) {
        echo " <h2 class='hk-pg-title font-weight-600' style='color:red'>Debit Transaction Receipt</h2>";
    }
    
    
    elseif($ordrow['tran_type2'] == 2) {
        echo " <h2 class='hk-pg-title font-weight-600' style='color:green'>Credit Transaction Receipt</h2>";
    }
  
  
  
  

echo"
</div>


<hr class='hr_style' />


	
       
      <thead>
    
<tr><th style='white-space: nowrap; color:white;text:b; width:200'> Transaction Method  </th> <td> TRANSFER </td>  </tr>  ";     







if($ordrow['tran_type'] == 1) {
        echo " <tr> <th style='white-space: nowrap; color:white;text:b'> To   </th> <td> ".$ordrow['ben_name']." (".$ordrow['ben_acct_no'].") </td></tr> ";
    }
    

    
    

elseif($ordrow['tran_type'] == 2) {
        echo " <tr> <th style='white-space: nowrap; color:white;text:b'> From   </th> <td> ".$ordrow['name']." (".$ordrow['acc_no'].") </td></tr> ";
    }    
    
    
    
    
    
    

if($ordrow['tran_type2'] == 1) {
        echo " <tr> <th style='white-space: nowrap; color:white;text:b'> To   </th> <td> ".$ordrow['ben_name']." (".$ordrow['ben_acct_no'].") </td></tr> ";
    }
    

    
    

elseif($ordrow['tran_type2'] == 2) {
        echo " <tr> <th style='white-space: nowrap; color:white;text:b'> From   </th> <td> ".$ordrow['name']." (".$ordrow['acc_no'].") </td></tr> ";
    }    
    



echo"

<tr> <th style='white-space: nowrap; color:white;text:b'> Transaction Reference  </th> <td>  ".$ordrow['trans_id']."/TRANSFER/ ".$ordrow['date']."</td>  </tr>  


<tr><th style='white-space: nowrap; color:white;text:b'> Transaction Status </th>  <td style='white-space: nowrap; color:green'> <b>Successful</b> </td>  </tr>



<tr> <th style='white-space: nowrap; color:white;text:b'> Transaction Date </th> <td>  ".$ordrow['date']."  </td> </tr>   


<tr> <th style='white-space: nowrap; color:white;text:b'> Amount </th> <td>  ".$ordrow['cur']."  ".number_format($ordrow['trans_amount'],2)."</td>   </tr>


<tr>  <th style='white-space: nowrap; color:white;text:b'> Remark </th> <td>  ".$ordrow['trans_id']."/ ".substr($ordrow['name'],10)."-TRANSFER- ".$ordrow['note']." </td>   </tr>      



</thead>






<hr class='hr_style' />


<div class='form-group row'>
<div class='col-lg-12' style='text-align: right;'>





 
 ";

?>
 
 
 



<!--<button class='btn btn-primary submit_btn' onclick='window.print()'>PRINT/SAVE THIS PAGE</button>-->

<!--</div></div>-->


<!-- <div style='color:white;font-size:20px'>This receipt document was generated on -->

<!-- <php-->
<!--echo(date("jS F Y g.iA"));-->
<!--?> -->
 
<!-- </div>-->
                  
                  
          </table>
              </div>
            </div>
          </div>
        </div>
      </div>
 
 
 
 </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	
	 <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," Treactiion Receipt"); 
 
    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 require ("footer.php") ?>