<?
session_start();
include"../plg/ses.php";
?>
<!DOCTYPE html>
<?
$idkar = $_GET['idkar'];
$smt = substr($idkar,0,9);
?>
<html>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../plg/w3.css">
<link rel="stylesheet" href="../plg/hijaucss.css">
<body>
<div class="w3-container">
  <h4>SEMESTER <?=$smt?></h4>
  <table class="w3-table" id="myTable" style="">
    <tr>
      <th style="width:300px" class="w3-small w3-border w3-blue-gray w3-center">NAMA</th>
      <th style="width:150px" class="w3-small w3-border w3-blue-gray w3-center">NIP</th>
      <th style="width:200px" class="w3-small w3-border w3-blue-gray w3-center">UNIT</th>
      <th style="width:400px" class="w3-small w3-border w3-blue-gray w3-center">JABATAN</th>
      <th style="width:200px" class="w3-small w3-border w3-blue-gray w3-center">LOKASI</th>
    </tr>
    <?
    include"../plg/kon.php";
    $sql = "select * from kpikar where idkar='$idkar'";
    $res = $conn->query($sql);
    while($b = $res->fetch_assoc()){
      $lokk = $b['lok'];
      $haskuan = $b['hasilkuan'];
      $haskua = $b['hasilkua'];
      $nko = $b['nko'];
      $nilai = $b['nilai'];
      $krite = $b['krite'];
      $snama = strtoupper($b['nama']);
      $snip = $b['nip'];
      $ssmt = $b['smt'];
    ?>
    <tr class="w3-light-gray">
      <td class="w3-small w3-border"><?=$b['nama']?></td>
      <td class="w3-small w3-border"><?=$b['nip']?></td>
      <td class="w3-small w3-border"><?=$b['unit']?></td>
      <td class="w3-small w3-border"><?=$b['jab']?></td>
      <td class="w3-small w3-border"><?=$lokk?></td>
    </tr>
    <?}?>
  </table>
<hr/>
<table class="w3-table" id="" style="">
  <tr class="w3-small w3-border w3-blue-gray w3-center" style="font-weight:bold">
    <td colspan="2" class="w3-small w3-border w3-blue-gray w3-center">HASIL PENILAIAN</td>
    <td class="w3-small w3-border w3-blue-gray w3-center" rowspan="2">NKO</td>
    <td colspan="2" class="w3-small w3-border w3-blue-gray w3-center">PENYELARASAN</td>
  </tr>
  <tr class="" style="font-weight:bold">
    <td class="w3-small w3-border w3-blue-gray w3-center">KUANTITAS</td>
    <td class="w3-small w3-border w3-blue-gray w3-center">KUALITAS</td>
    <td class="w3-small w3-border w3-blue-gray w3-center">NILAI</td>
    <td class="w3-small w3-border w3-blue-gray w3-center">KRITERIA</td>
  </tr>
    <tr class="w3-small w3-light-gray w3-center">
      <td class="w3-border w3-center"><?=$haskuan?></td>
      <td class="w3-border w3-center"><?=$haskua?></td>
      <td class="w3-border w3-center">
        <input type="hidden" value="<?=$idkar?>" name="idkarperorang" id="idkarperorang"/>
        <center><input type="number" name="nko" id="nko" class="w3-border w3-small w3-input" value="<?=$nko?>" style="width:100px"/></center>
      </td>
      <td class="w3-border w3-center">
        <center><input type="number" name="nilai" id="nilai" class="w3-border w3-small w3-input" value="<?=$nilai?>" style="width:100px"/></center>
      </td>
      <td class="w3-border w3-center"><?=$krite?></td>
    </tr>
    <tr class="w3-large w3-light-gray w3-center">
      <td class="w3-border w3-center" colspan="5">
        <div class="w3-btn w3-green w3-small w3-card-4 w3-round-large" onclick="editpenye()">UPDATE</div>
        <div class="w3-btn w3-red w3-small w3-card-4 w3-round-large" onclick="batal()">CANCEL</div>
        <div class="w3-btn w3-yellow w3-card-4 w3-small w3-round-large" onclick="
        stopakses('<?=$snama?>','<?=$snip?>','<?=$ssmt?>')">STOP ACCESS KPI</div>
      </td>
    </tr>
