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

$json_response = array();
		$query_jurusan = '';
        $sem = "";
    if ($_POST['semester']!='all') {
      $sem = "and nilai_transfer.semester='".$_POST['semester']."'";
    }
		if ($_POST['jurusan']!='all') {
			$query_jurusan = "and trim(jurusan.kode_jurusan)='".trim($_POST['jurusan'])."'";
		} else {
			    if ($_SESSION['level']!=1) {
       		 $query_jurusan = "and trim(jurusan.kode_jurusan)='".trim($_SESSION['jurusan'])."'";
      }
		}


$data = $db->fetch_custom("select *,nilai_transfer.id as id_krs from nilai_transfer inner join jurusan on nilai_transfer.kode_jurusan=jurusan.kode_jurusan where nilai_transfer.id is not null $query_jurusan  $sem and status_error!=1");
if ($data->rowCount()>0) {
   $json_response['jumlah'] = $data->rowCount();
} else {
  $json_response['jumlah'] = 0;
}

echo json_encode($json_response);

?>

