<div class="col-md-12">
  <div class="box box-success">
    <div class="box-header">
      <h3 class="box-title"><p class="text-success">ข้อมูลเอกสารแผนกทะเบียน</p></h3>
    </div>
    <div class="box-body">
      <div class="form-group">
        <!-- example31 -->
        <div style="overflow-x:auto;">
          <table id="example" class="table table-striped table-bordered" style="width:100%;">
            <thead style="white-space: nowrap">
              <tr>
                <th rowspan="" style="background-color:black; color:#fff; text-align:center;">NO.</th>
                <th rowspan="" style="background-color:black; color:#fff; text-align:center;">วันที่บันทึก</th>
                <th rowspan="" style="background-color:black; color:#fff; text-align:center;">รหัสเอกสาร</th>
                <th rowspan="" style="background-color:black; color:#fff; text-align:center;">ชื่อเอกสาร</th>
                <th rowspan="" style="background-color:black; color:#fff; text-align:center;">ประเภทเอกสาร</th>
                <th rowspan="" style="background-color:black; color:#fff; text-align:center;">ผู้บันทึก</th>
              </tr>
            </thead>
            <tbody style="white-space: nowrap">
              <?php
                $sql_1 = "SELECT * FROM CONFIG.dbo.RGT_DOCUMENTFILE a
                LEFT OUTER JOIN (SELECT RGT_NO, RGT_NAME FROM CONFIG.dbo.RGT_DOCUMENTTYPE) df on (df.RGT_NO = a.RGT_NO)
                LEFT OUTER JOIN ( SELECT US_NAME, FNAME FROM EHONGDB.dbo.EMPLOYEE) emp on (emp.US_NAME = a.RGT_EMP)
                WHERE a.RGT_STATUS IS NULL $ECHORGT_CODE_NAME_1 $ECHORGT_NO_1
                ORDER BY a.RGT_ID";
                // echo $sql_1;
                $select=$conn_z->prepare($sql_1);
                $select->execute();
                $item = 1;
                while($fetch=$select->fetch()){

                  if ($fetch['RGT_DATE'] != "") {
                    $RGT_DATE_1 = substr($fetch['RGT_DATE'],0,4)+543; $RGT_DATE_2 = substr($fetch['RGT_DATE'],5,2); $RGT_DATE_3 = substr($fetch['RGT_DATE'],8,2);
                    $RGT_DATE = $RGT_DATE_3."/".$RGT_DATE_2."/".$RGT_DATE_1;
                  } else {
                    $RGT_DATE = "";
                  }
              ?>
              <tr>
                <td style="background-color:; color:; text-align:right;;"><?php echo number_format($item); ?>.</td>
                <td style="background-color:; color:; text-align:;"><?php echo $RGT_DATE; ?></td>
                <td style="background-color:; color:; text-align:;"> <a href="http://advice.ezmember.org/_backendregister/_backend/pdf/<?php echo $fetch['RGT_FILE']; ?>" target="_blank"><?php echo $fetch['RGT_CODE']; ?></a> </td>
                <td style="background-color:; color:; text-align:;"><?php echo $fetch['RGT_CODENAME']; ?></td>
                <td style="background-color:; color:; text-align:;"><?php echo $fetch['RGT_NO']." ".$fetch['RGT_NAME']; ?></td>
                <td style="background-color:; color:; text-align:;"><?php echo $fetch['RGT_EMP']." ".$fetch['FNAME']; ?></td>
              </tr>
              <?php $item++; } ?>
            </tbody>
        </table>
      </div>
      </div>
    </div>
  </div>
</div>
