<?php 
    include 'header.php'; 

    $level=$_SESSION['level'];
    $thn = date('Y');
    $bln = date('m');   
?>

<div class="container">

 <div class="my-4 border-bottom">
   <h2 class="fw-semibold fs-3">Data Kelengkapan Karyawan</h2>
 </div>

  <div class="row justify-content-center">
    <div class="col-lg-12">
       <div class="card">

    <div class="card-header d-flex justify-content-between">
      <span class="card-title fw-semibold align-self-start mb">Data Kelengkapan Karyawan & Pengurus</span>
    <div>
      <button type="button" class="btn btn-danger btn-sm align-self-end" data-bs-toggle="modal" data-bs-target="#exampleModal">
        <a href="b_karyawan_print.php?bln=<?php echo $bln; ?>&thn=<?php echo $thn; ?>" target="_blank" class="btn btn-warning btn-sm"><i class="bi bi-printer-fill"></i> &nbsp Cetak ke Printer</a>   
      </button>
    </div>    

    <div>
      <button type="button" class="btn btn-primary btn-sm align-self-end" data-bs-toggle="modal" data-bs-target="#exampleModal">
        <a href="b_karyawan_top.php" class="btn btn-primary btn-sm"><i class="bi bi-reply-all-fill"></i> &nbsp Balik ae</a>   
      </button>
    </div>
    </div>
    <div class="card-body">
      <div class="table-responsive">
        <table class="table table-bordered table-striped" id="table-datatable">
          <thead>
            <tr>
              <th width="1%" class="text-center">No</th>
              <th width="10%" class="text-center">NAMA</th>
              <th width="10%" class="text-center">JABATAN</th>
              <th width="1%" class="text-center">NIP</th>
              <th width="1%" class="text-center">NoKontak</th>
              <th width="8%" class="text-center">Masuk</th>
              <th width="1%" class="text-center">Status</th>
              <th width="1%" class="text-center">Gol</th>
              <th width="1%" class="text-center">Norek</th>
              <th width="1%" class="text-center">Foto</th>
              <th width="1%" class="text-center">OPSI</th>
            </tr>
          </thead>
          <tbody>
            <?php 
            $no=1;
            $data = mysqli_query($koneksi,"SELECT * FROM karyawan WHERE hapus<>'HAPUS' ORDER BY id ASC");
            while($d = mysqli_fetch_array($data)){
                $id=$d['id'];
                
                  $sql2 = mysqli_query($koneksi, "SELECT nip,hp,tanggal,status,gol,norek,foto FROM karyawan_iden WHERE id='$id'");
                      list($nip,$hp,$tanggal,$status,$gol,$norek,$foto) = mysqli_fetch_array($sql2); 
              ?>
              <tr>
                <td><?php echo $no++; ?></td>
                <td><?php echo $d['nama']; ?></td>
                <td align='left'><?php echo $d['jabatan']; ?></td>
                <td align='left'><?php echo $nip ; ?></td>
                <td align='left'><?php echo $hp ; ?></td>
                <td align='left'><?php echo $tanggal ; ?></td>
                <td align='leftt'><?php echo $status ; ?></td>
                <td align='left'><?php echo $gol ; ?></td>
                <td align='left'><?php echo $norek ; ?></td>
                <td align='left'><?php echo $foto ; ?></td>
                <td>   
                    <a class="btn btn-warning btn-sm" href="b_karyawan_data_edit.php?id=<?php echo $d['id'] ?>"><i class="bi bi-gear"></i></a>                                
                </td>
              </tr>
              <?php 
            }
            ?>
          </tbody>
                        <?php 
                  $sql2 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_bon FROM bon ");
                      list($t_bon) = mysqli_fetch_array($sql2); 

            	        ?>						
							<tr>
						    	<td colspan="5" style="font-weight: bold;text-align: center;">Total</td>																																									
								<td align='right'><style="font-weight: bold;"></td>
								<td align='right'><style="font-weight: bold;"></td>
								<td align='right'><style="font-weight: bold;"></td>
								<td align='right'><style="font-weight: bold;"></td>
								<td align='right'><style="font-weight: bold;"></td>
								<td align='right'><style="font-weight: bold;"></td>
							</tr> 
							<tr>
						    	<td colspan="11" style="font-weight: bold;text-align: center;"><i>Daftar ini merupakan Ketetapan dalam pembuatan slip Gaji pada setiap Bulan</i></td>
							</tr>							
        </table>
      </div>
    </div>

  </div>
    </div>
  </div>

</div>
<?php include 'footer.php'; ?>