<?php 
	class DataSurat extends mysql{
		function get_ket_lulus_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbketeranganlulus";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_aktif_kuliah_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbaktifkuliah";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_keterangan_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbketerangankuliah";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_skripsi_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbskripsi";
			echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_ijinuas_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbijinuas";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_ijinuas_by_id($kolom, $id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbijinuas 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_ketlulus_by_id($kolom, $id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbketeranganlulus 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_aktif_kuliah_by_id($kolom, $id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbaktifkuliah 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_keterangan_by_id($kolom, $id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbketerangankuliah 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_susulan_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbujiansusulan";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_susulan_by_id($kolom, $id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbujiansusulan 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_aktifkuliah_id($kolom){
			if($this->cek_result != "on"){
			$sql = "SELECT id FROM tbaktifkuliah order by id desc limit 0,1";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_lulus_id($kolom){
			if($this->cek_result != "on"){
			$sql = "SELECT id FROM tbketeranganlulus order by id desc limit 0,1";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_keterangan_id($kolom){
			if($this->cek_result != "on"){
			$sql = "SELECT id FROM tbketerangankuliah order by id desc limit 0,1";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_ijinuas_id($kolom){
			if($this->cek_result != "on"){
			$sql = "SELECT id FROM tbijinuas order by id desc limit 0,1";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_susulan_id($kolom){
			if($this->cek_result != "on"){
			$sql = "SELECT id FROM tbujiansusulan order by id desc limit 0,1";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		function get_cuti_all($kolom,$a,$type, $awal, $akhir){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbcuti where tglawal >= '".$awal."' and tglawal <= '".$akhir."'";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_cuti_id($kolom,$nip){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbcuti WHERE nipdosen ='".$nip."' 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_cuti_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbcuti 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 add_cuti($dosen, $nipdosen, $atasan, $nipatasan, $tglawal, $tglakhir, $alasan, $cuti){
			  $sql = "insert into tbcuti (dosen,nipdosen, atasan, nipatasan, tglawal, tglakhir, alasan, cuti) values  ('".$dosen."','".$nipdosen."', '".$atasan."', '".$nipatasan."', '".$tglawal."', '".$tglakhir."', '".$alasan."', '".$cuti."')";
			  $this->query = $this-> execute($sql,''); 
		}
		function add_ujian_susulan($dosen, $nik, $pekerjaan, $sandimk, $matakuliah, $nama, $npm, $smt, $alamat, $semester, $tahun, $alasan, $tanggal, $nilai, $nomer){
			  $sql = "insert into tbujiansusulan (dosen, nik, pekerjaan, sandimk, matakuliah, nama, npm, smt, alamat, semester, tahun, alasan, tanggal, nilai, nomer) values  ('".$dosen."','".$nik."', '".$pekerjaan."', '".$sandimk."', '".$matakuliah."', '".$nama."', '".$npm."', '".$smt."', '".$alamat."', '".$semester."', '".$tahun."', '".$alasan."', '".$tanggal."', '".$nilai."', '".$nomer."')";
			  $this->query = $this-> execute($sql,''); 
		}
		function add_ijin_uas($nomer, $perihal, $matakuliah, $nama, $npm, $smt, $alasan, $surat){
			  $sql = "insert into tbijinuas (nomer, perihal, matakuliah, nama, npm, smt, alasan, surat) values ('".$nomer."','".$perihal."', '".$matakuliah."', '".$nama."', '".$npm."', '".$smt."', '".$alasan."', '".$surat."')";
			  $this->query = $this-> execute($sql,''); 
		}
		function add_surat_keterangan($nomer, $nama, $npm, $tahun, $tanggal, $ijazah){
			  $sql = "insert into tbketerangankuliah (nomer, nama, npm, tahun, tanggal, ijazah) values ('".$nomer."','".$nama."', '".$npm."', '".$tahun."', '".$tanggal."', '".$ijazah."')";
			 //echo $sql;
			  $this->query = $this-> execute($sql,''); 
		}
		function add_surat_keterangan_aktif($nomer, $nama, $npm, $tahun, $semester){
			  $sql = "insert into tbaktifkuliah (nomer, nama, npm, tahun, semester) values ('".$nomer."','".$nama."', '".$npm."', '".$tahun."', '".$semester."')";
			 //echo $sql;
			  $this->query = $this-> execute($sql,''); 
		}
		function add_surat_keterangan_lulus($nomer, $nama, $npm, $judul, $hari, $tanggal, $tempat, $tanggalwisuda){
			  $sql = "insert into tbketeranganlulus (nomer, nama, npm, judul, hari, tanggal, tempat, tanggalwisuda) values ('".$nomer."','".$nama."', '".$npm."', '".$judul."', '".$hari."', '".$tanggal."', '".$tempat."', '".$tanggalwisuda."')";
			 //echo $sql;
			  $this->query = $this-> execute($sql,''); 
		}
		function nonaktif_template($id){
			  $sql = "update tbtemplatetransaksi set IsAktif ='0' where NoID ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		function delete_ijin_uas($id){
			  $sql = "delete from tbijinuas where id ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		function delete_keterangan_lulus($id){
			  $sql = "delete from tbketeranganlulus where id ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		function delete_keterangan_kuliah($id){
			  $sql = "delete from tbketerangankuliah where id ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		function delete_aktif_kuliah($id){
			  $sql = "delete from tbaktifkuliah where id ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		function delete_ujian_susulan($id){
			  $sql = "delete from tbujiansusulan where id ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		function delete_ijin_cuti($id){
			  $sql = "delete from tbcuti where id ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		
	}
?>