<?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">OutFlow Statement</h4>
               &nbsp; &nbsp;&nbsp;<input type="button" onclick="generate()" class="btn bg-gradient-dark mb-0"  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">
                    
              


                    
                  <thead>
                                <tr>
                                   <td colspan="7" style="text-align:center;"><h6> BANK ADDRESS: &nbsp;&nbsp; <?php echo $addre ?>   </h6></td>  
                               </tr>
                     
                     
                     
                     
                      <tr>
                           <td colspan="7" style="text-align:center;"><h6>ACCOUNT NAME:&nbsp;&nbsp; <?php echo $firstname ?> <?php echo $lastname ?> &nbsp;&nbsp;&nbsp;&nbsp; ACCOUNT NUMBER: &nbsp;&nbsp; <?php echo $acc_no ?>  </h6></td> 
                         </tr>
                         
                         
                       
                      
                   
                    <?php        
                   $orderssql = "SELECT * FROM transactions WHERE log_id='$id' ORDER BY id DESC LIMIT 1000";
    $ordersres = mysql_query($orderssql);
    $numrows = mysql_num_rows($ordersres);

                   if($numrows == 0)
    {
        echo "<strong>No History</strong>";
    }
   
     ?>  
  
   
                   
                   
                    <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-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">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">Description</th>
                      
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Transaction Id</th>
                      
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Date/Time</th>
                      
                      <!--<th class="text-secondary opacity-7">Status</th>-->
                      
                       <th class="text-secondary opacity-7">Action</th>
                    </tr>
                  </thead>
                  
                  
                  
                  
     <?php
                 
                  while($row = mysql_fetch_assoc($ordersres))
     {
         
         
                 
            echo "     
            <tbody>
             <tr>";
            
           
           
            
      
         
if($row['tran_type'] == 1) {
        echo " <td style='white-space: nowrap; color:red'>". $row['cur']." ". number_format($row['trans_amount'],2)."</td>";
    }
    
   
  
  
  
 if($row['tran_type2'] == 1) {
        echo " <td style='white-space: nowrap; color:red'>". $row['cur']." ". number_format($row['trans_amount'],2)."</td>";
    }
  
   
      
            
              
            
        
         if($row['tran_type'] == 1) {
        echo " <td style='white-space: nowrap;color:red'>DEBIT</td>";
    }
    
  
    
     if($row['tran_type2'] == 1) {
        echo " <td style='white-space: nowrap;color:red'>DEBIT</td>";
    }
    
   
  

             echo"  <td style='white-space: nowrap'>". $row['note']."</td>";
         
         
         echo" 
            <td style='white-space: nowrap'>" . $row['trans_id'] . "</td>
           
      
           <td style='white-space: nowrap'>" . $row['date'] . "</td>
             
          
          
          
           <td style='white-space: nowrap;'>
<a href='transaction_receipt.php?id=" . $row['id'] . "' target='blank'> <i class='fa fa-print' style='font-size:30px;color:blue'></i></a>&nbsp;<a href='transaction_receipt.php?id=" . $row['id'] . "' target='blank'></a>
</td>
      
      

            
          </tr>";
		  
     }
		  
		  ?>
              
</tbody>
                </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," <?php echo $domain_name ?>"); 
 
    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('outflow_statement.pdf');  
}  
</script> 
 
 
	
    <?php require ("footer.php") ?>