<?
session_start();
include"../plg/ses.php";
include"../plg/kon.php";
//$sql = "delete from karyawan where saverec='0'";
//$res = $conn->query($sql);

function jumlahkar($loka){
  include"../plg/kon.php";
  $sql = "select count(id) as jumlah from karyawan where lokasi like'%$loka%' or unit like'%$loka%' and del='0'";
  $res = $conn->query($sql);
  while($a = $res->fetch_assoc()){
    echo $a['jumlah'];
  }
}

function datanya($loka){
  include"../plg/kon.php";
  ?>
  <link rel="stylesheet" href="../plg/w3.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <table class="w3-small w3-border w3-striped w3-table-all" onclick="tutup()">
    <tr class="w3-blue-gray">
      <th class="w3-border w3-center">NO</th>
      <th class="w3-border w3-center">NAMA</th>
      <th class="w3-border w3-center">NIP</th>
      <th class="w3-border w3-center">JABATAN</th>
      <th class="w3-border w3-center">UNIT</th>
      <th class="w3-border w3-center">SMT  I</th>
      <th class="w3-border w3-center">SMT II</th>
    </tr>
  <?
  $i = 1;
  $sql1 = "select * from karyawan where lokasi like'%$loka%' or unit like'%$loka%' and del='0' order by unit asc";
  $res1 = $conn->query($sql1);
  while($b = $res1->fetch_assoc()){
    $nipnya = $b['nip'];
    ?>
      <tr>
        <td class="w3-border"><?=$i++?></td>
        <td class="w3-border"><?=$b['nama']?></td>
        <td class="w3-border"><?=$b['nip']?></td>
        <td class="w3-border"><?=$b['jab']?></td>
        <td class="w3-border"><?=$b['unit']?></td>
        <td class="w3-border w3-center">
          <table class="w3-small w3-border w3-striped w3-table-all">
            <tr class="w3-white" style="font-weight:bold">
              <td colspan="3" class="w3-border w3-center w3-tiny">HASIL PENILAIAN</td>
              <td class="w3-border w3-center w3-tiny" rowspan="2">NKO</td>
              <td colspan="3" class="w3-border w3-center w3-tiny">PENYELARASAN</td>
            </tr>
            <tr class="w3-white" style="font-weight:bold">
              <td class="w3-border w3-center w3-tiny"></td>
              <td class="w3-border w3-center w3-tiny">KUANTITAS</td>
              <td class="w3-border w3-center w3-tiny">KUALITAS</td>
              <td class="w3-border w3-center w3-tiny">NILAI</td>
              <td class="w3-border w3-center w3-tiny">KRITERIA</td>
            </tr>
          <?
          $sqlkpi = "select * from kpikar where nip='$nipnya' and idkar like'I - 2024%'";
          $reskpi = $conn->query($sqlkpi);
          while ($k = $reskpi->fetch_assoc()){
            $tandakpi = $k['idkar'];
            if($tandakpi !== ''){
              ?>
              <tr>
                <td class="w3-border w3-center">
                  <a href='../userkpi/formkpiakhir.php?idkar=<?=$tandakpi?>'>
                    <i class='fa fa-check w3-card-2 w3-round-large w3-xlarge w3-green' style=''></i>
                  </a>
                </td>
                <td class="w3-border w3-center"><?=$k['hasilkuan']?></td>
                <td class="w3-border w3-center"><?=$k['hasilkua']?></td>
                <td class="w3-border w3-center"><?=$k['nko']?></td>
                <td class="w3-border w3-center"><?=$k['nilai']?></td>
                <td class="w3-border w3-center"><?=$k['krite']?></td>
              </tr>
              <?
            }
          }
          ?>
        </table>
        </td>
        <td class="w3-border">
          <table class="w3-small w3-border w3-striped w3-table-all">
            <tr class="w3-white" style="font-weight:bold">
              <td colspan="3" class="w3-border w3-center w3-tiny">HASIL PENILAIAN</td>
              <td class="w3-border w3-center w3-tiny" rowspan="2">NKO</td>
              <td colspan="3" class="w3-border w3-center w3-tiny">PENYELARASAN</td>
            </tr>
            <tr class="w3-white" style="font-weight:bold">
              <td class="w3-border w3-center w3-tiny"></td>
              <td class="w3-border w3-center w3-tiny">KUANTITAS</td>
              <td class="w3-border w3-center w3-tiny">KUALITAS</td>
              <td class="w3-border w3-center w3-tiny">NILAI</td>
              <td class="w3-border w3-center w3-tiny">KRITERIA</td>
            </tr>
            </tr>
          <?
          $sqlkpi2 = "select * from kpikar where nip='$nipnya' and idkar like'II - 2024%'";
          $reskpi2 = $conn->query($sqlkpi2);
          while ($k2 = $reskpi2->fetch_assoc()){
            $tandakpi2 = $k2['idkar'];
            if($tandakpi2 !== ''){
              ?>
              <tr>
                <td class="w3-border w3-center">
                  <a href='../userkpi/formkpiakhir.php?idkar=<?=$tandakpi2?>'>
                    <i class='fa fa-check w3-card-2 w3-round-large w3-xlarge w3-green' style=''></i>
                  </a>
                </td>
                <td class="w3-border w3-center"><?=$k2['hasilkuan']?></td>
                <td class="w3-border w3-center"><?=$k2['hasilkua']?></td>
                <td class="w3-border w3-center"><?=$k2['nko']?></td>
                <td class="w3-border w3-center"><?=$k2['nilai']?></td>
                <td class="w3-border w3-center"><?=$k2['krite']?></td>
              </tr>
              <?
            }
          }
          ?>
        </table>
        </td>
      </tr>
      <?
  }
?>
</table>
<?
}
?>
 <html lang="en">

 <head>
  <meta charset="UTF-8">
  <link rel="stylesheet" type="text/css" href="../css/flexigrid.css" />
  <script type="text/javascript" src="../plg/jquery.min.js"></script>
  <script type="text/javascript" src="flexigrid.js"></script>
  <link rel="stylesheet" href="kucingstrap.css">
  <script src="../plg/kucingstrap.js"></script>
  <link rel="stylesheet" href="../plg/w3.css">
  <link rel="icon" href="../plg/logoagp.png">

  <title>AGP SIMKP</title>
</head>

<body>
<?include"../menu.php";?>
  <div class="w3-container" style="" id="">
    <div class="w3-card-4" style="width:100%">
    <header class="w3-container w3-light-grey">
      <h5 class="w3-center">DAFTAR KARYAWAN PT ADHI GUNA PUTERA | PENYELARASAN</h5>
    </header>
    <div class="w3-container">
      <?include"listkantor.php";?>
    </div>
    <br/><hr/>
  </div>
  <br/><br/><br/>
  </div>

  <div id="id01" class="w3-modal">
      <div class="w3-modal-content" style="width:70%;">
        <div class="w3-container">
          <span onclick="keluar()" class="w3-button w3-display-topright w3-red"><b>&times;</b></span>
          <br/><hr/>
          <iframe style="border:1px solid white;width:100%;height:500px;" id="rangka"></iframe>
        </div>
      </div>
    </div>
</body>
</html>
<script>
function butup(id) {
  var x = document.getElementById(id);
  if (x.className.indexOf("w3-show") == -1) {
    x.className += " w3-show";
  } else {
    x.className = x.className.replace(" w3-show", "");
  }
}
</script>
<script type="text/javascript" src="fungsinya.js"></script>
