<?php 
	class DataSKK extends mysql{
		
		function get_skk_single_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbskk WHERE idMhs ='".$id."' 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_rekap($kolom,$a,$type, $tahun, $jurusan, $semester){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			if ($jurusan == "" and $semester == "" and $tahun != ""){
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk where tahunAkademik= '".$tahun."'";
			}elseif ($jurusan != "" and $semester == "" and $tahun != ""){
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk where tahunAkademik= '".$tahun."' and substr(NPM, 3,2) = '".$jurusan."'";
			}elseif ($jurusan == "" and $semester != "" and $tahun != ""){
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk where tahunAkademik= '".$tahun."' and semester = '".$semester."'";
			}elseif ($jurusan != "" and $semester == "" and $tahun == ""){
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk where substr(NPM, 3,2) = '".$jurusan."'";
			}elseif ($jurusan != "" and $semester != "" and $tahun == ""){
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk where semester = '".$semester."' and substr(NPM, 3,2) = '".$jurusan."'";
			}elseif ($jurusan == "" and $semester != "" and $tahun == ""){
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk where semester = '".$semester."'";
			}elseif ($jurusan != "" and $semester != "" and $tahun != ""){
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk where semester = '".$semester."' and substr(NPM, 3,2) = '".$jurusan."' and tahunAkademik= '".$tahun."'";
			}else{
				$sql = "select NPM, Nama, SMT, total, semester, tahunAkademik from tbskk";
				}
//echo $sql;
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function get_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbskk";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_all_id($kolom,$a,$type, $id){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "select * from tbskk WHERE NPM ='".$id."'";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}

		function simpan($idMhs, $Nama, $NPM, $SMT, $Latdis, $Ospek, $Kerbaksos, $StadiumGeneral, $BSM, $PdJur, $PdRegional, $PdNasional, $PdInternasional, $MnJur, $MnRegional, $MnNasional, $MnInternasional, $PmJur, $PmRegional, $PmNasional, $PmInternational, $JurKetua, $JurWakil, $JurSek, $JurBen, $JurAng, $RegKetua, $RegWakil, $RegSek, $RegBen, $RegAng, $NasKetua, $NasWakil, $NasSek, $NasBen, $NasAng, $IntKetua, $IntWakil, $IntSek, $IntBen, $IntAng, $Wajib, $LainJur, $LainReg, $LainNas, $LainInt, $total, $semester, $tahunAkademik){
			  $sql = "insert into tbskk (idMhs, Nama, NPM, SMT, Latdis, Ospek, Kerbaksos, StadiumGeneral, BSM, PdJur, PdRegional, PdNasional, PdInternasional, MnJur, MnRegional, MnNasional, MnInternasional, PmJur, PmRegional, PmNasional, PmInternational, JurKetua, JurWakil, JurSek, JurBen, JurAng, RegKetua, RegWakil, RegSek, RegBen, RegAng, NasKetua, NasWakil, NasSek, NasBen, NasAng, IntKetua, IntWakil, IntSek, IntBen, IntAng, Wajib, LainJur, LainReg, LainNas, LainInt, total, semester, tahunAkademik) values ('".$idMhs."', '".$Nama."', '".$NPM."', '".$SMT."', '".$Latdis."', '".$Ospek."', '".$Kerbaksos."', '".$StadiumGeneral."', '".$BSM."', '".$PdJur."', '".$PdRegional."', '".$PdNasional."', '".$PdInternasional."', '".$MnJur."', '".$MnRegional."', '".$MnNasional."', '".$MnInternasional."', '".$PmJur."', '".$PmRegional."', '".$PmNasional."', '".$PmInternational."', '".$JurKetua."', '".$JurWakil."', '".$JurSek."', '".$JurBen."', '".$JurAng."', '".$RegKetua."', '".$RegWakil."', '".$RegSek."', '".$RegBen."', '".$RegAng."', '".$NasKetua."', '".$NasWakil."', '".$NasSek."', '".$NasBen."', '".$NasAng."', '".$IntKetua."', '".$IntWakil."', '".$IntSek."', '".$IntBen."', '".$IntAng."', '".$Wajib."', '".$LainJur."', '".$LainReg."', '".$LainNas."', '".$LainInt."', '".$total."', '".$semester."', '".$tahunAkademik."')";
			  $this->query = $this-> execute($sql,''); 
		}
		function edit($idMhs, $Latdis, $Ospek, $Kerbaksos, $StadiumGeneral, $BSM, $PdJur, $PdRegional, $PdNasional, $PdInternasional, $MnJur, $MnRegional, $MnNasional, $MnInternasional, $PmJur, $PmRegional, $PmNasional, $PmInternational, $JurKetua, $JurWakil, $JurSek, $JurBen, $JurAng, $RegKetua, $RegWakil, $RegSek, $RegBen, $RegAng, $NasKetua, $NasWakil, $NasSek, $NasBen, $NasAng, $IntKetua, $IntWakil, $IntSek, $IntBen, $IntAng, $Wajib, $LainJur, $LainReg, $LainNas, $LainInt, $total, $semester, $tahunAkademik){
			  $sql = "update tbskk set Latdis = '".$Latdis."', Ospek='".$Ospek."', Kerbaksos='".$Kerbaksos."', StadiumGeneral='".$StadiumGeneral."', BSM='".$BSM."', PdJur = '".$PdJur."', PdRegional='".$PdRegional."', PdNasional='".$PdNasional."', PdInternasional='".$PdInternasional."', MnJur='".$MnJur."', MnRegional='".$MnRegional."', MnNasional='".$MnNasional."', MnInternasional='".$MnInternasional."', PmJur='".$PmJur."', PmRegional='".$PmRegional."', PmNasional='".$PmNasional."', PmInternational='".$PmInternational."', JurKetua='".$JurKetua."', JurWakil='".$JurWakil."', JurSek='".$JurSek."', JurBen='".$JurBen."', JurAng='".$JurAng."', RegKetua='".$RegKetua."', RegWakil='".$RegWakil."', RegSek='".$RegSek."', RegBen='".$RegBen."', RegAng='".$RegAng."', NasKetua='".$NasKetua."', NasWakil='".$NasWakil."', NasSek='".$NasSek."', NasBen='".$NasBen."', NasAng='".$NasAng."', IntKetua='".$IntKetua."', IntWakil='".$IntWakil."', IntSek='".$IntSek."', IntBen='".$IntBen."', IntAng='".$IntAng."', Wajib='".$Wajib."', LainJur='".$LainJur."', LainReg='".$LainReg."', LainNas='".$LainNas."', LainInt='".$LainInt."', total='".$total."', semester = '".$semester."', tahunAkademik = '".$tahunAkademik."' where idMhs = '".$idMhs."'";
			  $this->query = $this-> execute($sql,''); 
		}
		
		
	}
?>