<?php
 session_start();
 require_once('../connect.php');
 require_once('sql_required.php');
 $datetoday = date('Y-m-d'); 

 $active_tab = "dashboard"; 



 $unique_id      = htmlspecialchars($_GET['mid'] ?? '');
 $acct_holder    = htmlspecialchars($_GET['acctholder'] ?? '');
 $firstname      = htmlspecialchars($_GET['fname'] ?? '');
 $lastname       = htmlspecialchars($_GET['lname'] ?? '');
 $pres_reading   = htmlspecialchars($_GET['pres_reading'] ?? '');
 $payment_type   = htmlspecialchars($_GET['payment_type'] ?? '');
 $amount         = htmlspecialchars($_GET['amount'] ?? '');
 $payment_option = htmlspecialchars($_GET['payment_option'] ?? '');
 $reading_date   = htmlspecialchars($_GET['reading_date'] ?? '');
 $payment_date   = htmlspecialchars($_GET['payment_date'] ?? '');
 $collection_date = $datetoday;
 $therefnum2      = htmlspecialchars($_GET['refnum'] ?? '');

?>

  
  
  
  
<!DOCTYPE html>
<html lang="en">
<body class="hold-transition layout-footer-fixed layout-fixed sidebar-collapse">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
<link rel="stylesheet" href="dist/css/adminlte.min.css">

<?php include_once('linkStyle.php'); ?>
  
  <style>
    .currencyinput {
      border: 1px inset #ccc;
  }
  .currencyinput input {
      border: 0;
  }
  
   
      
      @media print{
        #print {
          display:none;
        }
      }
      @media print {
        #PrintButton {
          display: none;
        }
      }
      
      @page {
        size: auto;   /* auto is the initial value */
        margin: 0;  /* this affects the margin in the printer settings */
      }
  
          .print-size {
              font-size:45px;
          }
    </style>

<div class="wrapper">
 
    <div class="content-wrapper" style="min-height: 363px;background: #fff; font-size: 23px; padding: 20px;">
 
    <div style="text-align: right;">
    <button id="PrintButton" class="btn-print" onclick="PrintPage()">Print</button>  
    <button onclick="window.location.href='printlogs_reading.php'"><< Back to list</button>
</div>

 
 <img src="images/logo2.png" width="10%" > 
  
 
 <div class="print-size">
  <hr>
   <!--start table here -->
  <?php  

 echo '<h2>Ref#:'.$therefnum2.' <b><br>Collection Date: <br>'.$collection_date   .'</h2><hr>';
 echo '<b> Account #:</b><br>'. $unique_id  .'<br>';
 echo '<b> Account Holder Name:</b><br>';
 echo '<p style="font-size:60px;">'.$acct_holder .'</p>  ';
 echo ' ----------------------------------------------- <br> ';
  echo '<b> Present Reading:&nbsp;'.$pres_reading .'</b><br>';
 echo '<b> Payment Type:</b>&nbsp;'.$payment_type  .'<br>';
 echo '<b> Payment Date:</b>&nbsp;'.$payment_date   .'<br>';
 echo '<b> Amount Paid: &nbsp; &#8369;'.$amount     .'</b><br>';
 echo '<b> Reading Date:</b>&nbsp;'.$reading_date   .'<br>';
 echo '<b> Mode of Payment:</b>&nbsp;'.$payment_option  .'<br>';
 echo ' ----------------------------------------------- <br>';
 echo '<b> REMAINING BALANCES:</b><br>';
 echo '<b> Water Bill: &nbsp;&#8369;'.$totalunpaidwaterbillbill  .'</b><br>';
 echo '<b> Meter Device:&nbsp; &#8369;'.$totalunpaidmeterfee  .'</b><br>';
 echo ' ----------------------------------------------- <br>';
 


  ?> 
   <!--end  table here -->
    </div>

   

 </div>

   
<script>
  function PrintPage() {
    window.print();
  }
 

    // When print finishes, automatically redirect after 5 seconds
    window.onafterprint = function() {
        setTimeout(function() {
            window.location.href = 'printlogs.php';
        }, 16000);
    };

    // Auto trigger print when page loads
    window.addEventListener('DOMContentLoaded', function () {
        PrintPage();
        setTimeout(function(){ window.close(); }, 750);
    });

</script>



</body>
</html>
