<?php
	if(!session_id()) session_start();
	$ids = session_id();
	
	include "php_class/class_mysql.php";
	include "php_class/class_grup.php";
	include "php_class/class_semesterpendek.php";
	
	$datasp = new DataSemesterPendek;
	$datasp2 = new DataSemesterPendek;
	$DataGrup = new DataGrup;
	$datasp3 = new DataSemesterPendek;
	$biayareguler = $datasp3->get_biaya('biaya');
	$biayanonreguler = $datasp3->get_biaya('biayanonreguler');
	
	$idmatakuliah = $_POST['idmatakuliah'];
	$matakuliah = $_POST['matakuliah'];
	$sks = $_POST['sks'];
	$kode = $_POST['kode'];
	$jurusan = $_POST['jurusan'];
	$program = $_POST['program'];
	$iddosen = $_POST['iddosen'];
	$dosen = $_POST['dosen'];
	
	if ($program == '122'){
		$biayasks = $biayanonreguler * $sks;	
	}else{
		$biayasks = $biayareguler * $sks;
	} 
	
	$JumlahData = $datasp2->get_temp_by_id('',$a,'jumlah', $ids, $idmatakuliah);
	if ($JumlahData > 0){
		 echo "<script>window.location='".$base."add-semester-pendek/x'</script>";
	}else{
	
	$datasp->add_temp($ids, $idmatakuliah, $matakuliah, $sks, $kode, $jurusan, $biayasks, $iddosen, $dosen);	
		 echo "<script>window.location='".$base."add-semester-pendek'</script>";
	}
?>