</table>
<iframe name='proses' style="display:none" class="w3-border" id="proses">kucing</iframe>
<hr/>
  <table class="w3-table-all w3-hoverable">
    <thead>
      <tr class="w3-blue-gray w3-center">
        <th class="w3-small w3-center w3-border" rowspan="2">NO</th>
        <th class="w3-small w3-center w3-border" rowspan="2">KODE</th>
        <th class="w3-small w3-center w3-border" rowspan="2">KPI</th>
        <th class="w3-small w3-center w3-border" rowspan="2">POLA<br/>RISASI</th>
        <th class="w3-small w3-center w3-border" rowspan="2">KEY PERFORMANCE INDICATOR<br/>(SASARAN KINERJA)</th>
        <th class="w3-small w3-center w3-border" rowspan="2">SATUAN</th>
        <th class="w3-small w3-center w3-border" rowspan="2">VOLUME</th>
        <th class="w3-small w3-center w3-border" rowspan="2">KUALITAS</th>
        <th class="w3-small w3-center w3-border w3-pale-yellow" colspan="3">PENCAPAIAN KINERJA</th>
        <th class="w3-small w3-center w3-border w3-pale-blue" colspan="2">HASIL PENILAIAN</th>
      </tr>
      <tr>
        <th class="w3-small w3-center w3-border w3-pale-yellow" colspan="">VOLUME</th>
        <th class="w3-small w3-center w3-border w3-pale-yellow" colspan="">KUALITAS</th>
        <th class="w3-small w3-center w3-border w3-pale-yellow" colspan="">CATATAN</th>
        <th class="w3-small w3-center w3-border w3-pale-blue" colspan="">KUANTITAS</th>
        <th class="w3-small w3-center w3-border w3-pale-blue" colspan="">KUALITAS</th>
      </tr>
    </thead>

      <input type="hidden" name="idkar" value="<?=$idkar?>"/>
    <?
    include"../plg/kon.php";
    $i = 1;
    $x = 1;
    $v = 1;
    $sql = "select * from kpiuser where idkar='$idkar' and del='0' order by foktan asc";
    $res = $conn->query($sql);
    while($a = $res->fetch_assoc()){
      $idx = $a['id'];
      $uang = $a['foktan'];
      if($uang == '1'){
        $warna = "w3-theme-l4";$ket = $a['fok'];
      }elseif($uang == "2"){
        $warna = "w3-theme-l3";$ket = $a['fok'];
      }elseif($uang == "3"){
        $warna = "w3-theme-l2";$ket = $a['fok'];
      }elseif($uang == "4"){
        $warna = "w3-theme-l1";$ket = $a['fok'];
      }elseif($uang == "5"){
        $warna = "w3-theme-d1";$ket = $a['fok'];
      }elseif($uang == "6"){
        $warna = "ww3-theme-d2";$ket = $a['fok'];
      }elseif($uang == "7"){
        $warna = "w3-dark-gray";$ket = $a['fok'];
      }
      ?>
      <tr class="<?=$warna?>" title="<?=strtoupper($ket)?>" onclick="">
        <td class="w3-small w3-center w3-border w3-text-black">
          <div class="w3-btn w3-small w3-round-xlarge" onclick=""><?=$i++?></div>
        </td>
        <td class="w3-small w3-border w3-text-black"><?=$a['kode']?></td>
        <td class="w3-small w3-border w3-text-black"><?=$a['kpi']?></td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=$a['pola']?></td>
        <td class="w3-small w3-border w3-text-black"><?=$a['des']?></td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=$a['sat']?></td>
        <td class="w3-small w3-center w3-border w3-text-black">
          <input type="hidden" value="<?=$a['id']?>" name="id<?=$x++?>"/>
          <?=$a['vol']?>
        </td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=number_format($a['kua'])?> %</td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=number_format($a['pkvol'])?></td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=number_format($a['pkkua'])?></td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=$a['pkcat']?></td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=number_format($a['hpkuan'])?> %</td>
        <td class="w3-small w3-center w3-border w3-text-black"><?=number_format($a['hpkua'])?> %</td>
      </tr>
      <?
    }
    include"rumus.php";
    ?>
    <tr>
      <td class="w3-small w3-center w3-border" colspan="10"></td>

      <td class="w3-small w3-center w3-border" colspan="1"><b>TOTAL</b></td>
      <td class="w3-small w3-center w3-border" colspan="1"><b><?=$hasilkuantab?> %</b></td>
      <td class="w3-small w3-center w3-border" colspan="1"><b><?=$hasilkuatab?> %</b></td>
    </tr>
    <tr>
      <td class="w3-small w3-center w3-border" colspan="10"></td>
      <td class="w3-small w3-center w3-border" colspan="1"><b>KATEGORI</b></td>
      <td class="w3-small w3-center w3-border" colspan="1"><b><?=$kategori?></b></td>
      <td class="w3-small w3-center w3-border" colspan="1"><b><?=$hasilnya?></b></td>
    </tr>
  </table>
<br/>
<center>

</center>
  <br/><br/><hr/>
</div>
<div id="id01" class="w3-modal">
  <div class="w3-modal-content" style="width:95%;">
    <div class="w3-container" style="">
        <span onclick="batal()"
        class="w3-button w3-display-topright w3-red">&times;</b></span>
        <br/><hr/>
        <iframe style="border:1px solid white;width:100%;height:400px;" id="rangka">

        </iframe>
    </div>
  </div>
</body>
<script>


function bukakpi(a){
  location.href="../addkpi/index.php?idkar="+a;
}
function delkpi(a,b,c){
  var r = confirm("APAKAH KOLOM KODE "+b+ "AKAN DI HAPUS ?...");
  if(r==true){
    location.href="delkpi.php?id="+a+"&idkar="+c;
  }
}
function edit(){
  var r = confirm("APAKAH KPI AKAN DI UPDATE ?...");
  if(r == true){
    document.getElementById('form').submit();
  }
}
function editkan(a){
  document.getElementById('id01').style.display='block';
  document.getElementById('rangka').src="perkpi.php?kode="+a;
}

function isiulang(){
  location.reload();
}
</script>
</html>
