
<div class="container" style="text-align: center;">
  <h3> ACCOUNT DETAILS</h3><hr>
</div>

<div class="container">
  <table class="table table-striped table-bordered table-hover table-responsive">    
      <?php
      $conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
      $conn->set_charset("utf8");
      if ($conn->connect_error) {
          die("Connection failed: " . $conn->connect_error);
      }

      $sql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_ACNO`= '".$_GET["no"]."'";
      $result = $conn->query($sql);

      if ($result->num_rows > 0) {
          while($row = $result->fetch_assoc()) { if($row["AA_ACTYPE"]=="D")$AA_ACTYPE="Day";if($row["AA_ACTYPE"]=="M")$AA_ACTYPE="Month";if($row["AA_ACTYPE"]=="W")$AA_ACTYPE="Week";
              if ($row["AA_TYPE"]== "FD")
              echo "
                <tr><th colspan='2'><span class='text-center'>Fixed Diposite A/C of ".$row["AA_NAME"]. "</span></tr><tr>
                <tr>
                    <th>ACCOUNT NO.</th>
                    <td>".$row["AA_ACNO"]. "</td>
                </tr>
                <tr>
                    <th>A/C Created</th>
                    <td>".$row["AA_TIMESTAMP"]. "</td>
                </tr>
                <tr>
                    <th>EFFECTIVE DATE</th>
                    <td>".$row["AA_DATE"]. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT HOLDER</th>
                    <td>".$row["AA_NAME"]. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT HOLDER's ID/CARD NO</th>
                    <td>".$row["AA_ICARD_NO"]. "</td>
                </tr>
                <tr>
                    <th>EMAIL ID</th>
                    <td>".$row["AA_EMAIL"]. "</td>
                </tr>
                <tr>
                    <th>PHONE NO.</th>
                    <td>".$row["AA_PHONE"]. "</td>
                </tr>
                <tr>
                    <th>ADDRESS</th>
                    <td>".$row["AA_ADDRESS"]. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT TYPE</th>
                    <td>Fixed Diposite</td>
                </tr>
                <tr>
                    <th>RATE OF INTEREST</th>
                    <td>".$row["AA_INTEREST"]. "</td>
                </tr>

                <tr>
                    <th>AMOUNT PAID</th>
                    <td>".$row["AA_AMOUNT"]. "</td>
                </tr>

                <tr>
                    <th>MATURITY DATE</th>
                    <td>".$row["AA_DATE_MATURE"]. "</td>
                </tr>
                <tr>
                    <th>NOMINEE DETAILS</th>
                    <td>".$row["AA_NOMINEE_DETAILS"]. "</td>
                </tr>
                
                ";
                elseif ($row["AA_TYPE"]== "Recurring")
                echo "
                <tr><th colspan='2'><span class='text-center'>Recurring A/C of ".$row["AA_NAME"]. "</span></tr><tr>
                <tr>
                    <th>ACCOUNT NO.</th>
                    <td>".$row["AA_ACNO"]. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT TYPE</th>
                    <td>".$row["AA_TYPE"]. "</td>
                </tr>
                <tr>
                    <th>PAYMENT TERM</th>
                    <td>".$AA_ACTYPE. "</td>
                </tr> 
                <tr>
                    <th>A/C Created</th>
                    <td>".$row["AA_TIMESTAMP"]. "</td>
                </tr>
                <tr>
                    <th>EFFECTIVE DATE</th>
                    <td>".$row["AA_DATE"]. "</td>
                </tr>

                <tr>
                    <th>ACCOUNT BALANCE</th>
                    <td>".$row["AA_BAL"]. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT HOLDER</th>
                    <td>".$row["AA_NAME"]. "</td>
                </tr>
                <tr>
                    <th>ID CARD NO</th>
                    <td>".$row["AA_ICARD_NO"]. "</td>
                </tr>
                <tr>
                    <th>EMAIL ID</th>
                    <td>".$row["AA_EMAIL"]. "</td>
                </tr>
                <tr>
                    <th>PHONE NO.</th>
                    <td>".$row["AA_PHONE"]. "</td>
                </tr>
                <tr>
                    <th>ADDRESS</th>
                    <td>".$row["AA_ADDRESS"]. "</td>
                </tr>
                
                <tr>
                    <th>INTEREST</th>
                    <td>".$row["AA_INTEREST"]. "</td>
                </tr>
                <tr>
                    <th>INSTALLMENT AMOUNT</th>
                    <td>".$row["AA_INSTALLMENT"]. "</td>
                </tr>
                <tr>
                    <th>TOTAL NUMBER OF INSTALLMENTS</th>
                    <td>".$row["AA_NO_OF_PAYMENT"]. "</td>
                </tr>
                <tr>
                    <th>NUMBER OF INSTALLMENTS PAID</th>
                    <td>".$row["AA_NO_OF_PAYPAID"]. "</td>
                </tr>
                <tr>
                    <th>MATURITY DATE</th>
                    <td>".$row["AA_DATE_MATURE"]. "</td>
                </tr>
                <tr>
                    <th>MATURITY AMOUNT</th>
                    <td>".$row["AA_MATURE_VALUE"]. "</td>
                </tr>
                <tr>
                    <th>DATE</th>
                    <td>".$row["AA_DATE"]. "</td>
                </tr>
                <tr>
                    <th>NOMINEE DETAILS</th>
                    <td>".$row["AA_NOMINEE_DETAILS"]. "</td>
                </tr>
                
                ";
                else 
                echo "
                <tr><th colspan='2'><span class='text-center'>Loan A/C of ".$row["AA_NAME"]. "</span></tr><tr>
                <tr>
                    <th>ACCOUNT NO.</th>
                    <td>".$row["AA_ACNO"]. "</td>
                </tr>
                <tr>
                    <th>PAYMENT TERM</th>
                    <td>".$AA_ACTYPE. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT TYPE</th>
                    <td>".$row["AA_TYPE"]. "</td>
                </tr>
                <tr>
                    <th>A/C Created</th>
                    <td>".$row["AA_TIMESTAMP"]. "</td>
                </tr>
                <tr>
                    <th>EFFECTIVE DATE</th>
                    <td>".$row["AA_DATE"]. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT BALANCE</th>
                    <td>".$row["AA_BAL"]. "</td>
                </tr>
                <tr>
                    <th>ACCOUNT HOLDER</th>
                    <td>".$row["AA_NAME"]. "</td>
                </tr>
                <tr>
                    <th>ID CARD NO</th>
                    <td>".$row["AA_ICARD_NO"]. "</td>
                </tr>
                <tr>
                    <th>EMAIL ID</th>
                    <td>".$row["AA_EMAIL"]. "</td>
                </tr>
                <tr>
                    <th>PHONE NO.</th>
                    <td>".$row["AA_PHONE"]. "</td>
                </tr>
                <tr>
                    <th>ADDRESS</th>
                    <td>".$row["AA_ADDRESS"]. "</td>
                </tr>
                <tr>
                    <th>INTEREST</th>
                    <td>".$row["AA_INTEREST"]. "</td>
                </tr>
                <tr>
                    <th>INSTALLMENT AMOUNT</th>
                    <td>".$row["AA_INSTALLMENT"]. "</td>
                </tr>
                <tr>
                    <th>LOAN AMOUNT</th>
                    <td>".$row["AA_AMOUNT"]. "</td>
                </tr>
                <tr>
                    <th>NUMBER OF PAYMENT</th>
                    <td>".$row["AA_NO_OF_PAYMENT"]. "</td>
                </tr>
                <tr>
                    <th>TERM ENDING DATE</th>
                    <td>".$row["AA_DATE_MATURE"]. "</td>
                </tr>
                <tr>
                    <th>1st GUARANTER DETAILS</th>
                    <td>".$row["AA_G1_DETAILS"]. "</td>
                </tr>
                <tr>
                    <th>2nd GUARANTER DETAILS</th>
                    <td>".$row["AA_G2_DETAILS"]. "</td>
                </tr>
                
                ";
          } 
      } else {
          echo "0 results";
      };
      $conn->close();
      ?>

  </table>
</div>
