<?php 
	class dataJadwal extends mysql{
		function get_data_jadwal_filter($kolom,$a,$type, $semester, $tahun, $jurusan, $program){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) = 'D'";

				}elseif($jurusan == 'IESP'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) = 'B'";
				}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) in ('C', 'S', 'K', 'P')";
				}else{
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) <> 'E'";
				}
			}elseif ($program == 'Semua'){
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) in ('D', 'E')";

				}elseif($jurusan == 'IESP'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) in ('B', 'E')";
				}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) in ('C', 'S', 'K', 'P', 'E')";
				}else{
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."'";
				}
			}else{
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) = 'E'";
	
				}elseif($jurusan == 'IESP'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) = 'E'";
				}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) = 'E'";
				}else{
						$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun ='".$tahun."' and substring(kelas, 1, 1) = 'E'";
				}
				
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function add_norek($dosen, $norek){
		    $sql = "insert into tbnorek (dosen, norek) values ('".$dosen."', '".$norek."')";
		    $this->query = $this-> execute($sql,''); 
			//echo $sql;
		}
		function get_data_norek($kolom,$dosen){
			if($this->cek_result != "on"){
			$sql = "select * from tbnorek where dosen = '".$dosen."' order by id desc";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_data_beban_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "select * from tbbebantugas where id = '".$id."'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_data_jadwal_namasks_x($kolom,$nama, $sks, $semester, $tahun, $program, $jurusan){
			if($this->cek_result != "on"){
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'D'";
				}elseif($jurusan == 'IESP'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'B'";
				}elseif($jurusan == 'MANAJEMEN'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1)  in ('C', 'S', 'K', 'P')";
				}else{
					$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) <> 'E' and tbperkuliahan.sks ='".$sks."' ";
				}
			}else{
			$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' ";
			}
			//echo $sql;
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_data_jadwal_namasks($kolom,$a, $type, $nama, $sks, $semester, $tahun, $program, $jurusan){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'D'";
				}elseif($jurusan == 'IESP'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'B'";
				}elseif($jurusan == 'MANAJEMEN'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1)  in ('C', 'S', 'K', 'P') ";
				}else{
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) <> 'E' and tbperkuliahan.sks ='".$sks."' ";
				}
			}else{
			$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sks ='".$sks."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' ";
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_data_beban_nama($kolom,$nama){
			if($this->cek_result != "on"){
			$sql = "select * from tbbebantugas where nama = '".$nama."'";
			//echo $sql;
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_data_beban($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbbebantugas order by id desc";
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_skslebih($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbskslebih";
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_skslebihx($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbskshapus";
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_beban_luardalam($kolom,$a,$type, $semester, $tahun, $program, $jurusan){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
					$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'D' and tbbebantugas.formb = 'Dosen Dalam' group by tbbebantugas.nama  order by id desc";
				}elseif($jurusan == 'IESP'){
					$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'B' and tbbebantugas.formb = 'Dosen Dalam' group by tbbebantugas.nama  order by id desc";
				}elseif($jurusan == 'MANAJEMEN'){
					$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P') and tbbebantugas.formb = 'Dosen Dalam' group by tbbebantugas.nama  order by id desc";
				}else{
					$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) <> 'E' and tbbebantugas.formb = 'Dosen Dalam' group by tbbebantugas.nama  order by id desc";
				}
			}elseif($program == 'Semua'){
				$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbbebantugas.formb = 'Dosen Dalam' group by tbbebantugas.nama  order by id desc";
			}else{
				$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' and tbbebantugas.formb = 'Dosen Dalam' group by tbbebantugas.nama  order by id desc";
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_data_beban_rekap($kolom,$a,$type, $semester, $tahun, $status, $jurusan, $program){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
					
					if($status == 'Dosen Luar'){
					
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai = 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'D' group by tbbebantugas.nama order by id desc";
					}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai <> 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'D' group by tbbebantugas.nama order by id desc";
					}
	
				}elseif($jurusan == 'IESP'){
					if($status == 'Dosen Luar'){
					
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai = 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'B' group by tbbebantugas.nama order by id desc";
					}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai <> 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'B' group by tbbebantugas.nama order by id desc";
					}
				}else{
					if($status == 'Dosen Luar'){
					
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai = 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P') group by tbbebantugas.nama order by id desc";
					}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai <> 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P') group by tbbebantugas.nama order by id desc";
					}
				}
			}else{
				if ($jurusan == 'AKUNTANSI'){
					
					if($status == 'Dosen Luar'){
					
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai = 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
					}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai <> 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
					}
	
				}elseif($jurusan == 'IESP'){
					if($status == 'Dosen Luar'){
					
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai = 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
					}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai <> 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
					}
				}else{
					if($status == 'Dosen Luar'){
					
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai = 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
					}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and tbbebantugas.statuspegawai <> 'Dosen Tidak Tetap' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
					}
				}
				
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_beban_rekap($kolom,$a,$type, $semester, $tahun, $jurusan, $program){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'D' group by tbbebantugas.nama order by id desc";

				}elseif($jurusan == 'IESP'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'B' group by tbbebantugas.nama order by id desc";
				}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P') group by tbbebantugas.nama order by id desc";
				}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P', 'D', 'B') group by tbbebantugas.nama order by id desc";
				}
			}elseif ($program == 'Semua'){
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('D', 'E') group by tbbebantugas.nama order by id desc";

				}elseif($jurusan == 'IESP'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('B', 'E') group by tbbebantugas.nama order by id desc";
				}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P', 'e') group by tbbebantugas.nama order by id desc";
				}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' group by tbbebantugas.nama order by id desc";
				}
			}else{
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
	
				}elseif($jurusan == 'IESP'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
				}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' group by tbbebantugas.nama order by id desc";
				}
				
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_beban_rekap_formb($kolom,$a,$type, $semester, $tahun, $jurusan, $program, $status){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'D' and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";

				}elseif($jurusan == 'IESP'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'B' and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";
				}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P') and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";
				}
			}elseif ($program == 'Semua'){
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('D', 'E') and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";

				}elseif($jurusan == 'IESP'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('B', 'E') and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";
				}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) in ('C', 'S', 'K', 'P', 'E') and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";
				}
			}else{
				if ($jurusan == 'AKUNTANSI'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";
	
				}elseif($jurusan == 'IESP'){
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";
				}else{
						$sql = "select tbbebantugas.*, tbperkuliahan.kelas from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen where tbbebantugas.semester = '".$semester."' and tbbebantugas.tahun ='".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' and tbbebantugas.formb ='".$status."' group by tbbebantugas.nama order by id desc";
				}
				
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function add_beban_tugas($nama, $nip, $gol, $pangkat, $jabatan, $statuspegawai, $unitkerja, $subunitkerja, $s3, $satub, $satuc, $satud, $duaa, $duab, $duac, $tiga, $empata, $empatb, $empatc, $limaa, $limab, $semester, $tahun, $tgl, $norek, $minimalmengajar, $namas, $struktural, $formb){
		    $sql = "insert into tbbebantugas (nama, nip, gol, pangkat, jabatan, statuspegawai, unitkerja, subunitkerja, s3, satub, satuc, satud, duaa, duab, duac, tiga, empata, empatb, empatc, limaa, limab, semester, tahun, tgl, norek, minimalmengajar, namas, struktural, formb) values ('".$nama."', '".$nip."', '".$gol."', '".$pangkat."', '".$jabatan."', '".$statuspegawai."', '".$unitkerja."', '".$subunitkerja."', '".$s3."', '".$satub."', '".$satuc."', '".$satud."', '".$duaa."', '".$duab."', '".$duac."',  '".$tiga."', '".$empata."', '".$empatb."', '".$empatc."', '".$limaa."', '".$limab."', '".$semester."', '".$tahun."', '".$tgl."', '".$norek."', '".$minimalmengajar."', '".$namas."', '".$struktural."', '".$formb."')";
			//echo $sql;
		    $this->query = $this-> execute($sql,''); 
		}
		function edit_beban_tugas($id, $nama, $nip, $gol, $pangkat, $jabatan, $statuspegawai, $unitkerja, $subunitkerja, $s3, $satub, $satuc, $satud, $duaa, $duab, $duac, $tiga, $empata, $empatb, $empatc, $limaa, $limab, $semester, $tahun, $tgl, $norek, $minimalmengajar, $namas,  $struktural, $formb){
		    $sql = "update tbbebantugas set nama = '".$nama."', nip = '".$nip."', gol = '".$gol."', pangkat = '".$pangkat."', jabatan = '".$jabatan."', statuspegawai = '".$statuspegawai."', unitkerja = '".$unitkerja."', subunitkerja = '".$subunitkerja."', s3 = '".$s3."', satub = '".$satub."', satuc = '".$satuc."', satud = '".$satud."', duaa = '".$duaa."', duab = '".$duab."', duac = '".$duac."', tiga = '".$tiga."', empata = '".$empata."', empatb = '".$empatb."', empatc = '".$empatc."', limaa = '".$limaa."', limab = '".$limab."', semester = '".$semester."', tahun = '".$tahun."', tgl = '".$tgl."', norek = '".$norek."', minimalmengajar = '".$minimalmengajar."', namas = '".$namas."', struktural = '".$struktural."', formb = '".$formb."' where id = '".$id."'";
			//echo $sql;
		    $this->query = $this-> execute($sql,''); 
		}
		function add_temp_set($ids, $nip, $pangkat, $nidn, $nosk, $nama, $namas){
		    $sql = "insert into tempsap (id, nama, pangkat, nip, nidn, nosk, namas) values ('".$ids."', '".$nama."', '".$pangkat."', '".$nip."', '".$nidn."', '".$nosk."', '".$namas."')";
		    $this->query = $this-> execute($sql,''); 
			//echo $sql;
		}
		function add_skslebih($nama, $skslebih){
		    $sql = "insert into tbskslebih (nama, skslebih) values ('".$nama."', '".$skslebih."')";
		    $this->query = $this-> execute($sql,''); 
		}
		function add_skslebihx($nama, $skslebih){
		    $sql = "insert into tbskshapus (nama, sks) values ('".$nama."', '".$skslebih."')";
		    //echo $sql;
			$this->query = $this-> execute($sql,''); 
		}
		function delete_skslebih(){
		    $sql = "delete from tbskslebih";
		    $this->query = $this-> execute($sql,''); 
		}
		function delete_skslebihx(){
		    $sql = "delete from tbskshapus";
		    $this->query = $this-> execute($sql,''); 
		}
		function delete_temp(){
		    $sql = "delete from tempsap";
		    $this->query = $this-> execute($sql,''); 
		}
		function edit_setting($semester, $tahun, $tanggalrapat, $tanggalmulai, $tanggalakhir, $tanggalsurat, $nosk){
		    $sql = "update tbsettingsap set semester = '".$semester."', tahun = '".$tahun."', tanggalrapat = '".$tanggalrapat."',tanggalmulai = '".$tanggalmulai."',tanggalakhir= '".$tanggalakhir."', tanggalsurat = '".$tanggalsurat."', nosk = '".$nosk."'";
		    $this->query = $this-> execute($sql,''); 
		}
		function get_temp($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "select * from tempsap where id = '".$id."' order by kd desc";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_temp_nama($kolom,$nama){
			if($this->cek_result != "on"){
			$sql = "select * from tempsap where nama = '".$nama."' order by kd desc";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}

		function get_setting($kolom){
			if($this->cek_result != "on"){
			$sql = "select * from tbsettingsap";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_sk_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "select * from tbperkuliahan where id = '".$id."'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_data_sk_nama($kolom,$a,$type, $nama, $semester, $tahun, $program, $jurusan){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'D' order by tbperkuliahan.id desc";
				}elseif($jurusan == 'IESP'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'B' order by tbperkuliahan.id desc";
				}elseif($jurusan == 'MANAJEMEN'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1)  in ('C', 'S', 'K', 'P') order by tbperkuliahan.id desc";
				}else{
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."' and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) <> 'E' order by tbperkuliahan.id desc";
				}
			}else{
			$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen  where tbperkuliahan.dosen = '".$nama."'  and tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and substring(tbperkuliahan.kelas, 1, 1) = 'E' order by tbperkuliahan.id desc";
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_sk_nama_rekap($kolom,$a,$type, $dosen, $semester, $tahun, $program, $jurusan){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($program == 'Reguler'){
				if ($jurusan == 'AKUNTANSI'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1) = 'D'  order by tbperkuliahan.id desc";
				}elseif($jurusan == 'IESP'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1) = 'B'  order by tbperkuliahan.id desc";
				}elseif($jurusan == 'MANAJEMEN'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1)  in ('C', 'S', 'K', 'P')  order by tbperkuliahan.id desc";
				}else{
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1) <> 'E'  order by tbperkuliahan.id desc";
				}
				
			}elseif($program == 'Semua'){
				if ($jurusan == 'AKUNTANSI'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1) = 'D'  order by tbperkuliahan.id desc";
				}elseif($jurusan == 'IESP'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1) = 'B'  order by tbperkuliahan.id desc";
				}elseif($jurusan == 'MANAJEMEN'){
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1)  in ('C', 'S', 'K', 'P')  order by tbperkuliahan.id desc";
				}else{
					$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1) <> 'E'  order by tbperkuliahan.id desc";
				}	
			}else{
				$sql = "select tbbebantugas.*, tbperkuliahan.* from tbbebantugas inner join tbperkuliahan on tbbebantugas.nama = tbperkuliahan.dosen 
where tbperkuliahan.sm = '".$semester."' and tbperkuliahan.tahun = '".$tahun."' and tbperkuliahan.dosen = '".$dosen."' and substring(tbperkuliahan.kelas, 1, 1) = 'E'  order by tbperkuliahan.id desc";
				}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_sk_nama_jadwal($kolom,$a,$type, $dosen, $semester, $tahun, $program){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if($program == 'Reguler'){
				$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun = '".$tahun."' and dosen = '".$dosen."' and substring(kelas, 1, 1) in ('C', 'S', 'K', 'P', 'B', 'D') order by id desc";
			}else{
				$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun = '".$tahun."' and dosen = '".$dosen."' and substring(kelas, 1, 1) = 'E' order by id desc";
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_sk_nama_2($kolom,$a,$type, $dosen, $semester){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbperkuliahan where dosen = '".$dosen."' and sm = '".$semester."' order by  sks desc";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_data_sk($kolom,$a,$type, $tahun, $semester, $program){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if($program == 'Reguler'){
				$sql = "select * from tbperkuliahan where tahun = '".$tahun."' and sm = '".$semester."'  and substring(kelas, 1, 1) in ('C', 'S', 'K', 'P', 'B', 'D') group by dosen desc ";
			}else{
				$sql = "select * from tbperkuliahan where tahun = '".$tahun."' and sm = '".$semester."'  and substring(kelas, 1, 1) = 'E' group by dosen desc ";
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_sk_bt($kolom,$a,$type, $tahun, $semester, $program){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if($program == 'Reguler'){
				$sql = "select * from tbperkuliahan where dosen not in (select nama from tbbebantugas where tahun ='".$tahun."' and semester ='".$semester."') and tahun = '".$tahun."' and sm = '".$semester."'  and substring(kelas, 1, 1) in ('C', 'S', 'K', 'P', 'B', 'D') group by dosen desc ";
			}else{
				$sql = "select * from tbperkuliahan where dosen not in (select nama from tbbebantugas where tahun ='".$tahun."' and semester ='".$semester."') and tahun = '".$tahun."' and sm = '".$semester."'  and substring(kelas, 1, 1) = 'E' group by dosen desc ";
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_sk_bt2($kolom,$a,$type, $tahun, $semester, $program){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			
				$sql = "select * from tbperkuliahan where dosen not in (select nama from tbbebantugas where tahun ='".$tahun."' and semester ='".$semester."') and tahun = '".$tahun."' and sm = '".$semester."'  group by dosen desc ";
			
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_jadwal_all($kolom,$a,$type, $jurusan, $program, $hari, $tahun, $semester){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if($hari != 'SEMUA'){
				if($program == 'Reguler'){
					if($jurusan == 'AKUNTANSI'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'D' and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}elseif($jurusan == 'IESP'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'B' and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) in ('C', 'S', 'K', 'P') and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}else{
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) in ('C', 'S', 'K', 'P', 'B', 'D') and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}
				}else{
					if($jurusan == 'AKUNTANSI'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and substring(kelas, 2, 1)%2 = 0 and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and substring(kelas, 2, 1)%2 <> 0 and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}elseif($jurusan == 'IESP'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}else{
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and hari = '".$hari."' and tahun = '".$tahun."' and sm = '".$semester."'";
					}
				}
			}else{
				if($program == 'Reguler'){
					if($jurusan == 'AKUNTANSI'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'D' and tahun = '".$tahun."' and sm = '".$semester."' and hari = '".$hari."'";
					}elseif($jurusan == 'IESP'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'B'and tahun = '".$tahun."' and sm = '".$semester."' and hari = '".$hari."'";
					}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) in ('C', 'S', 'K', 'P') and tahun = '".$tahun."' and sm = '".$semester."' and hari = '".$hari."'";
					}else{
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) in ('C', 'S', 'K', 'P', 'B', 'D') and tahun = '".$tahun."' and sm = '".$semester."'";
					}
				}else{
					if($jurusan == 'AKUNTANSI'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and substring(kelas, 2, 1)%2 = 0 and tahun = '".$tahun."' and sm = '".$semester."' and hari = '".$hari."'";
					}elseif($jurusan == 'MANAJEMEN'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and substring(kelas, 2, 1)%2 <> 0 and tahun = '".$tahun."' and sm = '".$semester."' and hari = '".$hari."'";
					}elseif($jurusan == 'IESP'){
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and tahun = '".$tahun."' and sm = '".$semester."'";
					}else{
						$sql = "select * from tbperkuliahan where substring(kelas, 1, 1) = 'E' and tahun = '".$tahun."' and sm = '".$semester."'";
					}
				}
			}
			//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_all_tahun($kolom,$a,$type, $id){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select tahun from tbperkuliahan group by tahun asc";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_all_hari($kolom,$a,$type, $id){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select hari from tbperkuliahan group by hari asc";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_data_jadwal_detil($kolom,$a,$type, $id){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbperkuliahandetil where idmatakuliah = '".$id."' order by pertemuan asc";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_jadwal_dosen($kolom,$a,$type, $semester, $tahun){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbperkuliahan where sm = '".$semester."' and tahun = '".$tahun."' group by dosen";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_jadwal_desc($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbperkuliahan group by idmatakuliah desc";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_jadwal($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbperkuliahan";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_data_matkul($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbmatakuliah";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_sap_single_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "select * from tbperkuliahandetil where id='".$id."'";
			echo $nama;
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_jadwal_single_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "select * from tbperkuliahan where id='".$id."'";
			//echo $sql;
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_jadwal_single_by_idmat($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "select * from tbperkuliahan where idmatakuliah ='".$id."'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
				
		function delete_detil_jadwal($id){
		    $sql = "delete from tbperkuliahandetil where id = '".$id."'";
		    $this->query = $this-> execute($sql,''); 
		}
		function delete_jadwal($id){
		    $sql = "delete from tbperkuliahan where id = '".$id."'";
		    $this->query = $this-> execute($sql,''); 
		}
		
		function add_jadwal($idmatakuliah, $matakuliah, $dosen, $sks, $semester, $jurusan, $kelas, $hari, $ruang, $waktu, $sm, $tahun){
		    $sql = "insert into tbperkuliahan (idmatakuliah, matakuliah, dosen, sks, semester, jurusan, kelas, hari, ruang, waktu, sm, tahun) values ('".$idmatakuliah."', '".$matakuliah."', '".$dosen."', '".$sks."', '".$semester."', '".$jurusan."', '".$kelas."', '".$hari."', '".$ruang."', '".$waktu."', '".$sm."', '".$tahun."')";
		    $this->query = $this-> execute($sql,''); 
		}
		function add_jadwal_detil($idmatakuliah, $pertemuan, $pokokbahasan, $subpokokbahasan){
		    $sql = "insert into tbperkuliahandetil (idmatakuliah, pertemuan, pokokbahasan, subpokokbahasan) values  ('".$idmatakuliah."', '".$pertemuan."', '".$pokokbahasan."', '".$subpokokbahasan."')";
		    $this->query = $this-> execute($sql,''); 
		}
		function edit_jadwal($id, $idmatakuliah, $matakuliah, $dosen, $sks, $semester, $jurusan, $kelas, $hari, $ruang, $waktu, $sm, $tahun){
		    $sql = "update tbperkuliahan set idmatakuliah = '".$idmatakuliah."', matakuliah= '".$matakuliah."', dosen = '".$dosen."', sks='".$sks."', semester='".$semester."', jurusan='".$jurusan."', kelas='".$kelas."', hari='".$hari."', ruang='".$ruang."', waktu='".$waktu."', sm='".$sm."', tahun='".$tahun."' where id ='".$id."'";
		    $this->query = $this-> execute($sql,''); 
		}
		function edit_detil_jadwal($id, $pertemuan, $pokokbahasan, $subpokokbahasan){
		    $sql = "update tbperkuliahandetil set pertemuan = '".$pertemuan."', pokokbahasan = '".$pokokbahasan."', subpokokbahasan = '".$subpokokbahasan."' where id ='".$id."'";
		    $this->query = $this-> execute($sql,''); 
		}
		function delete_beban($id){
		    $sql = "delete from tbbebantugas where id = '".$id."'";
		    $this->query = $this-> execute($sql,''); 
		}
		function edit_nama_matakuliah($sandi, $baru){
		    $sql = "update tbperkuliahan set matakuliah = '".$baru."' where idmatakuliah ='".$sandi."'";
		    //echo $sql;
			$this->query = $this-> execute($sql,''); 
		}		
	}
?>