<?php
  include '_connect.php';
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>รายการสัญญาทั้งหมด</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <style>
      #customers {
        font-family: Arial, Helvetica, sans-serif;
        border-collapse: collapse;
        width: 100%;
      }

      #customers td, #customers th {
        border: 1px solid #ddd;
        padding: 8px;
      }

      #customers tr:nth-child(even){background-color: #f2f2f2;}

      #customers tr:hover {background-color: #ddd;}

      #customers th {
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: left;
        background-color: red;
        color: white;
      }
    </style>
    <style media="screen">
      table{
        font-size: 25px;
      }
      body{
        font-size: 25px;
        background-image: url("img/b1.png");
      }
    </style>
  </head>
  <body>
    <b>
      <h2>
        รายการสัญญาทั้งหมด
      </h2>
    </b>
    <table border="0" id="customers" width="50%">
      <tr>
        <th>ลำดับ</th>
        <th>เลขที่สัญญา</th>
        <th>ชื่อ</th>
        <th>ดูประวัติการชำระ</th>
      </tr>
      <?php
      $sqlx = "SELECT * FROM EHONGDB.dbo.hps_ctmain
      WHERE ct_mobileno IN ('0637318633')
      ORDER BY CT_DATE";
      $selectx=$conn->prepare($sqlx);
      $selectx->execute();
      $no = 0;
      while ($fetchx=$selectx->fetch()) {
        $no ++;
        // echo $fetchx['ps_id']."<br>";
        $ct_no = $fetchx['ct_no'];
        $ps_name = $fetchx['ps_name'];
        $ct_mobileno = $fetchx['ct_mobileno'];
      ?>
      <tr>
        <td> <?php echo number_format($no); ?>.</td>
        <td> <a href="index_checkline_1.php?ct_no=<?php echo $ct_no; ?>" target="" style="text-decoration: none; color:black;"><?php echo $ct_no; ?></a> </td>
        <td><?php echo $ps_name; ?></td>
        <td style="text-align:center;"> <a href="index_checkline_1.php?ct_no=<?php echo $ct_no; ?>" target="" style="text-decoration: none; color:black;"> <i class='fa fa-search-plus'></i> </a> </td>

      </tr>
      <?php } ?>
    </table>
  </body>
</html>
