<?php
session_start();
header('Access-Control-Allow-Origin: *');
include "../../inc/config.php";
$url = get_service_url();
$token = get_token();
$jml=0;

$id_sms = '';
        

        $nim = "";
        $filter_prodi = "";

        $filter_transfer = "";
        if ($_POST['nim']!='all') {
            $nim_label = $_POST['value_nim'];
            $nim  = "and nim like '%".$_POST['value_nim']."%'";
        } else {
          if ($_POST['jurusan']!='all') {
            $filter_prodi = "and id_prodi='".$_POST['jurusan']."'";
          }
        }


        $semester = "";

        if ($_POST['sem_filter']!='all') {
          if ($_POST['sem_filter']=='kosong') {
             $semester = "and id_semester is null ";
          } else {
             $semester = "and id_semester='".$_POST['sem_filter']."' ";
          }
         
        }

$filter_angkatan = "and id_registrasi_mahasiswa in(select id_reg_pd from reg_pd where left(mulai_smt,4) BETWEEN '".$_POST['angkatan_awal']."' and '".$_POST['angkatan_akhir']."')";
        $filter_transfer = "id_registrasi_mahasiswa is not null $filter_angkatan $nim $filter_prodi $semester";
       

            $temp_count = [
              'act' => 'GetCountNilaiTransferPendidikanMahasiswa',
                'token' => $token,
                'filter' => "$filter_transfer"
            ];
            $temp_data = json_decode($db->run($temp_count,$url));
           /* dump($temp_count);
            dump($temp_data);*/
            $jml = $temp_data->data;
    
       

if ($jml>0) {
   $json_response['jumlah'] = $jml;
} else {
  $json_response['jumlah'] = 0;
}

echo json_encode($json_response);
?>