<?php
class AppLaporanKelompokMhs extends Database {

	protected $mSqlFile= 'module/laporan_kelompok_mhs/business/applaporankelompokmhs.sql.php';

	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
	
	function GetPeriodeAktif(){
		$result=$this->Open($this->mSqlQueries['get_periode_aktif'],array());
      	return $result;
	}
	
	function GetDataPeriode(){
		$result=$this->Open($this->mSqlQueries['get_data_periode'], array());
      	return $result;
	}
	
	function getDataComboProdi(){
		$result=$this->Open($this->mSqlQueries['get_data_combo_prodi'], array());
      	return $result;
	}
	
	function getDataCheckStatusKeluarga(){
		$result =$this->Open($this->mSqlQueries['get_data_checkbox_status_keluarga'], array());		
      	return $result;
	}
	
	function getCountDataSearch($periodeSelected,$prodiSelected,$statusKeluarga){				
		
		if($periodeSelected == '') $periodeSelected = '%%';
		if($prodiSelected == '') $prodiSelected = '%%';
		
		if($statusKeluarga == ''){
			//$statusKeluarga = '0';	
			$result =$this->Open($this->mSqlQueries['get_count_data_search_no_status'], array($periodeSelected,$prodiSelected));
		}else{
			//$statusKeluarga = "AND mhsStsKlrgastsKlrgaId IN (".$statusKeluarga.")";			
			$result =$this->Open($this->mSqlQueries['get_count_data_search_with_status'], array($periodeSelected,$prodiSelected,$statusKeluarga));
			//print($this->GetLastError()); exit;
		}
		
		//$result =$this->Open($this->mSqlQueries['get_count_data_search'], array($periodeSelected,$prodiSelected,$statusKeluarga));		
		
		if (!$result) {
			return 0;
		} else {
			return count($result);
		}      	
	}
	
	function getDataSearch($periodeSelected,$prodiSelected,$statusKeluarga,$startRec,$itemViewed){
		if($periodeSelected == '') $periodeSelected = '%%';
		if($prodiSelected == '') $prodiSelected = '%%';
		if($statusKeluarga == ''){		
			$result =$this->Open($this->mSqlQueries['get_data_search_no_status'], array($periodeSelected,$prodiSelected,$startRec,$itemViewed));
		}else{			
			$result =$this->Open($this->mSqlQueries['get_data_search_with_status'], array($periodeSelected,$prodiSelected,$statusKeluarga,$startRec,$itemViewed));			
		}
		
		//$result =$this->Open($this->mSqlQueries['get_data_search'], array($periodeSelected,$prodiSelected,$statusKeluarga,$startRec,$itemViewed));	
		
		return $result;		
	}
}
?>