<?
header("Content-type: application/vnd-ms-excel");
header("Content-Disposition: attachment; filename=pusat.xls");

$idkar = $_GET['idkar'];
include"../plg/kon.php";
$sql = "select * from kpikar where idkar='$idkar'";
$res = $conn->query($sql);
while($a = $res->fetch_assoc()){
  $namax = $a['nama'];
  $nip = $a['nip'];
  $jab = $a['jab'];
  $cab = $a['lok'];
  $smt = $a['smt'];
  $unit = $a['unit'];
  $hasilkua = $a['hasilkua'];
  $hasilkuan = $a['hasilkuan'];
}

$sqlk = "select * from karyawan where nip='$nip'";
$resk = $conn->query($sqlk);
while($k = $resk->fetch_assoc()){
  $atasan = $k['bos'];
  $unit = $k['unit'];
}

$grs1 = "";
$grs2 = "text-align:center;";
$grs3 = "text-align:left;padding-left:5px;";
$fok = "background-color:#D5D9DC;font-weight:bold;font-size:10px;padding-left:10px;text-align:center;";
$uj = "text-align:right;padding-right:10px;";
$kr = "text-align:left;padding-left:10px;";
?>


<html>
<head>
<title></title>
</head>
<body>
  <br/><br/>
<center>
<h3>SISTIM MANAJEMEN KINERJA PEGAWAI<br/>PERIODE SEMESTER <?=$smt?><br/>( 01 JANUARI  S/D 30 JUNI )</h3>
</center>
<br/>
<table style="" cellpadding="0" cellspacing="0" border="0">
    <tr style="">
      <th style="<?=$uj?>" colspan="2">NAMA PEGAWAI :</th>
      <th style="<?=$kr?>" colspan="3"><?=$namax?></th>
      <th style="<?=$grs1?>" colspan="2"></th>
      <th style="<?=$uj?>" colspan="3">DIVISI :</th>
      <th style="<?=$kr?>" colspan="3"><?=$unit?></th>
    </tr>
    <tr style="">
      <th style="<?=$uj?>width:100px;" colspan="2">NIP :</th>
      <th style="<?=$kr?>" colspan="3"><?=$nip?></th>
      <th style="<?=$grs1?>" colspan="2"></th>
      <th style="<?=$grs1?>" colspan="3"></th>
      <th style="<?=$grs1?>" colspan="3"></th>
    </tr>
    <tr style="">
      <th style="<?=$uj?>width:100px;" colspan="2">JABATAN :</th>
      <th style="<?=$kr?>" colspan="3"><?=$jab?></th>
      <th style="<?=$grs1?>" colspan="2"></th>
      <th style="<?=$uj?>" colspan="3">PENILAI :</th>
      <th style="<?=$kr?>" colspan="3"><?=$atasan?></th>
    </tr>
