<?php
/*
Author : Nikolius
Email : n1colius.lau@gmail.com
Date : 27-Jul-2015 04:49 PM
*/
require_once $cfg->mValue['docroot'] . "module/sia_setting/business/sia_setting.class.php";

class Apps_sync_awal extends SiaSetting {

   var $config;

   function Apps_sync_awal(&$configObject, $dataProceed) {
      SiaSetting::SiaSetting($configObject, $dataProceed);
      $this->AppendSqlQueries("module/apps_sync_awal/business/apps_sync_awal.sql.php");
      $this->config = &$configObject;
   }

   function getStatusProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $status = $this->GetAllDataAsArray($this->mSqlQueries['getStatusProses'], array($dataParam['idProses']));
      return $status[0]['statusNya'];
   }

   function dbName(){
      return $this->GetAllDataAsArray($this->mSqlQueries['dbUsed'], array());
   }

   function showCreatedTable(){
      $_dbName = $this->config->GetValue('db_name');
      $sql = $this->mSqlQueries['showCreatedTable'];
      $sql = str_replace("[DB_NAME]", $_dbName, $sql);
      $data = $this->GetAllDataAsArray($sql, array());
      return $data;
   }

   function createTabelFeeder(){
      $dataParam = $this->GetProperty("DataProceed");
      $prosesAll = true;

      // drop table jika perlu
      $sql = 'DROP TABLE IF EXISTS feeder_'.strtolower($dataParam['tipeTabel']).'_'.$dataParam['namaTabel'].';';
      $rs = $this->ExecuteInsertQuery($sql,array());
      if($rs == false) $prosesAll = false;

      // create table
      $sql = 'CREATE TABLE feeder_'.strtolower($dataParam['tipeTabel']).'_'.$dataParam['namaTabel'].' (';

      $tot_col = count($dataParam['descTabel']['result']);
      $last_col = 0;
      $arr_pk = array();

      foreach($dataParam['descTabel']['result'] as $i => $kolom){
         $isFieldNeeded = true;

         //cek apaka field diperlukan
         if($dataParam['namaTabel'] == 'mahasiswa'){
            //yg awalannya regpd tidak diperlukan
            $arrTemp = explode('_', $kolom['column_name']);
            if($arrTemp[0] == 'regpd'){
               $isFieldNeeded = false;
            }
         }

         if($isFieldNeeded == true){
            $tipeData = $this->pemetaanTipeData($kolom['type']);
            $sql .= $kolom['column_name'].' '.$tipeData.' ';

            if($kolom['not_null'] == 1){
               $sql .= 'NOT NULL ';
            }else{
               $sql .= ' ';
            }

            if($kolom['pk'] == 1){
               $arr_pk[] = $kolom['column_name'];
            }else{
               $sql .= ' ';
            }

            $sql .= "COMMENT '".$kolom['desc']."'";
         }

         if($last_col==$tot_col-1){
            if($isFieldNeeded == true){
               $sql .= ",";
            }

            $sql .= " last_update datetime COMMENT 'refer ke last_update dari pddikti', last_sync datetime COMMENT 'refer ke last_sync dari pddikti' ";

            //cek untuk tabel2 yg gt_id nya bukan bigint..
            switch ($dataParam['namaTabel']) {
               case 'ikatan_kerja_dosen':
                  $sql .= ", gt_id char(1) COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
               case 'pangkat_golongan':
                  $sql .= ", gt_id varchar(20) COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
               case 'status_keaktifan_pegawai':
                  $sql .= ", gt_id varchar(20) COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
               case 'jenjang_pendidikan':
                  $sql .= ", gt_id varchar(20) COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
               case 'negara':
                  $sql .= ", gt_id varchar(20) COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
               case 'status_mahasiswa':
                  $sql .= ", gt_id char(1) COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
               case 'wilayah':
                  $sql .= ", gt_id varchar(20) COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
               default:
                  $sql .= ", gt_id bigint COMMENT 'Primary Key dr gtAkademik',gt_last_update datetime COMMENT 'Last Update dr gtAkademik',gt_last_sync datetime COMMENT 'Last Sync ke Feeder' ";
               break;
            }
         }else{
            if($isFieldNeeded == true){
               $sql .= ',';
            }
         }
         $last_col++;
      }

      //tambahan field tambahan khusus tabel dengan tipe data
      if(strtolower($dataParam['tipeTabel']) == "data"){
         $sql .= " , status_crawl enum('none','insert','update','delete') NOT NULL DEFAULT 'none' , status_proses_dikti enum('none','sukses','gagal') NOT NULL DEFAULT 'none', `status_data` enum('default','not_active','skip') NOT NULL DEFAULT 'default', `error_code` SMALLINT NULL, `error_desc` TEXT NULL ";
      }

      if (!empty($arr_pk)) {
         $sql_pk = implode(',', $arr_pk);
         $sql .= ', PRIMARY KEY ('.$sql_pk.')';

         //key tambahan untuk tabel tertentu
         switch ($dataParam['namaTabel']) {
            case 'wilayah':
               $sql .= ', KEY `key_id_level_wil` (`id_level_wil`)';
            break;
            case 'kurikulum':
               $sql .= ', KEY `key_nm_kurikulum_sp` (`nm_kurikulum_sp`), KEY `key_id_sms` (`id_sms`), KEY `key_id_jenj_didik` (`id_jenj_didik`)';
            break;
            case 'jenjang_pendidikan':
               $sql .= ', KEY `key_nm_jenj_didik` (`nm_jenj_didik`)';
            break;
            case 'sms':
               $sql .= ', KEY `key_kode_prodi` (`kode_prodi`)';
            break;
            case 'mata_kuliah':
               $sql .= ', KEY `key_kode_mk` (`kode_mk`), KEY `key_nm_mk` (`nm_mk`), KEY `key_id_sms` (`id_sms`)';
            break;
            case 'mata_kuliah_kurikulum':
               $sql .= ', KEY `key_id_kurikulum_sp` (`id_kurikulum_sp`), KEY `key_id_mk` (`id_mk`)';
            break;
            case 'mahasiswa':
               $sql .= ', KEY `key_nm_pd` (`nm_pd`), KEY `key_tgl_lahir` (`tgl_lahir`), KEY `key_jk` (`jk`)';
            break;
            case 'kelas_kuliah':
               $sql .= ', KEY `key_id_smt` (`id_smt`), KEY `key_id_mk` (`id_mk`), KEY `key_nm_kls` (`nm_kls`)';
            break;
            case 'mahasiswa_pt':
               $sql .= ', KEY `key_1` (`nipd`), KEY `key_id_pd` (`id_pd`)';
            break;
            case 'dosen':
               $sql .= ', KEY `key_nidn` (`nidn`)';
            break;
            case 'dosen_pt':
               $sql .= ', KEY `key_id_ptk` (`id_ptk`), KEY `key_id_thn_ajaran` (`id_thn_ajaran`)';
            break;
            case 'ajar_dosen':
               $sql .= ', KEY `key_id_reg_ptk` (`id_reg_ptk`), KEY `key_id_kls` (`id_kls`)';
            break;
            case 'kuliah_mahasiswa':
               $sql .= ', KEY `key_id_smt` (`id_smt`), KEY `key_id_reg_pd` (`id_reg_pd`)';
            break;
            case 'nilai':
               $sql .= ', KEY `key_id_kls` (`id_kls`), KEY `key_id_reg_pd` (`id_reg_pd`)';
            break;
         }

         //tambahan key untuk semua field gt_id disemua tabel
         $sql .= ', KEY `key_gt_id` (`gt_id`)';
      }
      $sql .= ');';
      //return $sql;

      $rs = $this->ExecuteInsertQuery($sql,array());
      if($rs == false) $prosesAll = false;
      return $prosesAll;
   }

   function pemetaanTipeData($tipeData){
      $tipeDataEx = explode('(',$tipeData);
      if($tipeDataEx[0] == 'character varying'){
         return 'VARCHAR('.$tipeDataEx[1];
      }elseif($tipeDataEx[0] == 'character'){
         return 'CHAR('.$tipeDataEx[1];
      }elseif($tipeDataEx[0] == 'numeric'){
         return 'DECIMAL ('.$tipeDataEx[1];
      }elseif($tipeDataEx[0] == 'uuid'){
         return 'VARCHAR(36)';
      }elseif($tipeDataEx[0] == 'double precision'){
         return 'DOUBLE';
      }else{
         return $tipeData;
      }
   }

   function copyTabelRowCopyingAgama(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      //ketika copy data.. gt_id nya sudah dicari terlebih dahulu
      for ($i=0; $i < count($dataParam); $i++) {
         $dataAgamaId = $this->GetAllDataAsArray($this->mSqlQueries['getDataAgamaId'], array($dataParam[$i]['nm_agama']));
         $gt_id = $dataAgamaId[0]['agmrId'];

         $p = array(
            $dataParam[$i]['id_agama'],
            $dataParam[$i]['nm_agama'],
            $gt_id,$gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertAgama'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingBentukPendidikan(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_bp'],
            $dataParam[$i]['nm_bp'],
            $dataParam[$i]['a_jenj_paud'],
            $dataParam[$i]['a_jenj_tk'],
            $dataParam[$i]['a_jenj_sd'],
            $dataParam[$i]['a_jenj_smp'],
            $dataParam[$i]['a_jenj_sma'],
            $dataParam[$i]['a_jenj_tinggi'],
            $dataParam[$i]['dir_bina'],
            $dataParam[$i]['a_aktif']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertBentukPendidikan'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingIktKerjaDosen(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataIdIktKerjaDosen'], array($dataParam[$i]['nm_ikatan_kerja']));
         $gt_id = $dataId[0]['sikjKode'];

         $p = array(
            $dataParam[$i]['id_ikatan_kerja'],
            $dataParam[$i]['nm_ikatan_kerja'],
            $dataParam[$i]['ket_ikatan_kerja'],
            $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertIktKerjaDosen'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJabfung(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jabfung'],
            $dataParam[$i]['nm_jabfung']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJabfung'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJnsEvaluasi(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jns_eval'],
            $dataParam[$i]['nm_jns_eval'],
            $dataParam[$i]['ket_jns_eval']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJnsEvaluasi'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJnsKeluar(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jns_keluar'],
            $dataParam[$i]['ket_keluar'],
            $dataParam[$i]['a_pd'],
            $dataParam[$i]['a_ptk']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJnsKeluar'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJnsPendaftaran(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jns_daftar'],
            $dataParam[$i]['nm_jns_daftar'],
            $dataParam[$i]['u_daftar_sekolah'],
            $dataParam[$i]['u_daftar_rombel']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJnsPendaftaran'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJnsSert(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jns_sert'],
            $dataParam[$i]['id_kk'],
            $dataParam[$i]['nm_jns_sert'],
            $dataParam[$i]['u_prof_guru'],
            $dataParam[$i]['u_kepsek'],
            $dataParam[$i]['u_laboran'],
            $dataParam[$i]['u_prof_dosen']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJnsSert'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJnsSms(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jns_sms'],
            $dataParam[$i]['nm_jns_sms']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJnsSms'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJnsSubst(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jns_subst'],
            $dataParam[$i]['nm_jns_subst']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJnsSubst'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJenjangPend(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataJenjangPendId'], array($dataParam[$i]['nm_jenj_didik']));
         $gt_id = $dataId[0]['jjarKode'];

         $p = array(
            $dataParam[$i]['id_jenj_didik'],
            $dataParam[$i]['nm_jenj_didik'],
            $dataParam[$i]['u_jenj_lemb'],
            $dataParam[$i]['u_jenj_org'],
            $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJenjangPend'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingJurusan(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_jur'],
            $dataParam[$i]['nm_jur'],
            $dataParam[$i]['nm_intl_jur'],
            $dataParam[$i]['u_sma'],
            $dataParam[$i]['u_smk'],
            $dataParam[$i]['u_pt'],
            $dataParam[$i]['u_slb'],
            $dataParam[$i]['id_jenj_didik'],
            $dataParam[$i]['id_induk_jurusan'],
            $dataParam[$i]['id_kel_bidang']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertJurusan'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingKebutuhanKhusus(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_kk'],
            $dataParam[$i]['nm_kk'],
            $dataParam[$i]['a_kk_a'],
            $dataParam[$i]['a_kk_b'],
            $dataParam[$i]['a_kk_c'],
            $dataParam[$i]['a_kk_c1'],
            $dataParam[$i]['a_kk_d'],
            $dataParam[$i]['a_kk_d1'],
            $dataParam[$i]['a_kk_e'],
            $dataParam[$i]['a_kk_f'],
            $dataParam[$i]['a_kk_h'],
            $dataParam[$i]['a_kk_i'],
            $dataParam[$i]['a_kk_j'],
            $dataParam[$i]['a_kk_k'],
            $dataParam[$i]['a_kk_n'],
            $dataParam[$i]['a_kk_o'],
            $dataParam[$i]['a_kk_p'],
            $dataParam[$i]['a_kk_q'],
            $dataParam[$i]['u_lemb'],
            $dataParam[$i]['u_ptk'],
            $dataParam[$i]['u_pd']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertKebutuhanKhusus'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingLembPengangkat(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_lemb_angkat'],
            $dataParam[$i]['nm_lemb_angkat']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertLembPengangkat'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingLvlWilayah(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_level_wil'],
            $dataParam[$i]['nm_level_wilayah']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertLvlWilayah'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingNegara(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataNegaraId'], array($dataParam[$i]['nm_negara']));
         $gt_id = $dataId[0]['negKode'];

         $p = array(
            $dataParam[$i]['id_negara'],
            $dataParam[$i]['nm_negara'],
            $dataParam[$i]['a_ln'],
            $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertNegara'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingPangkatGol(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_pangkat_gol'],
            $dataParam[$i]['kode_gol'],
            $dataParam[$i]['nm_pangkat']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertPangkatGol'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingPekerjaan(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_pekerjaan'],
            $dataParam[$i]['nm_pekerjaan']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertPekerjaan'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingPenghasilan(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_penghasilan'],
            $dataParam[$i]['nm_penghasilan'],
            $dataParam[$i]['batas_bawah'],
            $dataParam[$i]['batas_atas']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertPenghasilan'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingSemester(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_smt'],
            $dataParam[$i]['id_thn_ajaran'],
            $dataParam[$i]['nm_smt'],
            $dataParam[$i]['smt'],
            $dataParam[$i]['a_periode_aktif'],
            $dataParam[$i]['tgl_mulai'],
            $dataParam[$i]['tgl_selesai']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertSemester'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingStsKeaktifanPeg(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_stat_aktif'],
            $dataParam[$i]['nm_stat_aktif']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertStsKeaktifanPeg'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingStsKepeg(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_stat_pegawai'],
            $dataParam[$i]['nm_stat_pegawai']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertStsKepeg'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingStsMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataIdStsMhs'], array($dataParam[$i]['nm_stat_mhs']));
         $gt_id = $dataId[0]['stakmhsrKode'];

         $p = array(
            $dataParam[$i]['id_stat_mhs'],
            $dataParam[$i]['nm_stat_mhs'],
            $dataParam[$i]['ket_stat_mhs'],
            $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertStsMhs'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingThnAjaran(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_thn_ajaran'],
            $dataParam[$i]['nm_thn_ajaran'],
            $dataParam[$i]['a_periode_aktif'],
            $dataParam[$i]['tgl_mulai'],
            $dataParam[$i]['tgl_selesai']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertThnAjaran'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingWilayah(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_wil'],
            $dataParam[$i]['nm_wil'],
            $dataParam[$i]['asal_wil'],
            $dataParam[$i]['kode_bps'],
            $dataParam[$i]['kode_dagri'],
            $dataParam[$i]['kode_keu'],
            $dataParam[$i]['id_induk_wilayah'],
            $dataParam[$i]['id_level_wil'],
            $dataParam[$i]['id_negara']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertWilayah'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      //update gt_id secara teripisah

      //get data negara
      $dataNegara = $this->GetAllDataAsArray($this->mSqlQueries['getDataWilayahNegara'], array());
      $negKode = $dataNegara[0]['negKode'];
      $p = array(
         $negKode
      );
      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateWilayahIdNegara'], $p);

      //get data propinsi
      $dataPropinsi = $this->GetAllDataAsArray($this->mSqlQueries['getDataWilayahPropinsi'], array());
      for ($i=0; $i < count($dataPropinsi); $i++) {
         $p = array(
            $dataPropinsi[$i]['propKode'],
            '%'.$dataPropinsi[$i]['propNama'].'%',
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateWilayahIdPropinsi'], $p);
      }

      //get data kota
      $dataKota = $this->GetAllDataAsArray($this->mSqlQueries['getDataWilayahKota'], array());
      for ($i=0; $i < count($dataKota); $i++) {
         /*$arrTemp = explode(' ',$dataKota[$i]['kotaNama']);
         if(strtoupper(trim($arrTemp[0])) == "KAB."){
            unset($arrTemp[0]);
         }
         $impKota = implode(' ', $arrTemp);*/

         // toleransi like hanya di depan, untuk mengatasi data yg serupa, ex: Kota Padang Sidempuan, Kota Padang, Kota Padang Panjang
         // di query ditambahkan TRIM(nm_wil) karena data asli dari pddikti ada spasi di belakang (format data dgn panjang fixed dgn spasi)
         $p = array(
            $dataKota[$i]['kotaKode'],
            //'%'.trim($impKota).'%'
            //'%'.$dataKota[$i]['kotaNama']/*.'%'*/
            $dataKota[$i]['kotaNama'] // revisi, dibuat sama persis, karena ditemukan data seperti ini, kab. probolinngo dan probolinggo, jika disertai % maka akan ditemukan lebih dari 1 dgn gt_id yg sama
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateWilayahIdKota'], $p);
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingAjarDosen(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_ajar'],
            $dataParam[$i]['id_reg_ptk'],
            $dataParam[$i]['id_subst'],
            $dataParam[$i]['id_kls'],
            $dataParam[$i]['sks_subst_tot'],
            $dataParam[$i]['sks_tm_subst'],
            $dataParam[$i]['sks_prak_subst'],
            $dataParam[$i]['sks_prak_lap_subst'],
            $dataParam[$i]['sks_sim_subst'],
            $dataParam[$i]['jml_tm_renc'],
            $dataParam[$i]['jml_tm_real'],
            $dataParam[$i]['id_jns_eval']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertAjarDosen'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingBobotNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['kode_bobot_nilai'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['nilai_huruf'],
            $dataParam[$i]['bobot_nilai_min'],
            $dataParam[$i]['bobot_nilai_maks'],
            $dataParam[$i]['nilai_indeks'],
            $dataParam[$i]['tgl_mulai_efektif'],
            $dataParam[$i]['tgl_akhir_efektif']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertBobotNilai'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingDayaTampung(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_smt'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['target_mhs_baru'],
            $dataParam[$i]['calon_ikut_seleksi'],
            $dataParam[$i]['calon_lulus_seleksi'],
            $dataParam[$i]['daftar_sbg_mhs'],
            $dataParam[$i]['pst_undur_diri'],
            $dataParam[$i]['tgl_awal_kul'],
            $dataParam[$i]['tgl_akhir_kul'],
            $dataParam[$i]['jml_mgu_kul'],
            $dataParam[$i]['metode_kul'],
            $dataParam[$i]['metode_kul_eks']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertDayaTampung'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingDosen(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_ptk'],
            $dataParam[$i]['id_blob'],
            $dataParam[$i]['id_ikatan_kerja'],
            $dataParam[$i]['nm_ptk'],
            $dataParam[$i]['nidn'],
            $dataParam[$i]['nip'],
            $dataParam[$i]['jk'],
            $dataParam[$i]['tmpt_lahir'],
            $dataParam[$i]['tgl_lahir'],
            $dataParam[$i]['nik'],
            $dataParam[$i]['niy_nigk'],
            $dataParam[$i]['nuptk'],
            $dataParam[$i]['id_stat_pegawai'],
            $dataParam[$i]['id_jns_ptk'],
            $dataParam[$i]['id_bid_pengawas'],
            $dataParam[$i]['id_agama'],
            $dataParam[$i]['jln'],
            $dataParam[$i]['rt'],
            $dataParam[$i]['rw'],
            $dataParam[$i]['nm_dsn'],
            $dataParam[$i]['ds_kel'],
            $dataParam[$i]['id_wil'],
            $dataParam[$i]['kode_pos'],
            $dataParam[$i]['no_tel_rmh'],
            $dataParam[$i]['no_hp'],
            $dataParam[$i]['email'],
            $dataParam[$i]['id_sp'],
            $dataParam[$i]['id_stat_aktif'],
            $dataParam[$i]['sk_cpns'],
            $dataParam[$i]['tgl_sk_cpns'],
            $dataParam[$i]['sk_angkat'],
            $dataParam[$i]['tmt_sk_angkat'],
            $dataParam[$i]['id_lemb_angkat'],
            $dataParam[$i]['id_pangkat_gol'],
            $dataParam[$i]['id_keahlian_lab'],
            $dataParam[$i]['id_sumber_gaji'],
            $dataParam[$i]['nm_ibu_kandung'],
            $dataParam[$i]['stat_kawin'],
            $dataParam[$i]['nm_suami_istri'],
            $dataParam[$i]['nip_suami_istri'],
            $dataParam[$i]['id_pekerjaan_suami_istri'],
            $dataParam[$i]['tmt_pns'],
            $dataParam[$i]['a_lisensi_kepsek'],
            $dataParam[$i]['jml_sekolah_binaan'],
            $dataParam[$i]['a_diklat_awas'],
            $dataParam[$i]['akta_ijin_ajar'],
            $dataParam[$i]['nira'],
            $dataParam[$i]['stat_data'],
            $dataParam[$i]['mampu_handle_kk'],
            $dataParam[$i]['a_braille'],
            $dataParam[$i]['a_bhs_isyarat'],
            $dataParam[$i]['npwp'],
            $dataParam[$i]['kewarganegaraan']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertDosen'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingDosenPt(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_reg_ptk'],
            $dataParam[$i]['id_ptk'],
            $dataParam[$i]['id_sp'],
            $dataParam[$i]['id_thn_ajaran'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['no_srt_tgs'],
            $dataParam[$i]['tgl_srt_tgs'],
            $dataParam[$i]['tmt_srt_tgs'],
            $dataParam[$i]['a_sp_homebase'],
            $dataParam[$i]['a_aktif_bln_1'],
            $dataParam[$i]['a_aktif_bln_2'],
            $dataParam[$i]['a_aktif_bln_3'],
            $dataParam[$i]['a_aktif_bln_4'],
            $dataParam[$i]['a_aktif_bln_5'],
            $dataParam[$i]['a_aktif_bln_6'],
            $dataParam[$i]['a_aktif_bln_7'],
            $dataParam[$i]['a_aktif_bln_8'],
            $dataParam[$i]['a_aktif_bln_9'],
            $dataParam[$i]['a_aktif_bln_10'],
            $dataParam[$i]['a_aktif_bln_11'],
            $dataParam[$i]['a_aktif_bln_12'],
            $dataParam[$i]['id_jns_keluar'],
            $dataParam[$i]['tgl_ptk_keluar']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertDosenPt'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingKuliahMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_smt'],
            $dataParam[$i]['id_reg_pd'],
            $dataParam[$i]['ips'],
            $dataParam[$i]['sks_smt'],
            $dataParam[$i]['ipk'],
            $dataParam[$i]['sks_total'],
            $dataParam[$i]['id_stat_mhs']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertKuliahMhs'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_pd'],
            stripslashes($dataParam[$i]['nm_pd']),
            $dataParam[$i]['jk'],
            $dataParam[$i]['nisn'],
            $dataParam[$i]['nik'],
            stripslashes($dataParam[$i]['tmpt_lahir']),
            $dataParam[$i]['tgl_lahir'],
            $dataParam[$i]['id_agama'],
            $dataParam[$i]['id_kk'],
            $dataParam[$i]['id_sp'],
            $dataParam[$i]['jln'],
            $dataParam[$i]['rt'],
            $dataParam[$i]['rw'],
            $dataParam[$i]['nm_dsn'],
            $dataParam[$i]['ds_kel'],
            $dataParam[$i]['id_wil'],
            $dataParam[$i]['kode_pos'],
            $dataParam[$i]['id_jns_tinggal'],
            $dataParam[$i]['id_alat_transport'],
            $dataParam[$i]['telepon_rumah'],
            $dataParam[$i]['telepon_seluler'],
            $dataParam[$i]['email'],
            $dataParam[$i]['a_terima_kps'],
            $dataParam[$i]['no_kps'],
            $dataParam[$i]['stat_pd'],
            $dataParam[$i]['nm_ayah'],
            $dataParam[$i]['tgl_lahir_ayah'],
            $dataParam[$i]['id_jenjang_pendidikan_ayah'],
            $dataParam[$i]['id_pekerjaan_ayah'],
            $dataParam[$i]['id_penghasilan_ayah'],
            $dataParam[$i]['id_kebutuhan_khusus_ayah'],
            $dataParam[$i]['nm_ibu_kandung'],
            $dataParam[$i]['tgl_lahir_ibu'],
            $dataParam[$i]['id_jenjang_pendidikan_ibu'],
            $dataParam[$i]['id_penghasilan_ibu'],
            $dataParam[$i]['id_pekerjaan_ibu'],
            $dataParam[$i]['id_kebutuhan_khusus_ibu'],
            $dataParam[$i]['nm_wali'],
            $dataParam[$i]['tgl_lahir_wali'],
            $dataParam[$i]['id_jenjang_pendidikan_wali'],
            $dataParam[$i]['id_pekerjaan_wali'],
            $dataParam[$i]['id_penghasilan_wali'],
            $dataParam[$i]['kewarganegaraan']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertMhs'], $p);
         /*
         if($prosesInsert === FALSE){
            echo '<pre>';
            print vsprintf($this->mSqlQueries['insertMhs'], $p);
            exit;
         }
         */

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingMhsPt(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_reg_pd'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['id_pd'],
            $dataParam[$i]['id_sp'],
            $dataParam[$i]['id_jns_daftar'],
            $dataParam[$i]['nipd'],
            $dataParam[$i]['tgl_masuk_sp'],
            $dataParam[$i]['id_jns_keluar'],
            $dataParam[$i]['tgl_keluar'],
            $dataParam[$i]['ket'],
            $dataParam[$i]['skhun'],
            $dataParam[$i]['a_pernah_paud'],
            $dataParam[$i]['a_pernah_tk'],
            $dataParam[$i]['mulai_smt'],
            $dataParam[$i]['sks_diakui'],
            $dataParam[$i]['jalur_skripsi'],
            $dataParam[$i]['judul_skripsi'],
            $dataParam[$i]['bln_awal_bimbingan'],
            $dataParam[$i]['bln_akhir_bimbingan'],
            $dataParam[$i]['sk_yudisium'],
            $dataParam[$i]['tgl_sk_yudisium'],
            $dataParam[$i]['ipk'],
            $dataParam[$i]['no_seri_ijazah'],
            $dataParam[$i]['sert_prof'],
            $dataParam[$i]['a_pindah_mhs_asing'],
            $dataParam[$i]['nm_pt_asal'],
            $dataParam[$i]['nm_prodi_asal']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertMhsPt'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingMatakuliahKurikulum(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_kurikulum_sp'],
            $dataParam[$i]['id_mk'],
            $dataParam[$i]['smt'],
            $dataParam[$i]['sks_mk'],
            $dataParam[$i]['sks_tm'],
            $dataParam[$i]['sks_prak'],
            $dataParam[$i]['sks_prak_lap'],
            $dataParam[$i]['sks_sim'],
            $dataParam[$i]['a_wajib']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertMatakuliahKurikulum'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_ekuivalensi'],
            $dataParam[$i]['id_reg_pd'],
            $dataParam[$i]['id_mk'],
            $dataParam[$i]['kode_mk_asal'],
            $dataParam[$i]['nm_mk_asal'],
            $dataParam[$i]['sks_asal'],
            $dataParam[$i]['sks_diakui'],
            $dataParam[$i]['nilai_huruf_asal'],
            $dataParam[$i]['nilai_huruf_diakui'],
            $dataParam[$i]['nilai_angka_diakui'],
            $dataParam[$i]['id_reg_pd'],
            $dataParam[$i]['kode_mk_asal']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertNilaiTransfer'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingSatPend(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_sp'],
            $dataParam[$i]['nm_lemb'],
            $dataParam[$i]['nss'],
            $dataParam[$i]['npsn'],
            $dataParam[$i]['nm_singkat'],
            $dataParam[$i]['id_bp'],
            $dataParam[$i]['jln'],
            $dataParam[$i]['rt'],
            $dataParam[$i]['rw'],
            $dataParam[$i]['nm_dsn'],
            $dataParam[$i]['ds_kel'],
            $dataParam[$i]['id_wil'],
            $dataParam[$i]['kode_pos'],
            $dataParam[$i]['lintang'],
            $dataParam[$i]['bujur'],
            $dataParam[$i]['no_tel'],
            $dataParam[$i]['no_fax'],
            $dataParam[$i]['email'],
            $dataParam[$i]['website'],
            $dataParam[$i]['id_kk'],
            $dataParam[$i]['stat_sp'],
            $dataParam[$i]['sk_pendirian_sp'],
            $dataParam[$i]['tgl_sk_pendirian_sp'],
            $dataParam[$i]['tgl_berdiri'],
            $dataParam[$i]['id_stat_milik'],
            $dataParam[$i]['sk_izin_operasi'],
            $dataParam[$i]['tgl_sk_izin_operasi'],
            $dataParam[$i]['no_rek'],
            $dataParam[$i]['nm_bank'],
            $dataParam[$i]['unit_cabang'],
            $dataParam[$i]['nm_rek'],
            $dataParam[$i]['a_mbs'],
            $dataParam[$i]['luas_tanah_milik'],
            $dataParam[$i]['luas_tanah_bukan_milik'],
            $dataParam[$i]['a_lptk'],
            $dataParam[$i]['id_pembina'],
            $dataParam[$i]['id_blob'],
            $dataParam[$i]['id_pic'],
            $dataParam[$i]['kode_reg'],
            $dataParam[$i]['flag']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertSatPend'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingSms(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['nm_lemb'],
            $dataParam[$i]['smt_mulai'],
            $dataParam[$i]['kode_prodi'],
            $dataParam[$i]['id_sp'],
            $dataParam[$i]['id_jenj_didik'],
            $dataParam[$i]['id_jns_sms'],
            $dataParam[$i]['id_pengguna'],
            $dataParam[$i]['id_fungsi_lab'],
            $dataParam[$i]['id_kel_usaha'],
            $dataParam[$i]['id_blob'],
            $dataParam[$i]['id_wil'],
            $dataParam[$i]['id_jur'],
            $dataParam[$i]['id_induk_sms'],
            $dataParam[$i]['jln'],
            $dataParam[$i]['rt'],
            $dataParam[$i]['rw'],
            $dataParam[$i]['nm_dsn'],
            $dataParam[$i]['ds_kel'],
            $dataParam[$i]['kode_pos'],
            $dataParam[$i]['lintang'],
            $dataParam[$i]['bujur'],
            $dataParam[$i]['no_tel'],
            $dataParam[$i]['no_fax'],
            $dataParam[$i]['email'],
            $dataParam[$i]['website'],
            $dataParam[$i]['singkatan'],
            $dataParam[$i]['tgl_berdiri'],
            $dataParam[$i]['sk_selenggara'],
            $dataParam[$i]['tgl_sk_selenggara'],
            $dataParam[$i]['tmt_sk_selenggara'],
            $dataParam[$i]['tst_sk_selenggara'],
            $dataParam[$i]['kpst_pd'],
            $dataParam[$i]['sks_lulus'],
            $dataParam[$i]['gelar_lulusan'],
            $dataParam[$i]['stat_prodi'],
            $dataParam[$i]['polesei_nilai'],
            $dataParam[$i]['luas_lab'],
            $dataParam[$i]['kapasitas_prak_satu_shift'],
            $dataParam[$i]['jml_mhs_pengguna'],
            $dataParam[$i]['jml_jam_penggunaan'],
            $dataParam[$i]['jml_prodi_pengguna'],
            $dataParam[$i]['jml_modul_prak_sendiri'],
            $dataParam[$i]['jml_modul_prak_lain'],
            $dataParam[$i]['fungsi_selain_prak'],
            $dataParam[$i]['penggunaan_lab']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertSms'], $p);

         /*
         if($prosesInsert === FALSE){
            echo '<pre>';
            print vsprintf($this->mSqlQueries['insertSms'], $p);
            exit;
         }
         /**/
         
         /*if($prosesInsert === FALSE){
            $arr_gagal['id'][] = $i;
            $arr_gagal['q'][] = vsprintf($this->mSqlQueries['insertSms'], $p);
            $arr_gagal['err'][] = $this->mDbErrorMessage;
         }*/

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }
      //print_r($arr_gagal);exit;
      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingSubsKuliah(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         $p = array(
            $dataParam[$i]['id_subst'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['nm_subst'],
            $dataParam[$i]['id_jns_subst'],
            $dataParam[$i]['sks_mk'],
            $dataParam[$i]['sks_tm'],
            $dataParam[$i]['sks_prak'],
            $dataParam[$i]['sks_prak_lap'],
            $dataParam[$i]['sks_sim']
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertSubsKuliah'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingMataKuliah(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         //get gt_id nya (mkkurId)
         $p = array(
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['kode_mk'],
            $dataParam[$i]['nm_mk']
         );
         $dataMkkurId = $this->GetAllDataAsArray($this->mSqlQueries['getMkkurId'], $p);
         $gt_id = $dataMkkurId[0]['mkkurId'];

         $p = array(
            $dataParam[$i]['id_mk'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['id_jenj_didik'],
            $dataParam[$i]['kode_mk'],
            $dataParam[$i]['nm_mk'],
            $dataParam[$i]['jns_mk'],
            $dataParam[$i]['kel_mk'],
            $dataParam[$i]['sks_mk'],
            $dataParam[$i]['sks_tm'],
            $dataParam[$i]['sks_prak'],
            $dataParam[$i]['sks_prak_lap'],
            $dataParam[$i]['sks_sim'],
            $dataParam[$i]['metode_pelaksanaan_kuliah'],
            $dataParam[$i]['a_sap'],
            $dataParam[$i]['a_silabus'],
            $dataParam[$i]['a_bahan_ajar'],
            $dataParam[$i]['acara_prak'],
            $dataParam[$i]['a_diktat'],
            $dataParam[$i]['tgl_mulai_efektif'],
            $dataParam[$i]['tgl_akhir_efektif'],
            $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertMataKuliah'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingKurikulum(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         //get gt_id kurikulum yaitu di tabel s_kurikulum (kurId)
         $kurTahun = substr($dataParam[$i]['id_smt_berlaku'], 0, -1);
         $p = array(
            $dataParam[$i]['nm_kurikulum_sp'],
            $kurTahun,
            $dataParam[$i]['id_sms']
         );
         $dataKurId = $this->GetAllDataAsArray($this->mSqlQueries['getKurIdValue'], $p);
         $gt_id = $dataKurId[0]['kurId'];

         $p = array(
            $dataParam[$i]['id_kurikulum_sp'],
            $dataParam[$i]['nm_kurikulum_sp'],
            $dataParam[$i]['jml_sem_normal'],
            $dataParam[$i]['jml_sks_lulus'],
            $dataParam[$i]['jml_sks_wajib'],
            $dataParam[$i]['jml_sks_pilihan'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['id_jenj_didik'],
            $dataParam[$i]['id_smt_berlaku'],
            $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertKurikulum'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingKelasKuliah(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataParam); $i++) {
         //proses untuk gt_id nya diisi dengan kls_id
         $p = array(
            $dataParam[$i]['id_smt'],
            $dataParam[$i]['id_mk'],
            $dataParam[$i]['nm_kls']
         );
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataIdKelasKuliah'], $p);
         $gt_id = empty($dataId) ? 0 : $dataId[0]['klsId'];
         if(empty($gt_id)){
            continue;
         }
         $p = array(
            $dataParam[$i]['id_kls'],
            $dataParam[$i]['id_sms'],
            $dataParam[$i]['id_smt'],
            $dataParam[$i]['id_mk'],
            $dataParam[$i]['nm_kls'],
            $dataParam[$i]['sks_mk'],
            $dataParam[$i]['sks_tm'],
            $dataParam[$i]['sks_prak'],
            $dataParam[$i]['sks_prak_lap'],
            $dataParam[$i]['sks_sim'],
            $dataParam[$i]['bahasan_case'],
            $dataParam[$i]['tgl_mulai_koas'],
            $dataParam[$i]['tgl_selesai_koas'],
            $dataParam[$i]['id_mou'],
            $dataParam[$i]['a_selenggara_pditt'],
            $dataParam[$i]['kuota_pditt'],
            $dataParam[$i]['a_pengguna_pditt'],
            $dataParam[$i]['id_kls_pditt'],
            $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertKelasKuliah'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesTrans);
      if($prosesTrans == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function copyTabelRowCopyingNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesTrans = TRUE;
      $totalAfektedRow = 0;

      //$arrTemp = array();
      for ($i=0; $i < count($dataParam); $i++) {
         //get gt_id yaitu krsdtId terlebih dahulu
         $p = array(
            $dataParam[$i]['id_kls'],
            $dataParam[$i]['id_reg_pd']
         );
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataIdKrsdtId'], $p);
         $gt_id = $dataId[0]['krsdtId'];

         //prep data
         if($dataParam[$i]['asal_data'] == "") $dataParam[$i]['asal_data'] = "str_ksg";
         if($dataParam[$i]['nilai_angka'] == "") $dataParam[$i]['nilai_angka'] = "str_ksg";
         if($dataParam[$i]['nilai_indeks'] == "") $dataParam[$i]['nilai_indeks'] = "str_ksg";
         if($gt_id == "") $gt_id = "str_ksg";

         $p = array(
            $dataParam[$i]['id_kls'],
            $dataParam[$i]['id_reg_pd'],
            $dataParam[$i]['asal_data'],$dataParam[$i]['asal_data'],
            $dataParam[$i]['nilai_angka'],$dataParam[$i]['nilai_angka'],
            $dataParam[$i]['nilai_huruf'],
            $dataParam[$i]['nilai_indeks'],$dataParam[$i]['nilai_indeks'],
            $gt_id, $gt_id
         );
         $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['insertNilai'], $p);

         if($prosesInsert == FALSE) $prosesTrans = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction(TRUE);
      return $totalAfektedRow;
   }

   function setStatusCreateTabelDone(){
      $prosesUpdate = $this->ExecuteUpdateQuery($this->mSqlQueries['setStatusCreateTabelDone'], array());
      return $prosesUpdate;
   }

   function getDataListAgamaTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListAgamaTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListAgama(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListAgama'], $p);
   }

   function getDataListAgamaSia(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListAgamaSia'], array());
   }

   function saveAgamaGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_agama'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateAgama'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_agama']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveAgamaGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetAgamaSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_agama']
      );
      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetAgamaSia'], $p);
      if($proses == true){
         return 'resetOke';
      }else{
         return 'resetGagal';
      }
   }

   function getDataListIktKerjaDosenTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListIktKerjaDosenTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListIktKerjaDosen(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListIktKerjaDosen'], $p);
   }

   function getIktKerjaDosenSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getIktKerjaDosenSiaJson'], array());
   }

   function saveIktKerjaDosenGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_ikatan_kerja'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateIktKerjaDosen'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_ikatan_kerja']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveIktKerjaDosenGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetIktKerjaDosenSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_ikatan_kerja']
      );
      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetIktKerjaDosenSia'], $p);
      if($proses == true){
         return 'resetOke';
      }else{
         return 'resetGagal';
      }
   }

   function getDataListJenjangPendTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListJenjangPendTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListJenjangPend(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListJenjangPend'], $p);
   }

   function getJenjangPendSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getJenjangPendSiaJson'], array());
   }

   function saveJenjangPendGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_jenj_didik'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateJenjangPend'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_jenj_didik']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveJenjangPendGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetJenjangPendSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_jenj_didik']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetJenjangPendSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function getDataListStsMhsTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListStsMhsTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListStsMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListStsMhs'], $p);
   }

   function getStsMhsSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getStsMhsSiaJson'], array());
   }

   function saveStsMhsGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_stat_mhs'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateStsMhs'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_stat_mhs']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveStsMhsGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetStsMhsSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_stat_mhs']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStsMhsSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function getDataListNegaraTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListNegaraTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListNegara(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListNegara'], $p);
   }

   function getNegaraSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getNegaraSiaJson'], array());
   }

   function saveNegaraGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_negara'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateNegara'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_negara']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveNegaraGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetNegaraSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_negara']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetNegaraSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function getDataListWilayahTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListWilayahTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListWilayah(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListWilayah'], $p);
   }

   function getDataWilayahGtIdNegara(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['gt_id']
      );
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataWilayahGtIdNegara'], $p);
      return $result[0];
   }

   function getDataWilayahGtIdPropinsi(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['gt_id']
      );
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataWilayahGtIdPropinsi'], $p);
      return $result[0];
   }

   function getDataWilayahGtIdKota(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['gt_id']
      );
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataWilayahGtIdKota'], $p);
      return $result[0];
   }

   function getWilayahSiaJson(){
      $dataParam = $this->GetProperty("DataProceed");
      switch ($dataParam['lvlwilayah']) {
         case '0':
            //negara
            return $this->GetAllDataAsArray($this->mSqlQueries['getWilayahNegaraSiaJson'], array());
         break;
         case '1':
            //propinsi
            return $this->GetAllDataAsArray($this->mSqlQueries['getWilayahPropinsiSiaJson'], array());
         break;
         case '2':
            //kota
            return $this->GetAllDataAsArray($this->mSqlQueries['getWilayahKotaSiaJson'], array());
         break;
      }
   }

   function saveWilayahGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_wil'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateWilayah'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_wil']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveWilayahGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetWilayahSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_wil']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetWilayahSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function setStatusMatchDataDone(){
      $prosesUpdate = $this->ExecuteUpdateQuery($this->mSqlQueries['setStatusMatchDataDone'], array());
      return $prosesUpdate;
   }

   function getDataListKurikulumTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListKurikulumTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListKurikulum(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListKurikulum'], $p);
   }

   function getDataListMhsTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListMhsTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListMhs'], $p);
   }

   function getDataListDosenTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListDosenTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListDosen(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListDosen'], $p);
   }

   function getDataListKlsKuliahTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListKlsKuliahTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListKlsKuliah(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListKlsKuliah'], $p);
   }

   function getDataListKuliahMhsTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListKuliahMhsTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListKuliahMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListKuliahMhs'], $p);
   }

   function setStatusInsertDataDone(){
      $prosesUpdate = $this->ExecuteUpdateQuery($this->mSqlQueries['setStatusInsertDataDone'], array());
      return $prosesUpdate;
   }

   function getDataListPangkatGolTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListPangkatGolTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListPangkatGol(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListPangkatGol'], $p);
   }

   function getPangkatGolSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getPangkatGolSiaJson'], array());
   }

   function savePangkatGolGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_pangkat_gol'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdatePangkatGol'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_pangkat_gol']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['savePangkatGolGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetPangkatGolSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_pangkat_gol']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetPangkatGolSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function getDataListPkerjaTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListPkerjaTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListPkerja(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListPkerja'], $p);
   }

   function getPkerjaSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getPkerjaSiaJson'], array());
   }

   function savePkerjaGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_pekerjaan'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdatePkerja'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_pekerjaan']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['savePkerjaGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetPkerjaSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_pekerjaan']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetPkerjaSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function getDataListPhasilTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListPhasilTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListPhasil(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListPhasil'], $p);
   }

   function getPhasilSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getPhasilSiaJson'], array());
   }

   function savePhasilGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_penghasilan'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdatePhasil'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_penghasilan']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['savePhasilGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetPhasilSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_penghasilan']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetPhasilSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function getDataListStsAktifPegTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListStsAktifPegTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListStsAktifPeg(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListStsAktifPeg'], $p);
   }

   function getStsAktifPegSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getStsAktifPegSiaJson'], array());
   }

   function saveStsAktifPegGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_stat_aktif'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateStsAktifPeg'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_stat_aktif']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveStsAktifPegGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetStsAktifPegSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_stat_aktif']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStsAktifPegSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function getDataListStsKepegTotalRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataListStsKepegTotalRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataListStsKepeg(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['pagePosition'],
         $dataParam['limitPerPage']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataListStsKepeg'], $p);
   }

   function getStsKepegSiaJson(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getStsKepegSiaJson'], array());
   }

   function saveStsKepegGtId(){
      $dataParam = $this->GetProperty("DataProceed");

      //cek dl apakah sudah dipakai id yg dipilih ini
      $p = array(
         $dataParam['id_stat_pegawai'],
         $dataParam['gt_id_baru']
      );
      $dataCek = $this->GetAllDataAsArray($this->mSqlQueries['cekUpdateStsKepeg'], $p);
      if($dataCek[0]['BANYAK'] != '0'){
         return 'updateErr';
      }

      $p = array(
         $dataParam['gt_id_baru'],
         $dataParam['id_stat_pegawai']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['saveStsKepegGtId'], $p);
      if($result == true){
         return 'updateOke';
      }else{
         return 'updateErr';
      }
   }

   function resetStsKepegSia(){
      $dataParam = $this->GetProperty("DataProceed");

      $p = array(
         $dataParam['id_stat_pegawai']
      );
      $result = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStsKepegSia'], $p);
      if($result == true){
         return 'resetOke';
      }else{
         return 'resetErr';
      }
   }

   function syncAwalGetDataInsertKurikulum(){
      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalGetDataInsertKurikulum'], array());
   }

   function syncUlangKurikulum(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         //get gt_id kurikulum yaitu di tabel s_kurikulum (kurId)
         $kurTahun = substr($dataList[$i]['id_smt_berlaku'], 0, -1);
         $p = array(
            $dataList[$i]['nm_kurikulum_sp'],
            $kurTahun,
            $dataList[$i]['id_sms']
         );
         $dataKurId = $this->GetAllDataAsArray($this->mSqlQueries['syncUlangKurikulumGetGtId'], $p);
         $gt_id = $dataKurId[0]['kurId'];

         $p = array(
            $dataList[$i]['id_kurikulum_sp'],
            $dataList[$i]['nm_kurikulum_sp'],
            $dataList[$i]['jml_sem_normal'],
            $dataList[$i]['jml_sks_lulus'],
            $dataList[$i]['jml_sks_wajib'],
            $dataList[$i]['jml_sks_pilihan'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['id_smt_berlaku'],
            $gt_id,
            $dataList[$i]['nm_kurikulum_sp'], //update
            $dataList[$i]['jml_sem_normal'],
            $dataList[$i]['jml_sks_lulus'],
            $dataList[$i]['jml_sks_wajib'],
            $dataList[$i]['jml_sks_pilihan'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['id_smt_berlaku'],
            $gt_id
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncUlangKurikulum'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);

      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalInsertDataDiktiMahasiswa(){
      $dataParam = $this->GetProperty("DataProceed");
      $username = $dataParam[0];

      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalInsertDataDiktiMahasiswa'], array($username,$username));
   }

   function syncAwalGetDataInsertMatKul(){
      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalGetDataInsertMatKul'], array());
   }

   function syncAwalMatkul(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         //get gt_id nya (mkkurId)
         $p = array(
            $dataList[$i]['id_sms'],
            $dataList[$i]['kode_mk'],
            $dataList[$i]['nm_mk']
         );
         $dataMkkurId = $this->GetAllDataAsArray($this->mSqlQueries['syncUlangMatkulGetGtId'], $p);
         $gt_id = $dataMkkurId[0]['mkkurId'];

         $p = array(
            $dataList[$i]['id_mk'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['kode_mk'],
            $dataList[$i]['nm_mk'],
            $dataList[$i]['jns_mk'],
            $dataList[$i]['kel_mk'],
            $dataList[$i]['sks_mk'],
            $dataList[$i]['sks_tm'],
            $dataList[$i]['sks_prak'],
            $dataList[$i]['sks_prak_lap'],
            $dataList[$i]['sks_sim'],
            $dataList[$i]['metode_pelaksanaan_kuliah'],
            $dataList[$i]['a_sap'],
            $dataList[$i]['a_silabus'],
            $dataList[$i]['a_bahan_ajar'],
            $dataList[$i]['acara_prak'],
            $dataList[$i]['a_diktat'],
            $dataList[$i]['tgl_mulai_efektif'],
            $dataList[$i]['tgl_akhir_efektif'],
            $gt_id,
            $dataList[$i]['id_sms'], //on dup update
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['kode_mk'],
            $dataList[$i]['nm_mk'],
            $dataList[$i]['jns_mk'],
            $dataList[$i]['kel_mk'],
            $dataList[$i]['sks_mk'],
            $dataList[$i]['sks_tm'],
            $dataList[$i]['sks_prak'],
            $dataList[$i]['sks_prak_lap'],
            $dataList[$i]['sks_sim'],
            $dataList[$i]['metode_pelaksanaan_kuliah'],
            $dataList[$i]['a_sap'],
            $dataList[$i]['a_silabus'],
            $dataList[$i]['a_bahan_ajar'],
            $dataList[$i]['acara_prak'],
            $dataList[$i]['a_diktat'],
            $dataList[$i]['tgl_mulai_efektif'],
            $dataList[$i]['tgl_akhir_efektif'],
            $gt_id
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncUlangMatkul'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalGetDataInsertMatKulKur(){
      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalGetDataInsertMatKulKur'], array());
   }

   function syncAwalMatkulKur(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {

         $p = array(
            $dataList[$i]['id_kurikulum_sp'],
            $dataList[$i]['id_mk'],
            $dataList[$i]['smt'],
            $dataList[$i]['sks_mk'],
            $dataList[$i]['sks_tm'],
            $dataList[$i]['sks_prak'],
            $dataList[$i]['sks_prak_lap'],
            $dataList[$i]['sks_sim'],
            $dataList[$i]['a_wajib'],
            $dataList[$i]['smt'], //update
            $dataList[$i]['sks_mk'],
            $dataList[$i]['sks_tm'],
            $dataList[$i]['sks_prak'],
            $dataList[$i]['sks_prak_lap'],
            $dataList[$i]['sks_sim'],
            $dataList[$i]['a_wajib']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncAwalMatkulKur'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalMhs(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_pd'],
            $dataList[$i]['nm_pd'],
            $dataList[$i]['jk'],
            $dataList[$i]['nisn'],
            $dataList[$i]['nik'],
            $dataList[$i]['tmpt_lahir'],
            $dataList[$i]['tgl_lahir'],
            $dataList[$i]['id_agama'],
            $dataList[$i]['id_kk'],
            $dataList[$i]['id_sp'],
            $dataList[$i]['jln'],
            $dataList[$i]['rt'],
            $dataList[$i]['rw'],
            $dataList[$i]['nm_dsn'],
            $dataList[$i]['ds_kel'],
            $dataList[$i]['id_wil'],
            $dataList[$i]['kode_pos'],
            $dataList[$i]['id_jns_tinggal'],
            $dataList[$i]['id_alat_transport'],
            $dataList[$i]['telepon_rumah'],
            $dataList[$i]['telepon_seluler'],
            $dataList[$i]['email'],
            $dataList[$i]['a_terima_kps'],
            $dataList[$i]['no_kps'],
            $dataList[$i]['stat_pd'],
            $dataList[$i]['nm_ayah'],
            $dataList[$i]['tgl_lahir_ayah'],
            $dataList[$i]['id_jenjang_pendidikan_ayah'],
            $dataList[$i]['id_pekerjaan_ayah'],
            $dataList[$i]['id_penghasilan_ayah'],
            $dataList[$i]['id_kebutuhan_khusus_ayah'],
            $dataList[$i]['nm_ibu_kandung'],
            $dataList[$i]['tgl_lahir_ibu'],
            $dataList[$i]['id_jenjang_pendidikan_ibu'],
            $dataList[$i]['id_penghasilan_ibu'],
            $dataList[$i]['id_pekerjaan_ibu'],
            $dataList[$i]['id_kebutuhan_khusus_ibu'],
            $dataList[$i]['nm_wali'],
            $dataList[$i]['tgl_lahir_wali'],
            $dataList[$i]['id_jenjang_pendidikan_wali'],
            $dataList[$i]['id_pekerjaan_wali'],
            $dataList[$i]['id_penghasilan_wali'],
            $dataList[$i]['kewarganegaraan'],
            $dataList[$i]['nm_pd'], //update
            $dataList[$i]['jk'],
            $dataList[$i]['nisn'],
            $dataList[$i]['nik'],
            $dataList[$i]['tmpt_lahir'],
            $dataList[$i]['tgl_lahir'],
            $dataList[$i]['id_agama'],
            $dataList[$i]['id_kk'],
            $dataList[$i]['id_sp'],
            $dataList[$i]['jln'],
            $dataList[$i]['rt'],
            $dataList[$i]['rw'],
            $dataList[$i]['nm_dsn'],
            $dataList[$i]['ds_kel'],
            $dataList[$i]['id_wil'],
            $dataList[$i]['kode_pos'],
            $dataList[$i]['id_jns_tinggal'],
            $dataList[$i]['id_alat_transport'],
            $dataList[$i]['telepon_rumah'],
            $dataList[$i]['telepon_seluler'],
            $dataList[$i]['email'],
            $dataList[$i]['a_terima_kps'],
            $dataList[$i]['no_kps'],
            $dataList[$i]['stat_pd'],
            $dataList[$i]['nm_ayah'],
            $dataList[$i]['tgl_lahir_ayah'],
            $dataList[$i]['id_jenjang_pendidikan_ayah'],
            $dataList[$i]['id_pekerjaan_ayah'],
            $dataList[$i]['id_penghasilan_ayah'],
            $dataList[$i]['id_kebutuhan_khusus_ayah'],
            $dataList[$i]['nm_ibu_kandung'],
            $dataList[$i]['tgl_lahir_ibu'],
            $dataList[$i]['id_jenjang_pendidikan_ibu'],
            $dataList[$i]['id_penghasilan_ibu'],
            $dataList[$i]['id_pekerjaan_ibu'],
            $dataList[$i]['id_kebutuhan_khusus_ibu'],
            $dataList[$i]['nm_wali'],
            $dataList[$i]['tgl_lahir_wali'],
            $dataList[$i]['id_jenjang_pendidikan_wali'],
            $dataList[$i]['id_pekerjaan_wali'],
            $dataList[$i]['id_penghasilan_wali'],
            $dataList[$i]['kewarganegaraan']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalMhs'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalMhsPt(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['id_pd'],
            $dataList[$i]['id_sp'],
            $dataList[$i]['id_jns_daftar'],
            $dataList[$i]['nipd'],
            $dataList[$i]['tgl_masuk_sp'],
            $dataList[$i]['id_jns_keluar'],
            $dataList[$i]['tgl_keluar'],
            $dataList[$i]['ket'],
            $dataList[$i]['skhun'],
            $dataList[$i]['a_pernah_paud'],
            $dataList[$i]['a_pernah_tk'],
            $dataList[$i]['mulai_smt'],
            $dataList[$i]['sks_diakui'],
            $dataList[$i]['jalur_skripsi'],
            $dataList[$i]['judul_skripsi'],
            $dataList[$i]['bln_awal_bimbingan'],
            $dataList[$i]['bln_akhir_bimbingan'],
            $dataList[$i]['sk_yudisium'],
            $dataList[$i]['tgl_sk_yudisium'],
            $dataList[$i]['ipk'],
            $dataList[$i]['no_seri_ijazah'],
            $dataList[$i]['sert_prof'],
            $dataList[$i]['a_pindah_mhs_asing'],
            $dataList[$i]['nm_pt_asal'],
            $dataList[$i]['nm_prodi_asal'],
            $dataList[$i]['id_sms'], //update
            $dataList[$i]['id_pd'],
            $dataList[$i]['id_sp'],
            $dataList[$i]['id_jns_daftar'],
            $dataList[$i]['nipd'],
            $dataList[$i]['tgl_masuk_sp'],
            $dataList[$i]['id_jns_keluar'],
            $dataList[$i]['tgl_keluar'],
            $dataList[$i]['ket'],
            $dataList[$i]['skhun'],
            $dataList[$i]['a_pernah_paud'],
            $dataList[$i]['a_pernah_tk'],
            $dataList[$i]['mulai_smt'],
            $dataList[$i]['sks_diakui'],
            $dataList[$i]['jalur_skripsi'],
            $dataList[$i]['judul_skripsi'],
            $dataList[$i]['bln_awal_bimbingan'],
            $dataList[$i]['bln_akhir_bimbingan'],
            $dataList[$i]['sk_yudisium'],
            $dataList[$i]['tgl_sk_yudisium'],
            $dataList[$i]['ipk'],
            $dataList[$i]['no_seri_ijazah'],
            $dataList[$i]['sert_prof'],
            $dataList[$i]['a_pindah_mhs_asing'],
            $dataList[$i]['nm_pt_asal'],
            $dataList[$i]['nm_prodi_asal']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalMhsPt'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalDosen(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_ptk'],
            $dataList[$i]['id_blob'],
            $dataList[$i]['id_ikatan_kerja'],
            $dataList[$i]['nm_ptk'],
            $dataList[$i]['nidn'],
            $dataList[$i]['nip'],
            $dataList[$i]['jk'],
            $dataList[$i]['tmpt_lahir'],
            $dataList[$i]['tgl_lahir'],
            $dataList[$i]['nik'],
            $dataList[$i]['niy_nigk'],
            $dataList[$i]['nuptk'],
            $dataList[$i]['id_stat_pegawai'],
            $dataList[$i]['id_jns_ptk'],
            $dataList[$i]['id_bid_pengawas'],
            $dataList[$i]['id_agama'],
            $dataList[$i]['jln'],
            $dataList[$i]['rt'],
            $dataList[$i]['rw'],
            $dataList[$i]['nm_dsn'],
            $dataList[$i]['ds_kel'],
            $dataList[$i]['id_wil'],
            $dataList[$i]['kode_pos'],
            $dataList[$i]['no_tel_rmh'],
            $dataList[$i]['no_hp'],
            $dataList[$i]['email'],
            $dataList[$i]['id_sp'],
            $dataList[$i]['id_stat_aktif'],
            $dataList[$i]['sk_cpns'],
            $dataList[$i]['tgl_sk_cpns'],
            $dataList[$i]['sk_angkat'],
            $dataList[$i]['tmt_sk_angkat'],
            $dataList[$i]['id_lemb_angkat'],
            $dataList[$i]['id_pangkat_gol'],
            $dataList[$i]['id_keahlian_lab'],
            $dataList[$i]['id_sumber_gaji'],
            $dataList[$i]['nm_ibu_kandung'],
            $dataList[$i]['stat_kawin'],
            $dataList[$i]['nm_suami_istri'],
            $dataList[$i]['nip_suami_istri'],
            $dataList[$i]['id_pekerjaan_suami_istri'],
            $dataList[$i]['tmt_pns'],
            $dataList[$i]['a_lisensi_kepsek'],
            $dataList[$i]['jml_sekolah_binaan'],
            $dataList[$i]['a_diklat_awas'],
            $dataList[$i]['akta_ijin_ajar'],
            $dataList[$i]['nira'],
            $dataList[$i]['stat_data'],
            $dataList[$i]['mampu_handle_kk'],
            $dataList[$i]['a_braille'],
            $dataList[$i]['a_bhs_isyarat'],
            $dataList[$i]['npwp'],
            $dataList[$i]['kewarganegaraan'],
            $dataList[$i]['id_blob'], //update
            $dataList[$i]['id_ikatan_kerja'],
            $dataList[$i]['nm_ptk'],
            $dataList[$i]['nidn'],
            $dataList[$i]['nip'],
            $dataList[$i]['jk'],
            $dataList[$i]['tmpt_lahir'],
            $dataList[$i]['tgl_lahir'],
            $dataList[$i]['nik'],
            $dataList[$i]['niy_nigk'],
            $dataList[$i]['nuptk'],
            $dataList[$i]['id_stat_pegawai'],
            $dataList[$i]['id_jns_ptk'],
            $dataList[$i]['id_bid_pengawas'],
            $dataList[$i]['id_agama'],
            $dataList[$i]['jln'],
            $dataList[$i]['rt'],
            $dataList[$i]['rw'],
            $dataList[$i]['nm_dsn'],
            $dataList[$i]['ds_kel'],
            $dataList[$i]['id_wil'],
            $dataList[$i]['kode_pos'],
            $dataList[$i]['no_tel_rmh'],
            $dataList[$i]['no_hp'],
            $dataList[$i]['email'],
            $dataList[$i]['id_sp'],
            $dataList[$i]['id_stat_aktif'],
            $dataList[$i]['sk_cpns'],
            $dataList[$i]['tgl_sk_cpns'],
            $dataList[$i]['sk_angkat'],
            $dataList[$i]['tmt_sk_angkat'],
            $dataList[$i]['id_lemb_angkat'],
            $dataList[$i]['id_pangkat_gol'],
            $dataList[$i]['id_keahlian_lab'],
            $dataList[$i]['id_sumber_gaji'],
            $dataList[$i]['nm_ibu_kandung'],
            $dataList[$i]['stat_kawin'],
            $dataList[$i]['nm_suami_istri'],
            $dataList[$i]['nip_suami_istri'],
            $dataList[$i]['id_pekerjaan_suami_istri'],
            $dataList[$i]['tmt_pns'],
            $dataList[$i]['a_lisensi_kepsek'],
            $dataList[$i]['jml_sekolah_binaan'],
            $dataList[$i]['a_diklat_awas'],
            $dataList[$i]['akta_ijin_ajar'],
            $dataList[$i]['nira'],
            $dataList[$i]['stat_data'],
            $dataList[$i]['mampu_handle_kk'],
            $dataList[$i]['a_braille'],
            $dataList[$i]['a_bhs_isyarat'],
            $dataList[$i]['npwp'],
            $dataList[$i]['kewarganegaraan']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalDosen'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalDosenPt(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_reg_ptk'],
            $dataList[$i]['id_ptk'],
            $dataList[$i]['id_sp'],
            $dataList[$i]['id_thn_ajaran'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['no_srt_tgs'],
            $dataList[$i]['tgl_srt_tgs'],
            $dataList[$i]['tmt_srt_tgs'],
            $dataList[$i]['a_sp_homebase'],
            $dataList[$i]['a_aktif_bln_1'],
            $dataList[$i]['a_aktif_bln_2'],
            $dataList[$i]['a_aktif_bln_3'],
            $dataList[$i]['a_aktif_bln_4'],
            $dataList[$i]['a_aktif_bln_5'],
            $dataList[$i]['a_aktif_bln_6'],
            $dataList[$i]['a_aktif_bln_7'],
            $dataList[$i]['a_aktif_bln_8'],
            $dataList[$i]['a_aktif_bln_9'],
            $dataList[$i]['a_aktif_bln_10'],
            $dataList[$i]['a_aktif_bln_11'],
            $dataList[$i]['a_aktif_bln_12'],
            $dataList[$i]['id_jns_keluar'],
            $dataList[$i]['tgl_ptk_keluar'],
            $dataList[$i]['id_ptk'], //update
            $dataList[$i]['id_sp'],
            $dataList[$i]['id_thn_ajaran'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['no_srt_tgs'],
            $dataList[$i]['tgl_srt_tgs'],
            $dataList[$i]['tmt_srt_tgs'],
            $dataList[$i]['a_sp_homebase'],
            $dataList[$i]['a_aktif_bln_1'],
            $dataList[$i]['a_aktif_bln_2'],
            $dataList[$i]['a_aktif_bln_3'],
            $dataList[$i]['a_aktif_bln_4'],
            $dataList[$i]['a_aktif_bln_5'],
            $dataList[$i]['a_aktif_bln_6'],
            $dataList[$i]['a_aktif_bln_7'],
            $dataList[$i]['a_aktif_bln_8'],
            $dataList[$i]['a_aktif_bln_9'],
            $dataList[$i]['a_aktif_bln_10'],
            $dataList[$i]['a_aktif_bln_11'],
            $dataList[$i]['a_aktif_bln_12'],
            $dataList[$i]['id_jns_keluar'],
            $dataList[$i]['tgl_ptk_keluar']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalDosenPt'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalInsertDataDiktiBobotNilai(){
      //get all data nilai dari aplikasi SIA
      $dataNilai = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalBobotNilaiInsertGetDataNilai'], array());

      //ambil data program studi dari feeder
      $dataProdi = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalBobotNilaiInsertGetDataProdiFeeder'], array());

      //cek satu2 untuk setiap nilai di setiap prodinya.. jika belum ada di insertkan..jika sudah ada dilewatkan saja
      $paramReturn = array();
      $increData = 0;
      for ($i=0; $i < count($dataProdi); $i++) {
         for ($j=0; $j < count($dataNilai); $j++) {
            $p = array(
               $dataProdi[$i]['id_sms'],
               $dataNilai[$j]['kodeNilai']
            );
            $cekNilai = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalBobotNilaiInsertCekNilaiFeeder'], $p);

            if($cekNilai[0]['kode_bobot_nilai'] == ""){
               //masukkan param untuk insert
               $paramReturn[$increData]['kode_bobot_nilai'] = '';
               $paramReturn[$increData]['id_sms'] = $dataProdi[$i]['id_sms'];
               $paramReturn[$increData]['nilai_huruf'] = $dataNilai[$j]['kodeNilai'];
               $paramReturn[$increData]['bobot_nilai_min'] = '0';
               $paramReturn[$increData]['bobot_nilai_maks'] = '100';
               $paramReturn[$increData]['nilai_indeks'] = $dataNilai[$j]['bobotIndeks'];
               $paramReturn[$increData]['tgl_mulai_efektif'] = '1970-01-01';
               $paramReturn[$increData]['tgl_akhir_efektif'] = '1970-01-01';
               $increData++;
            }
         }
      }
      return $paramReturn;
   }

   function syncAwalBobotNilai(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['kode_bobot_nilai'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['nilai_huruf'],
            $dataList[$i]['bobot_nilai_min'],
            $dataList[$i]['bobot_nilai_maks'],
            $dataList[$i]['nilai_indeks'],
            $dataList[$i]['tgl_mulai_efektif'],
            $dataList[$i]['tgl_akhir_efektif'],
            $dataList[$i]['id_sms'], //update
            $dataList[$i]['nilai_huruf'],
            $dataList[$i]['bobot_nilai_min'],
            $dataList[$i]['bobot_nilai_maks'],
            $dataList[$i]['nilai_indeks'],
            $dataList[$i]['tgl_mulai_efektif'],
            $dataList[$i]['tgl_akhir_efektif']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalBobotNilai'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'syncOke';
      }else{
         return 'syncFail';
      }
   }

   function syncAwalInsertDataDiktiKelasKuliah(){
      $dataParam = $this->GetProperty("DataProceed");
      $semidPelaporan = $dataParam[0];

      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalInsertDataDiktiKelasKuliah'], array($semidPelaporan));
   }

   function syncAwalKelasKuliah(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataList); $i++) {
         //proses untuk gt_id nya diisi dengan kls_id
         $p = array(
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_mk'],
            $dataList[$i]['nm_kls']
         );
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalKelasKuliahGetGtId'], $p);
         $gt_id = $dataId[0]['klsId'];

         $p = array(
            $dataList[$i]['id_kls'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_mk'],
            $dataList[$i]['nm_kls'],
            $dataList[$i]['sks_mk'],
            $dataList[$i]['sks_tm'],
            $dataList[$i]['sks_prak'],
            $dataList[$i]['sks_prak_lap'],
            $dataList[$i]['sks_sim'],
            $dataList[$i]['bahasan_case'],
            $dataList[$i]['tgl_mulai_koas'],
            $dataList[$i]['tgl_selesai_koas'],
            $dataList[$i]['id_mou'],
            $dataList[$i]['a_selenggara_pditt'],
            $dataList[$i]['kuota_pditt'],
            $dataList[$i]['a_pengguna_pditt'],
            $dataList[$i]['id_kls_pditt'],
            $gt_id,
            $dataList[$i]['id_sms'], //update
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_mk'],
            $dataList[$i]['nm_kls'],
            $dataList[$i]['sks_mk'],
            $dataList[$i]['sks_tm'],
            $dataList[$i]['sks_prak'],
            $dataList[$i]['sks_prak_lap'],
            $dataList[$i]['sks_sim'],
            $dataList[$i]['bahasan_case'],
            $dataList[$i]['tgl_mulai_koas'],
            $dataList[$i]['tgl_selesai_koas'],
            $dataList[$i]['id_mou'],
            $dataList[$i]['a_selenggara_pditt'],
            $dataList[$i]['kuota_pditt'],
            $dataList[$i]['a_pengguna_pditt'],
            $dataList[$i]['id_kls_pditt'],
            $gt_id
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalKelasKuliah'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'Sukses';
      }else{
         return 'Gagal';
      }
   }

   function syncAwalAjarDosenInsertGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $semidPelaporan = $dataParam[0];

      $data = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalAjarDosenInsertGetInfoRow'], array($semidPelaporan));
      return $data[0]['BANYAK'];
   }

   function syncAwalAjarDosenInsertGetData(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['semidPelaporan'],
         $dataParam['offsetProses'],
         $dataParam['limitProses']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalAjarDosenInsertGetData'], $p);
   }

   function syncAwalAjarDosen(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_ajar'],
            $dataList[$i]['id_reg_ptk'],
            $dataList[$i]['id_subst'],
            $dataList[$i]['id_kls'],
            $dataList[$i]['sks_subst_tot'],
            $dataList[$i]['sks_tm_subst'],
            $dataList[$i]['sks_prak_subst'],
            $dataList[$i]['sks_prak_lap_subst'],
            $dataList[$i]['sks_sim_subst'],
            $dataList[$i]['jml_tm_renc'],
            $dataList[$i]['jml_tm_real'],
            $dataList[$i]['id_jns_eval'],
            $dataList[$i]['id_reg_ptk'], //update
            $dataList[$i]['id_subst'],
            $dataList[$i]['id_kls'],
            $dataList[$i]['sks_subst_tot'],
            $dataList[$i]['sks_tm_subst'],
            $dataList[$i]['sks_prak_subst'],
            $dataList[$i]['sks_prak_lap_subst'],
            $dataList[$i]['sks_sim_subst'],
            $dataList[$i]['jml_tm_renc'],
            $dataList[$i]['jml_tm_real'],
            $dataList[$i]['id_jns_eval']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalAjarDosen'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'Sukses';
      }else{
         return 'Gagal';
      }
   }

   function syncAwalNilaiInsertGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $semidPelaporan = $dataParam[0];

      $data = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalNilaiInsertGetInfoRow'], array($semidPelaporan));
      return $data[0]['BANYAK'];
   }

   function syncAwalNilaiInsertGetData(){
      $dataParam = $this->GetProperty("DataProceed");
      $p = array(
         $dataParam['semidPelaporan'],
         $dataParam['offsetProses'],
         $dataParam['limitProses']
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalNilaiInsertGetData'], $p);
   }

   function syncAwalNilai(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;
      $arrInsert = array();

      for ($i=0; $i < count($dataList); $i++) {
         //get gt_id yaitu krsdtId terlebih dahulu
         $p = array(
            $dataList[$i]['id_kls'],
            $dataList[$i]['id_reg_pd']
         );
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalNilaiGetGtId'], $p);
         $gt_id = $dataId[0]['krsdtId'];

         //prep data
         if($dataParam[$i]['asal_data'] == "") $dataParam[$i]['asal_data'] = "str_ksg";
         if($dataParam[$i]['nilai_angka'] == "") $dataParam[$i]['nilai_angka'] = "str_ksg";
         if($dataParam[$i]['nilai_indeks'] == "") $dataParam[$i]['nilai_indeks'] = "str_ksg";
         if($gt_id == "") $gt_id = "str_ksg";

         //test
         //$dataList[$i]['asal_data'] = '5';

         $p = array(
            $dataList[$i]['id_kls'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['asal_data'],$dataList[$i]['asal_data'],
            $dataList[$i]['nilai_angka'],$dataList[$i]['nilai_angka'],
            $dataList[$i]['nilai_huruf'],
            $dataList[$i]['nilai_indeks'],$dataList[$i]['nilai_indeks'],
            $gt_id,$gt_id
         );
         //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalNilai'], $p);

         $arrInsert[] = "('".$dataList[$i]['id_kls']."','".$dataList[$i]['id_reg_pd']."',IF('".$dataList[$i]['asal_data']."'='str_ksg','9','".$dataList[$i]['asal_data']."'),IF('".$dataList[$i]['nilai_angka']."'='str_ksg','0','".$dataList[$i]['nilai_angka']."'),'".$dataList[$i]['nilai_huruf']."',IF('".$dataList[$i]['nilai_indeks']."'='str_ksg','0','".$dataList[$i]['nilai_indeks']."'),NOW(),NOW(),IF('".$gt_id."'='str_ksg','0','".$gt_id."'))";

         //check apakah harus insert or update
         /*
         $p = array(
            $dataList[$i]['id_kls'],
            $dataList[$i]['id_reg_pd']
         );
         $cekInsertUpdate = $this->GetAllDataAsArray($this->mSqlQueries['syncAwalNilaiCekInsertUpdate'], $p);
         if($cekInsertUpdate[0]['id_kls'] != ""){
            //update
            $p = array(
               $dataList[$i]['asal_data'],$dataList[$i]['asal_data'],
               $dataList[$i]['nilai_angka'],$dataList[$i]['nilai_angka'],
               $dataList[$i]['nilai_huruf'],
               $dataList[$i]['nilai_indeks'],$dataList[$i]['nilai_indeks'],
               $gt_id,$gt_id,
               $dataList[$i]['id_kls'],
               $dataList[$i]['id_reg_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalNilaiUpdate'], $p);
         }else{
            //insert
            $p = array(
               $dataList[$i]['id_kls'],
               $dataList[$i]['id_reg_pd'],
               $dataList[$i]['asal_data'],$dataList[$i]['asal_data'],
               $dataList[$i]['nilai_angka'],$dataList[$i]['nilai_angka'],
               $dataList[$i]['nilai_huruf'],
               $dataList[$i]['nilai_indeks'],$dataList[$i]['nilai_indeks'],
               $gt_id,$gt_id
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalNilaiInsert'], $p);
         }
         */
         //if($proses == FALSE) $prosesAll = FALSE;
      }
      $impDataInsert = implode(",",$arrInsert);
      $sqlNya = str_replace('[SYNC_NILAI_DATA_INSERT]', $impDataInsert, $this->mSqlQueries['syncAwalNilai']);
      $proses = $this->ExecuteInsertQuery($sqlNya, array());
      if($proses == FALSE) $prosesAll = FALSE;
      $this->CompleteTransaction($prosesAll);

      if($prosesAll == true){
         return 'Sukses';
      }else{
         return 'Gagal';
      }
   }

   function syncAwalInsertDataDiktiKuliahMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      //$semidPelaporan = $dataParam[0];

      return $this->GetAllDataAsArray($this->mSqlQueries['syncAwalInsertDataDiktiKuliahMhs'], array());
   }

   function syncAwalKuliahMhs(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['ips'],
            $dataList[$i]['sks_smt'],
            $dataList[$i]['ipk'],
            $dataList[$i]['sks_total'],
            $dataList[$i]['id_stat_mhs'],
            $dataList[$i]['ips'], //update
            $dataList[$i]['sks_smt'],
            $dataList[$i]['ipk'],
            $dataList[$i]['sks_total'],
            $dataList[$i]['id_stat_mhs']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncAwalKuliahMhs'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'Sukses';
      }else{
         return 'Gagal';
      }
   }

   function setStatusSyncAwalDone(){
      $prosesUpdate = $this->ExecuteUpdateQuery($this->mSqlQueries['setStatusSyncAwalDone'], array());
      return $prosesUpdate;
   }

   function isTableExists(){
      $dataParam = $this->GetProperty("DataProceed");
      $table = $dataParam[0];
      $tables = $this->GetAllDataAsArray($this->mSqlQueries['isTableExists'], array($table));
      if (!empty($tables)){
         return true;
      }else{
         return false;
      }
   }

   function truncateTable(){
      $dataParam = $this->GetProperty("DataProceed");
      $table = $dataParam[0];
      $truncated = $this->ExecuteUpdateQuery($this->mSqlQueries['truncateTable'], array($table));
      if ($truncated){
         return true;
      }else{
         return false;
      }
   }
}
?>