<?
session_start();
include"../plg/ses.php";
include"../plg/kon.php";
$txtlama = $_GET['txtlama'];
if($prof=='admin'){
  $menu = "../menu.php";
}else{
  $menu = "../menu2.php";
}
?>

<head>
 <meta charset="UTF-8">
 <?include"../css2/flexigrid.php";?>
 <!--<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="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
 <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
 <?include"flexigrid.php";?>
 <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";
$thn = date('Y');

function notalin($t){
  include"../plg/kon.php";
  $sql = "select count(idkar)as totalkar from kpikar where $t";
  $res = $conn->query($sql);
  while($a = $res->fetch_assoc()){
    return $totalkar = $a['totalkar'];
  }
}
$smt1p = "smt = 'I - $thn' and lok like'%pusat%' and kunci='Belum'";
$smt1c = "smt = 'I - $thn' and lok not like'%pusat%' and kunci='Belum'";

?>
<center>
 <div class="w3-container" style="width:80%" id="">

   <div class="w3-card-4">
    <div class="w3-container w3-red">
      <h4>CLOSING ALL USER KPI !...</h4>
    </div>
    <table class="w3-table">
      <tr>
        <th class="w3-small w3-border" style="text-align:right;padding-right:50px;">
          TOTAL KPI KARYAWAN KANTOR PUSAT SEMESTER I - <?=$thn?> : <?=notalin($smt1p)?> ORANG
        </th>
        <th class="w3-small w3-border w3-center">
          <?
          $s1 = notalin($smt1p);
          if($s1=='0'){
            $vis = "display:none";
            $visb = "display:";
          }
          if($s1 !== '0'){
            $vis = "display:";
            $visb = "display:none";
          }
          ?>
          <div class="w3-btn w3-red w3-small w3-card-2" onclick="kuncisemua('pusat')" style="<?=$vis?>">CLOSE</div>
          <div class="w3-btn w3-green w3-small w3-card-2" onclick="kuncisemua('pusatopen')" style="<?=$visb?>">OPEN</div>
        </th>
      </tr>
      <tr>
        <th class="w3-small w3-border" style="text-align:right;padding-right:50px;">
          TOTAL KPI KARYAWAN KANTOR CABANG SEMESTER I - <?=$thn?> : <?=notalin($smt1c)?> ORANG
        </th>
        <th class="w3-small w3-border w3-center">
          <?
          $s2 = notalin($smt1c);
          if($s2=='0'){
            $vis2 = "display:none";
          }
          if($s2 !== '0'){
            $vis = "display:";
            $visb2 = "display:none";
          }
          ?>
          <div class="w3-btn w3-red w3-small w3-card-2" onclick="kuncisemua('cabang')" style="<?=$vis2?>">CLOSE</div>
          <div class="w3-btn w3-green w3-small w3-card-2" onclick="kuncisemua('cabangopen')" style="<?=$visb2?>">OPEN</div>
        </th>
      </tr>
    </table>


   <br/>
 </div>
</center>
 <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 kuncisemua(x){
  location.href="kuncikpi.php?siapa="+x;
}
</script>