</table>
<br/>

     <table style="" cellpadding="0" cellspacing="0" border="1">
       <thead>
         <tr style="background-color:#4CA4EA;">
           <th rowspan="2" style="<?=$grs1?>width:100px;">KODE KPI</th>
           <th rowspan="2" style="<?=$grs1?>width:100px">KEY</th>
           <th rowspan="2" style="<?=$grs1?>width:80px;">NO</th>
           <th rowspan="2" style="<?=$grs1?>width:100px;">POLARISASI</th>
           <th rowspan="2" style="<?=$grs1?>width:300px;">KEY PERFORMANCE INDICATOR<br/>(SASARAN KINERJA)</th>
           <th rowspan="2" style="<?=$grs1?>width:100px;">SATUAN</th>
           <th rowspan="2" style="<?=$grs1?>width:100px;">VOLUME</th>
           <th rowspan="2" style="<?=$grs1?>width:100px;">KUALITAS</th>
           <th colspan="3" style="<?=$grs1?>width:200px;">PENCAPAIAN KINERJA</th>
           <th colspan="2" style="<?=$grs1?>width:200px;">HASIL PENILAIAN</th>
         </tr>
         <tr style="background-color:#4CA4EA">
           <th colspan="" style="<?=$grs1?>">VOLUME</th>
           <th colspan="" style="<?=$grs1?>">KUALITAS</th>
           <th colspan="" style="<?=$grs1?>">CATATAN</th>
           <th colspan="" style="<?=$grs1?>">KUANTITAS</th>
           <th colspan="" style="<?=$grs1?>">KUALITAS</th>
         </tr>
       </thead>

       <tr>
         <td colspan="13" style="<?=$fok?>"> I Fokus Keuangan</td>
       </tr>
       <?
       $i = 1;
       $sql1 = "select * from kpiuser where idkar='$idkar' and del='0' and fok like'%keuangan%'";
       $res1 = $conn->query($sql1);
       while($b = $res1->fetch_assoc()){
       ?>

       <tr>
         <td style="<?=$grs2?>"><?=$b['kpi']?></td>
         <td style="<?=$grs2?>"><?=$b['kode']?></td>
         <td style="<?=$grs2?>"><?=$i++?></td>
         <td style="<?=$grs2?>"><?=$b['pola']?></td>
         <td style="<?=$grs3?>"><?=$b['des']?></td>
         <td style="<?=$grs2?>"><?=$b['sat']?></td>
         <td style="<?=$grs2?>"><?=$b['vol']?></td>
         <td style="<?=$grs2?>"><?=$b['kua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkvol']?></td>
         <td style="<?=$grs2?>"><?=$b['pkkua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkcat']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkuan']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkua']?></td>
       </tr>
       <?}?>

       <tr>
         <td colspan="13" style="<?=$fok?>"> II Fokus Pelayanan</td>
       </tr>
       <?
       $sql1 = "select * from kpiuser where idkar='$idkar' and del='0' and fok like'%pelayanan%'";
       $res1 = $conn->query($sql1);
       while($b = $res1->fetch_assoc()){
       ?>
       <tr>
         <td style="<?=$grs2?>"><?=$b['kpi']?></td>
         <td style="<?=$grs2?>"><?=$b['kode']?></td>
         <td style="<?=$grs2?>"><?=$i++?></td>
         <td style="<?=$grs2?>"><?=$b['pola']?></td>
         <td style="<?=$grs3?>"><?=$b['des']?></td>
         <td style="<?=$grs2?>"><?=$b['sat']?></td>
         <td style="<?=$grs2?>"><?=$b['vol']?></td>
         <td style="<?=$grs2?>"><?=$b['kua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkvol']?></td>
         <td style="<?=$grs2?>"><?=$b['pkkua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkcat']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkuan']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkua']?></td>
       </tr>
       <?}?>

       <tr>
         <td colspan="13" style="<?=$fok?>"> III Proses Bisnis Dan SDM</td>
       </tr>
       <?
       $sql1 = "select * from kpiuser where idkar='$idkar' and del='0' and fok like'%bisnis%'";
       $res1 = $conn->query($sql1);
       while($b = $res1->fetch_assoc()){
       ?>
       <tr>
         <td style="<?=$grs2?>"><?=$b['kpi']?></td>
         <td style="<?=$grs2?>"><?=$b['kode']?></td>
         <td style="<?=$grs2?>"><?=$i++?></td>
         <td style="<?=$grs2?>"><?=$b['pola']?></td>
         <td style="<?=$grs3?>"><?=$b['des']?></td>
         <td style="<?=$grs2?>"><?=$b['sat']?></td>
         <td style="<?=$grs2?>"><?=$b['vol']?></td>
         <td style="<?=$grs2?>"><?=$b['kua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkvol']?></td>
         <td style="<?=$grs2?>"><?=$b['pkkua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkcat']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkuan']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkua']?></td>
       </tr>
       <?}?>

       <tr>
         <td colspan="13" style="<?=$fok?>"> IV Fokus Kepemimpinan</td>
       </tr>
       <?
       $sql1 = "select * from kpiuser where idkar='$idkar' and del='0' and fok like'%kepemimpinan%'";
       $res1 = $conn->query($sql1);
       while($b = $res1->fetch_assoc()){
       ?>
       <tr>
         <td style="<?=$grs2?>"><?=$b['kpi']?></td>
         <td style="<?=$grs2?>"><?=$b['kode']?></td>
         <td style="<?=$grs2?>"><?=$i++?></td>
         <td style="<?=$grs2?>"><?=$b['pola']?></td>
         <td style="<?=$grs3?>"><?=$b['des']?></td>
         <td style="<?=$grs2?>"><?=$b['sat']?></td>
         <td style="<?=$grs2?>"><?=$b['vol']?></td>
         <td style="<?=$grs2?>"><?=$b['kua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkvol']?></td>
         <td style="<?=$grs2?>"><?=$b['pkkua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkcat']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkuan']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkua']?></td>
       </tr>
       <?}?>

       <tr>
         <td colspan="13" style="<?=$fok?>"> V Fokus Sinergi Antar Anak Usaha</td>
       </tr>
       <?
       $sql1 = "select * from kpiuser where idkar='$idkar' and del='0' and fok like'%sinergi%'";
       $res1 = $conn->query($sql1);
       while($b = $res1->fetch_assoc()){
       ?>
       <tr>
         <td style="<?=$grs2?>"><?=$b['kpi']?></td>
         <td style="<?=$grs2?>"><?=$b['kode']?></td>
         <td style="<?=$grs2?>"><?=$i++?></td>
         <td style="<?=$grs2?>"><?=$b['pola']?></td>
         <td style="<?=$grs3?>"><?=$b['des']?></td>
         <td style="<?=$grs2?>"><?=$b['sat']?></td>
         <td style="<?=$grs2?>"><?=$b['vol']?></td>
         <td style="<?=$grs2?>"><?=$b['kua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkvol']?></td>
         <td style="<?=$grs2?>"><?=$b['pkkua']?></td>
         <td style="<?=$grs2?>"><?=$b['pkcat']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkuan']?></td>
         <td style="<?=$grs2?>"><?=$b['hpkua']?></td>
       </tr>
       <?}?>

       <tr>
         <td class="grs" colspan="10"></td>

         <td class="grs" colspan="1"><b>TOTAL</b></td>
         <td class="grs" colspan="1"><b><?=$hasilkuan?> %</b></td>
         <td class="grs" colspan="1"><b><?=$hasilkua?> %</b></td>
       </tr>
       <tr>
         <td class="grs" colspan="10"></td>
         <td class="grs" colspan="1"><b>KATEGORI</b></td>
         <td class="grs" colspan="1"><b><?=$kategori?></b></td>
         <td class="grs" colspan="1"><b><?=$hasilnya?></b></td>
       </tr>
     </table>
     <br/>
     <table cellpadding="0" cellspacing="0" style="width:100%">
       <tr>
         <td style="width:25%">
           <table cellpadding="0" cellspacing="0">
             <tr>
               <td><b>KESIMPULAN PENILAIAN</b></td>
             </tr>
             <tr>
               <td>Diatas 120%</td>
               <td>  = </td>
               <td>&nbsp;Luar Biasa</td>
             </tr>
             <tr>
               <td>101% - 120% </td>
               <td>  = </td>
               <td>&nbsp;Baik</td>
             </tr>
             <tr>
               <td>91% - 100%</td>
               <td>  = </td>
               <td>&nbsp;Cukup</td>
             </tr>
             <tr>
               <td>Dibawah 90%</td>
               <td>  = </td>
               <td>&nbsp;Kurang</td>
             </tr>
           </table>
          </td>
          <td style="width:25%;text-align:center;">
            <?=strtoupper($atasan)?><br/><br/><br/><br/><br/>nama
          </td>
          <td style="width:25%;text-align:center;">
            <?=strtoupper($jab)?><br/><br/><br/><br/><br/><?=strtoupper($namax)?>
          </td>
        </tr>
   </table>

</body>
</html>
