<?php
class AppMahasiswaToFinansi extends Database{
	protected $mSqlFile= 'module/mahasiswa/business/appmahasiswatofinansi.sql.php';
	function __construct($connectionNumber=3) {
		parent::__construct($connectionNumber);
		
	}
   
   function GetProdiId($prodiKode){
      $result=$this->Open($this->mSqlQueries['get_prodi_id'],array($prodiKode));
      return $result;
   }  
   
   function GetPeriodeId($tahunPeriode,$periodeNamaId){
      $result=$this->Open($this->mSqlQueries['get_periode_id'],array($tahunPeriode,$periodeNamaId));
      return $result;
   }
   
   function GetIdJalur($namaJalur){
      $result=$this->Open($this->mSqlQueries['get_id_jalur'],array($namaJalur));
      if(empty($result))
         $result[0]['jalur_id']=NULL;
      return $result;   
   }
   
   function CekPeriodeAktif($namaPeriode,$tahunPeriode){
      $result=$this->Open($this->mSqlQueries['cek_periode_aktif'],array($namaPeriode,$tahunPeriode));
      //print($this->GetLastError());
      return $result[0]['total'];
   }
   
   function DoImportMahasiswa($mhsId,$mhsNim,$mhsNoTest,$mhsNama,$mhsProdi,$mhsAngkatan,$mhsGelDfatar,$mhsJlrId,$mhsPeriodeId,$mhsUser){
      if (empty($mhsNim)) {
         $mhsNim = null;
      }
      $result=$this->Execute($this->mSqlQueries['do_import_mahasiswa'],array($mhsId,
                                                                            $mhsNim,
                                                                            $mhsNoTest,
                                                                            $mhsNama,
                                                                            $mhsProdi,
                                                                            $mhsAngkatan,
                                                                            $mhsGelDfatar,
                                                                            $mhsJlrId,
                                                                            $mhsPeriodeId,
                                                                            /*$mhsUser*/));
                                                                           //print($this->GetLastError());exit;
      return $result;
   }   
   
   function DoAddMahasiswa($mhsId,$mhsNoTest,$mhsNama,$mhsProdi,$mhsAngkatan,$mhsGelDfatar,$mhsJalur,$mhsPeriode,$mhsUser,$stat_klrg_finansi){

      $result=$this->Execute($this->mSqlQueries['do_add_mahasiswa'],array($mhsId,
                                                                         $mhsNoTest,
                                                                         $mhsNama,
                                                                         $mhsProdi,
                                                                         $mhsAngkatan,
                                                                         $mhsGelDfatar,
                                                                         $mhsJalur,
                                                                         $mhsPeriode,
                                                                         $stat_klrg_finansi
                                                                         /*$mhsUser*/));
      //print_r($this->GetLastError());
      return $result;
   }
   
   function DoUpdateMahasiswa($mhsNoTest,$mhsNama,$mhsProdi,$mhsAngkatan,$gelDftr,$mhsJalur,$mhsPeriode,$mhsUser,$oldId,$stat_klrg_finansi){
      $result=$this->Execute($this->mSqlQueries['do_update_mahasiswa'],array(
                                                                            $mhsNoTest,
                                                                            $mhsNama,
                                                                            $mhsProdi,
                                                                            $mhsAngkatan,
                                                                            $gelDftr,
                                                                            $mhsJalur,
                                                                            $mhsPeriode,
                                                                            $mhsUser,
                                                                            $stat_klrg_finansi,
                                                                            $oldId));
      //print($this->GetLastError());exit;
      return $result;
   }
   
   function DoDeleteMahasiswaById($idMhs){
      $result=$this->Execute($this->mSqlQueries['do_delete_mahasiswa_by_id'],array($idMhs));
      #print($this->GetLastError());
      return $result;
   }
   
   function DoDeleteMahasiswaByArrayId($arrIdMhs){
      $idMhs = implode("', '", $arrIdMhs);
      $result=$this->Execute($this->mSqlQueries['do_delete_mahasiswa_by_array_id'],array($idMhs));
      return $result;
   }  
   
   function DoImportFormUm($arrData){
      $result=$this->Execute($this->mSqlQueries['import_form_um'],$arrData);
      #print($this->GetLastError());
      return $result;
   }
}
?>