<?php
class AppVerifikasi extends Database {

	protected $mSqlFile= 'module/verifikasi/business/appverifikasi.sql.php';

	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
	
	function GetCountDataMahasiswa($prodi,$notesNim,$notesNim,$nama,$status_reg,$status_mhs,$status_byr){
      $result = $this->Open($this->mSqlQueries['get_count_data_mahasiswa'], array('%'.$prodi.'%','%'.$nama.'%','%'.$status_reg.'%','%'.$status_mhs.'%','%'.$status_byr.'%','%'.$notesNim.'%','%'.$notesNim.'%'));
	   //print($this->GetLastError());
      if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
   }
	
   function GetDataMahasiswa($prodi,$notesNim,$notesNim,$nama,$status_reg,$status_mhs,$status_byr,$offset,$limit){
      $result = $this->Open($this->mSqlQueries['get_data_mahasiswa'], array('%'.$prodi.'%', '%'.$nama.'%','%'.$status_reg.'%','%'.$status_mhs.'%','%'.$status_byr.'%','%'.$notesNim.'%', '%'.$notesNim.'%', $offset,$limit));
      //print($this->GetLastError());
      return $result;
   }
   
   function GetDataTahunMasuk() {
      $tahun = date("Y");
      $awal = $tahun-10;
      $akhir = $tahun+10;
      $cnt = 0;
      while ($akhir >= $awal) {
         $tmp = $akhir + 1;
         $result_array[$cnt][id] = $akhir;
         $result_array[$cnt][name] = $akhir.'/'.$tmp;
         $akhir--;
         $cnt++;
      }
      return $result_array;
   }
	
   function GetDataProdi(){
      $result=$this->Open($this->mSqlQueries['get_data_prodi'], array());
      return $result;
   }
	
   function GetDataProdiById($idProdi){
      $result=$this->Open($this->mSqlQueries['get_data_prodi_by_id'], array($idProdi));
      return $result;
   }
	
   function GetPeriodeAktif(){
      $result=$this->Open($this->mSqlQueries['get_periode_aktif'], array());
      return $result;
   }

   function GetNim($mhs_id){
      $result=$this->Open($this->mSqlQueries['get_nim'], array($mhs_id));
      return $result;
   }
   
   function GetStatusRegistrasi(){
      $dataStatusReg[0]['id']="S";
      $dataStatusReg[0]['name']="Sudah";
      $dataStatusReg[1]['id']="B";
      $dataStatusReg[1]['name']="Belum";      
      return $dataStatusReg;
   }
   
   function GetStatusMahasiswa(){
      $dataStatusMhs[0]['id']="0";
      $dataStatusMhs[0]['name']="Mahasiswa";
      $dataStatusMhs[1]['id']="1";
      $dataStatusMhs[1]['name']="Calon Mahasiswa";      
      return $dataStatusMhs;
   }
   
   //combo status bayar
   function GetStatusBayar(){
      $statusBayar[0]['id']="BB";
      $statusBayar[0]['name']="Belum Bayar";
      $statusBayar[1]['id']="BL";
      $statusBayar[1]['name']="Belum Lunas";
      $statusBayar[2]['id']="LN";
      $statusBayar[2]['name']="Lunas";
      return $statusBayar;
   }
   
//===DO===
   function DoUpdateMahasiswaIsCalon($id){
      $result=$this->Execute($this->mSqlQueries['do_update_mahasiswa_is_calon'],array($id));
		#print($this->GetLastError());
      return $result;
   }

   function DoUpdateIsSent($mhs_id) {
      $result=$this->Execute($this->mSqlQueries['do_update_is_sent'], array($mhs_id));
      #print($this->GetLastError());
      return $result;
   }
   
   
   function getSettPembayaran(){
   		$result = $this->Open($this->mSqlQueries['get_sett_pembayaran'],array());
   		return $result[0]['IS_AKTIF'];
   }
}
?>
