<?php
session_start();
header('Access-Control-Allow-Origin: *');
include "../../inc/config.php";

    $query_jenis = '';
    $query_jurusan = '';
    $sem = "";
    if ($_POST['sem']!='all') {
      $sem = "and daya_tampung.semester='".$_POST['sem']."'";
    }

  if ($_POST['jurusan']!='all') {
    $query_jurusan  = "and daya_tampung.kode_jurusan='".$_POST['jurusan']."'";
  } else {
    if ($_SESSION['level']!=1) {
        $query_jurusan = "and daya_tampung.kode_jurusan='".$_SESSION['jurusan']."'";
      }
  }

$json_response = array();
$data = $db->fetch_custom("select daya_tampung.* from daya_tampung where daya_tampung.id is not null $sem $query_jurusan and status_error!=1");
if ($data->rowCount()>0) {
   $json_response['jumlah'] = $data->rowCount();
} else {
  $json_response['jumlah'] = 0;
}

echo json_encode($json_response);

?>
