<?php
/*
Author : Nikolius
Email : n1colius.lau@gmail.com
Date : 20-Jul-2015 10:24 AM
*/
require_once $cfg->mValue['docroot'] . "module/sia_setting/business/sia_setting.class.php";
class Apps_proses_utama extends SiaSetting {

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_agama'],
            $dataList[$i]['nm_agama'],
            $dataList[$i]['nm_agama']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefAgama'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_bp'],
            $dataList[$i]['nm_bp'],
            $dataList[$i]['a_jenj_paud'],
            $dataList[$i]['a_jenj_tk'],
            $dataList[$i]['a_jenj_sd'],
            $dataList[$i]['a_jenj_smp'],
            $dataList[$i]['a_jenj_sma'],
            $dataList[$i]['a_jenj_tinggi'],
            $dataList[$i]['dir_bina'],
            $dataList[$i]['a_aktif'],
            $dataList[$i]['nm_bp'], //update
            $dataList[$i]['a_jenj_paud'],
            $dataList[$i]['a_jenj_tk'],
            $dataList[$i]['a_jenj_sd'],
            $dataList[$i]['a_jenj_smp'],
            $dataList[$i]['a_jenj_sma'],
            $dataList[$i]['a_jenj_tinggi'],
            $dataList[$i]['dir_bina'],
            $dataList[$i]['a_aktif']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefBentukPend'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_ikatan_kerja'],
            $dataList[$i]['nm_ikatan_kerja'],
            $dataList[$i]['ket_ikatan_kerja'],
            $dataList[$i]['nm_ikatan_kerja'],
            $dataList[$i]['ket_ikatan_kerja']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefIktKerjaDosen'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jabfung'],
            $dataList[$i]['nm_jabfung'],
            $dataList[$i]['nm_jabfung']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJabFung'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jns_eval'],
            $dataList[$i]['nm_jns_eval'],
            $dataList[$i]['ket_jns_eval'],
            $dataList[$i]['nm_jns_eval'],
            $dataList[$i]['ket_jns_eval']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJnsEva'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jns_keluar'],
            $dataList[$i]['ket_keluar'],
            $dataList[$i]['a_pd'],
            $dataList[$i]['a_ptk'],
            $dataList[$i]['ket_keluar'],
            $dataList[$i]['a_pd'],
            $dataList[$i]['a_ptk']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJnsKeluar'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jns_daftar'],
            $dataList[$i]['nm_jns_daftar'],
            $dataList[$i]['u_daftar_sekolah'],
            $dataList[$i]['u_daftar_rombel'],
            $dataList[$i]['nm_jns_daftar'],
            $dataList[$i]['u_daftar_sekolah'],
            $dataList[$i]['u_daftar_rombel']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJnsPendaf'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jns_sert'],
            $dataList[$i]['id_kk'],
            $dataList[$i]['nm_jns_sert'],
            $dataList[$i]['u_prof_guru'],
            $dataList[$i]['u_kepsek'],
            $dataList[$i]['u_laboran'],
            $dataList[$i]['u_prof_dosen'],
            $dataList[$i]['id_kk'],
            $dataList[$i]['nm_jns_sert'],
            $dataList[$i]['u_prof_guru'],
            $dataList[$i]['u_kepsek'],
            $dataList[$i]['u_laboran'],
            $dataList[$i]['u_prof_dosen']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJnsSert'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jns_sms'],
            $dataList[$i]['nm_jns_sms'],
            $dataList[$i]['nm_jns_sms']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJnsSms'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jns_subst'],
            $dataList[$i]['nm_jns_subst'],
            $dataList[$i]['nm_jns_subst']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJnsSubst'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['nm_jenj_didik'],
            $dataList[$i]['u_jenj_lemb'],
            $dataList[$i]['u_jenj_org'],
            $dataList[$i]['nm_jenj_didik'],
            $dataList[$i]['u_jenj_lemb'],
            $dataList[$i]['u_jenj_org']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJenjangPend'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jur'],
            $dataList[$i]['nm_jur'],
            $dataList[$i]['nm_intl_jur'],
            $dataList[$i]['u_sma'],
            $dataList[$i]['u_smk'],
            $dataList[$i]['u_pt'],
            $dataList[$i]['u_slb'],
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['id_induk_jurusan'],
            $dataList[$i]['id_kel_bidang'],
            $dataList[$i]['nm_jur'],
            $dataList[$i]['nm_intl_jur'],
            $dataList[$i]['u_sma'],
            $dataList[$i]['u_smk'],
            $dataList[$i]['u_pt'],
            $dataList[$i]['u_slb'],
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['id_induk_jurusan'],
            $dataList[$i]['id_kel_bidang']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefJurusan'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

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

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'Sync Oke';
      }else{
         return 'Sync Fail';
      }
   }

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_lemb_angkat'],
            $dataList[$i]['nm_lemb_angkat'],
            $dataList[$i]['nm_lemb_angkat']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefLembagaPeng'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_level_wil'],
            $dataList[$i]['nm_level_wilayah'],
            $dataList[$i]['nm_level_wilayah']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefLvlWil'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_negara'],
            $dataList[$i]['nm_negara'],
            $dataList[$i]['a_ln'],
            $dataList[$i]['nm_negara'],
            $dataList[$i]['a_ln']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefNegara'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_pangkat_gol'],
            $dataList[$i]['kode_gol'],
            $dataList[$i]['nm_pangkat'],
            $dataList[$i]['kode_gol'],
            $dataList[$i]['nm_pangkat']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefPangGol'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_pekerjaan'],
            $dataList[$i]['nm_pekerjaan'],
            $dataList[$i]['nm_pekerjaan']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefPkerja'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_penghasilan'],
            $dataList[$i]['nm_penghasilan'],
            $dataList[$i]['batas_bawah'],
            $dataList[$i]['batas_atas'],
            $dataList[$i]['nm_penghasilan'],
            $dataList[$i]['batas_bawah'],
            $dataList[$i]['batas_atas']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefPhasil'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_thn_ajaran'],
            $dataList[$i]['nm_smt'],
            $dataList[$i]['smt'],
            $dataList[$i]['a_periode_aktif'],
            $dataList[$i]['tgl_mulai'],
            $dataList[$i]['tgl_selesai'],
            $dataList[$i]['id_thn_ajaran'],
            $dataList[$i]['nm_smt'],
            $dataList[$i]['smt'],
            $dataList[$i]['a_periode_aktif'],
            $dataList[$i]['tgl_mulai'],
            $dataList[$i]['tgl_selesai']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefSemester'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_stat_aktif'],
            $dataList[$i]['nm_stat_aktif'],
            $dataList[$i]['nm_stat_aktif']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefStsAktifPeg'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_stat_pegawai'],
            $dataList[$i]['nm_stat_pegawai'],
            $dataList[$i]['nm_stat_pegawai']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefStsKepeg'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_stat_mhs'],
            $dataList[$i]['nm_stat_mhs'],
            $dataList[$i]['ket_stat_mhs'],
            $dataList[$i]['nm_stat_mhs'],
            $dataList[$i]['ket_stat_mhs']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefStsMhs'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_thn_ajaran'],
            $dataList[$i]['nm_thn_ajaran'],
            $dataList[$i]['a_periode_aktif'],
            $dataList[$i]['tgl_mulai'],
            $dataList[$i]['tgl_selesai'],
            $dataList[$i]['nm_thn_ajaran'],
            $dataList[$i]['a_periode_aktif'],
            $dataList[$i]['tgl_mulai'],
            $dataList[$i]['tgl_selesai']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefThnAjaran'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_wil'],
            $dataList[$i]['nm_wil'],
            $dataList[$i]['asal_wil'],
            $dataList[$i]['kode_bps'],
            $dataList[$i]['kode_dagri'],
            $dataList[$i]['kode_keu'],
            $dataList[$i]['id_induk_wilayah'],
            $dataList[$i]['id_level_wil'],
            $dataList[$i]['id_negara'],
            $dataList[$i]['nm_wil'],
            $dataList[$i]['asal_wil'],
            $dataList[$i]['kode_bps'],
            $dataList[$i]['kode_dagri'],
            $dataList[$i]['kode_keu'],
            $dataList[$i]['id_induk_wilayah'],
            $dataList[$i]['id_level_wil'],
            $dataList[$i]['id_negara']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['syncDataRefWilayah'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == true){
         return 'Sync Oke';
      }else{
         return 'Sync Fail';
      }
   }

   function crawlInsertMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $kodePt = $dataParam[0];
      $tahun = $dataParam[1];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sqlMhs = $this->mSqlQueries['crawlInsertMhsGetInsertList'];
      $tahun = implode(",", $tahun);
      $sqlMhsWhere = ' mhsAngkatan IN ('.$tahun.')';
      $sqlMhs = str_replace("[SQL_WHERE_DATA]", $sqlMhsWhere, $sqlMhs);
      //$semidPelaporan = $dataParam[1];
      $rowEffected = 0;
      $this->StartTransaction();

      //insert data crawl "mahasiswa" ================
      //$dataForInsertMhs = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertMhsGetInsertList'], array());
      $dataForInsertMhs = $this->ExecuteInsertQuery($sqlMhs, array());
      $rowEffected = $this->getAffectedRow();

      //insert data crawl "mahasiswa" ================
      $sqlMhsPt = $this->mSqlQueries['crawlInsertMhsPtGetInsertList'];
      $sqlMhsPtWhere = ' mhsAngkatan IN ('.$tahun.')';
      $sqlMhsPt = str_replace("[SQL_WHERE_DATA]", $sqlMhsPtWhere, $sqlMhsPt);
      //$dataForInsertMhsPt = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertMhsPtGetInsertList'], array());
      $dataForInsertMhsPt = $this->ExecuteInsertQuery($sqlMhsPt, array());
      //get data for insert to mahasiswa dan mahasiswa_pt
      #$dataForInsert = $this->GetAllDataAsArray($this->mSqlQueries['crawlInsertMhsGetInsertList'], array());

      $prosesInsert = $dataForInsertMhs && $dataForInsertMhsPt;
      $this->CompleteTransaction($prosesInsert);
      if($prosesInsert == false){
         $rowEffected = 0;
      }

      $arrReturn['prosesNya'] = $prosesInsert;
      $arrReturn['rowEfek'] = $rowEffected;
      return $arrReturn;

      /*
      //insert kan ke tabel feeder sia
      //$this->StartTransaction();
      $prosesInsert = true;
      $rowEffected = 0;

      for ($i=0; $i < count($dataForInsert); $i++) {
         if($dataForInsert[$i]['nm_pd'] != ""){
            //insert mahasiswa
            $p = array(
               $dataForInsert[$i]['regpd_nipd'].'temp',
               $dataForInsert[$i]['nm_pd'],
               $dataForInsert[$i]['jk'],
               $dataForInsert[$i]['nisn'],
               $dataForInsert[$i]['nik'],
               $dataForInsert[$i]['tmpt_lahir'],
               $dataForInsert[$i]['tgl_lahir'],
               $dataForInsert[$i]['id_agama'],
               $dataForInsert[$i]['id_kk'],
               $dataForInsert[$i]['id_sp'],
               $dataForInsert[$i]['jln'],
               $dataForInsert[$i]['rt'],
               $dataForInsert[$i]['rw'],
               $dataForInsert[$i]['nm_dsn'],
               $dataForInsert[$i]['ds_kel'],
               $dataForInsert[$i]['id_wil'],
               $dataForInsert[$i]['kode_pos'],
               $dataForInsert[$i]['id_jns_tinggal'],
               $dataForInsert[$i]['telepon_rumah'],
               $dataForInsert[$i]['telepon_seluler'],
               $dataForInsert[$i]['email'],
               $dataForInsert[$i]['a_terima_kps'],
               $dataForInsert[$i]['no_kps'],
               $dataForInsert[$i]['stat_pd'],
               $dataForInsert[$i]['nm_ayah'],
               $dataForInsert[$i]['tgl_lahir_ayah'],
               $dataForInsert[$i]['id_jenjang_pendidikan_ayah'],
               $dataForInsert[$i]['id_pekerjaan_ayah'],
               $dataForInsert[$i]['id_penghasilan_ayah'],
               $dataForInsert[$i]['id_kebutuhan_khusus_ayah'],
               $dataForInsert[$i]['nm_ibu_kandung'],
               $dataForInsert[$i]['tgl_lahir_ibu'],
               $dataForInsert[$i]['id_jenjang_pendidikan_ibu'],
               $dataForInsert[$i]['id_penghasilan_ibu'],
               $dataForInsert[$i]['id_pekerjaan_ibu'],
               $dataForInsert[$i]['id_kebutuhan_khusus_ibu'],
               $dataForInsert[$i]['nm_wali'],
               $dataForInsert[$i]['tgl_lahir_wali'],
               $dataForInsert[$i]['id_jenjang_pendidikan_wali'],
               $dataForInsert[$i]['id_pekerjaan_wali'],
               $dataForInsert[$i]['id_penghasilan_wali'],
               $dataForInsert[$i]['kewarganegaraan']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertFeederSiaMahasiswa'], $p);
            if($proses == false) {
               $prosesInsert = false;
            }else{
               $rowEffected++;
            }


            //insert mahasiswa_pt
            $p = array(
               $dataForInsert[$i]['regpd_nipd'].'temp_pt',
               $dataForInsert[$i]['regpd_id_sms'],
               $dataForInsert[$i]['regpd_nipd'].'temp',
               $dataForInsert[$i]['regpd_id_sp'],
               $dataForInsert[$i]['regpd_id_jns_daftar'],
               $dataForInsert[$i]['regpd_nipd'],
               $dataForInsert[$i]['regpd_tgl_masuk_sp'],
               $dataForInsert[$i]['regpd_ket'],
               $dataForInsert[$i]['regpd_skhun'],
               $dataForInsert[$i]['regpd_a_pernah_paud'],
               $dataForInsert[$i]['regpd_a_pernah_tk'],
               $dataForInsert[$i]['regpd_mulai_smt'],
               $dataForInsert[$i]['regpd_sks_diakui'],
               $dataForInsert[$i]['regpd_jalur_skripsi'],
               $dataForInsert[$i]['regpd_judul_skripsi'],
               $dataForInsert[$i]['regpd_bln_awal_bimbingan'],
               $dataForInsert[$i]['regpd_bln_akhir_bimbingan'],
               $dataForInsert[$i]['regpd_ipk'],
               $dataForInsert[$i]['regpd_a_pindah_mhs_asing'],
               $dataForInsert[$i]['regpd_nm_pt_asal'],
               $dataForInsert[$i]['regpd_nm_prodi_asal']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertFeederSiaMahasiswaPt'], $p);
            if($proses == false) $prosesInsert = false;
         }
      }

      $this->CompleteTransaction($prosesInsert);
      if($prosesInsert == false){
         $rowEffected = 0;
      }

      $arrReturn['prosesNya'] = $prosesInsert;
      $arrReturn['rowEfek'] = $rowEffected;
      return $arrReturn;
      */
   }

   function dataListHasilCrawlInsertMhsTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNamaMhs = $dataParam[2];
      $tahun = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMhsTotalRows'];

      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (mahasiswa.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " mahasiswa.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         if($sqlWhere=="")
            {$sqlWhere .= " (mahasiswa.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= "  AND (mahasiswa.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ($sqlWhere == '') ?
         ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ' : ' AND LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';

      if($filterNamaMhs != '' && $filterNamaMhs !=null){
         $filterNamaMhs = ' mahasiswa.`nm_pd` LIKE "%'.$filterNamaMhs.'%"';
      }

      // return $filterNamaMhs;
      if($sqlWhere!='' AND $sqlWhere !=null)
      {
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql); 
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" AND ".$filterNamaMhs;
         }
      }
      else{
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" WHERE ".$filterNamaMhs;
         }
      }
      $p = array(
         $filterNamaMhs
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlInsertMhsPtTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNamaMhs = $dataParam[2];
      $tahun = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMhsPtTotalRows'];

      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (mahasiswa_pt.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " mahasiswa_pt.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         if($sqlWhere=="")
            {$sqlWhere .= " (mahasiswa_pt.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= "  AND (mahasiswa_pt.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ($sqlWhere == '') ?
         ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ' : ' AND LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';

      if($filterNamaMhs != '' && $filterNamaMhs !=null){
         $filterNamaMhs = ' mahasiswa.`nm_pd` LIKE "%'.$filterNamaMhs.'%"';
      }

      // return $filterNamaMhs;
      if($sqlWhere!='' AND $sqlWhere !=null)
      {
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql); 
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" AND ".$filterNamaMhs;
         }
      }
      else{
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" WHERE ".$filterNamaMhs;
         }
      }
      $p = array(
         $filterNamaMhs
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlInsertMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNamaMhs = $dataParam[2];
      $offset = $dataParam[3];
      $limit = $dataParam[4];
      $tahun = $dataParam[5];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMhs'];
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (mahasiswa.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " mahasiswa.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete" ) ){
         if($sqlWhere=="")
            {$sqlWhere .= " (mahasiswa.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= "  AND (mahasiswa.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }

      if($filterNamaMhs != '' && $filterNamaMhs !=null){
         $filterNamaMhs = ' mahasiswa.`nm_pd` LIKE "%'.$filterNamaMhs.'%"';
      }

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ($sqlWhere == '') ?
         ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ' : ' AND LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';

      // return $filterNamaMhs;
      if($sqlWhere!='' AND $sqlWhere !=null)
      {
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql); 
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" AND ".$filterNamaMhs;
         }
      }
      else{
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" WHERE ".$filterNamaMhs;
         }
      }
      
      $p = array(
         $filterNamaMhs,
         (int) $offset,
         (int) $limit
      );
      $params = $this->QuoteHandler($p);
 
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlInsertMhsPt(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNamaMhs = $dataParam[2];
      $offset = $dataParam[3];
      $limit = $dataParam[4];
      $tahun = $dataParam[5];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMhsPt'];
      $sqlWhere = "";
      if($filterStatusData == "default"){
         $sqlWhere .= " (mahasiswa_pt.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere .= " mahasiswa_pt.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete" ) ){
         if($sqlWhere=="")
            {$sqlWhere .= " (mahasiswa_pt.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= "  AND (mahasiswa_pt.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ($sqlWhere == '') ?
         ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ' : ' AND LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';

      if($filterNamaMhs != '' && $filterNamaMhs !=null){
         $filterNamaMhs = ' mahasiswa.`nm_pd` LIKE "%'.$filterNamaMhs.'%"';
      }

      // return $filterNamaMhs;
      if($sqlWhere!='' AND $sqlWhere !=null)
      {
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql); 
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" AND ".$filterNamaMhs;
         }
      }
      else{
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" WHERE ".$filterNamaMhs;
         }
      }
      
      $p = array(
         $filterNamaMhs,
         (int) $offset,
         (int) $limit
      );
      $params = $this->QuoteHandler($p);
 
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlInsertMhsXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNamaMhs = $dataParam[2];
      $tahun = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMhsXls'];

      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (mahasiswa.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " mahasiswa.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         if($sqlWhere=="")
            {$sqlWhere .= " (mahasiswa.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= "  AND (mahasiswa.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ($sqlWhere == '') ?
         ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ' : ' AND LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';

      if($filterNamaMhs != '' && $filterNamaMhs !=null){
         $filterNamaMhs = ' mahasiswa.`nm_pd` LIKE "%'.$filterNamaMhs.'%"';
      }

      // return $filterNamaMhs;
      if($sqlWhere!='' AND $sqlWhere !=null)
      {
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql); 
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" AND ".$filterNamaMhs;
         }
      }
      else{
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" WHERE ".$filterNamaMhs;
         }
      }
      $p = array(
         $filterNamaMhs
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function dataListHasilCrawlInsertMhsPtXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNamaMhs = $dataParam[2];
      $tahun = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMhsPtXls'];

      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (mahasiswa_pt.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " mahasiswa_pt.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         if($sqlWhere=="")
            {$sqlWhere .= " (mahasiswa_pt.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= "  AND (mahasiswa_pt.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ($sqlWhere == '') ?
         ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ' : ' AND LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';

      if($filterNamaMhs != '' && $filterNamaMhs !=null){
         $filterNamaMhs = ' mahasiswa.`nm_pd` LIKE "%'.$filterNamaMhs.'%"';
      }

      // return $filterNamaMhs;
      if($sqlWhere!='' AND $sqlWhere !=null)
      {
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql); 
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" AND ".$filterNamaMhs;
         }
      }
      else{
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
         if($filterNamaMhs != '' && $filterNamaMhs !=null){
            $filterNamaMhs=" WHERE ".$filterNamaMhs;
         }
      }
      $p = array(
         $filterNamaMhs
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function setDeleteCrawlDataMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_pd = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteMhs'],array($id_pd));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_pd'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_pd
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_pd
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataMhs'], $p);
      if($proses == false) $prosesUpdate = false;

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataMhsPt'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_pt = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $aksiNya = "not_active";

         //update mahasiswa_pt
         $p = array(
            "not_active",
            "none",
            $id_pt
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhsPt'], $p);
         if($proses == false) $prosesUpdate = false;

         //update mahasiswa
         $p = array(
            "not_active",
            "none",
            $id_pt
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhs'], $p);
         if($proses == false) $prosesUpdate = false;
      }else{
         $aksiNya = "default";

         //update mahasiswa_pt
         $p = array(
            "default",
            "insert",
            $id_pt
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhsPt'], $p);
         if($proses == false) $prosesUpdate = false;

         //update mahasiswa
         $p = array(
            "default",
            "insert",
            $id_pt
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhs'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataMhsProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdPd = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdPd = substr(trim($rangeIdPd), 0, -1);
      $arrTemp = explode('@',$rangeIdPd);
      $impIdPd = implode("','",$arrTemp);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               "none",
               $arrTemp[$i]
            );
         }else{
            $p = array(
               "default",
               "insert",
               $arrTemp[$i]
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhsPtProAll'], $p);
         if($proses == false) $prosesUpdate = false;

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhsProAll'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataMhsPt(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_pt = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $aksiNya = "not_active";
         $p = array(
            "not_active",
            "none",
            $id_pt
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhsPt'], $p);
         if($proses == false) $prosesUpdate = false;
      }else{
         $aksiNya = "default";
         $p = array(
            "default",
            "insert",
            $id_pt
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhsPt'], $p);
         if($proses == false) $prosesUpdate = false;
      }
      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataMhsPtProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdPd = $dataParam[0];
      $setAksi = $dataParam[1];
      $rangeIdPd = substr(trim($rangeIdPd), 0, -1);
      $arrTemp = explode('@',$rangeIdPd);
      $impIdPd = implode("','",$arrTemp);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               "none",
               $arrTemp[$i]
            );
         }else{
            $p = array(
               "default",
               "insert",
               $arrTemp[$i]
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMhsPtProAll'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlInsertMhsGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $sqlWhere = '';
      $sql = $this->mSqlQueries['getDataSyncCrawlInsertMhsGetInfoRow'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $result = $this->GetAllDataAsArray($sql, array());
      return $result[0]['BANYAK'];
   }

   function getDataSyncCrawlInsertMhsGetInfoRow2(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $sqlWhere = '';
      $sql = $this->mSqlQueries['getDataSyncCrawlInsertMhsGetInfoRow2'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $result = $this->GetAllDataAsArray($sql, array());
      return $result[0]['BANYAK'];
   }

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

   function getDataSyncCrawlMhsPt(){
      $dataParam = $this->GetProperty("DataProceed");
      $offset = $dataParam[0];
      $limit = $dataParam[1];
      $mode = $dataParam[2];
      $tahun = $dataParam[3];
      $sqlWhere = '';
      $sql = $this->mSqlQueries['getDataSyncCrawlMhsPt'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $mode,
         (int) $offset,
         (int) $limit
      );

      // $params=$p;
      // $sql = $this->mSqlQueries['getDataSyncCrawlMhsPt'];

      // $sql_parsed = "";
      //    $params = $this->QuoteHandler($params);
      //    $param_serialized = join("','",$params);
      //    eval('$sql_parsed = sprintf("'.$sql.'",\''.$param_serialized.'\');');
      //    return $sql_parsed;
      return $this->GetAllDataAsArray($sql, $p);
   }

   function updateAfterSyncCrawlDeleteMhsPt(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_reg_pd']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_reg_pd']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlDeleteMhsPt'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $offset = $dataParam[0];
      $limit = $dataParam[1];
      $mode = $dataParam[2];
      $tahun = $dataParam[3];

      $sqlWhere = '';
      $sql = $this->mSqlQueries['getDataSyncCrawlMhs'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $mode,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function updateAfterSyncCrawlDeleteMhs(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_pd']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_pd']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlDeleteMhs'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlInsertMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      $sql = $this->mSqlQueries['getDataSyncCrawlInsertMhs'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      //get data for insert to mahasiswa dan mahasiswa_pt
      $p = array(
         (int) $offsetProses,
         (int) $limitProses
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function getDataSyncCrawlInsertMhsPt(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];

      $sql = $this->mSqlQueries['getDataSyncCrawlInsertMhsPt'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      //get data for insert to mahasiswa dan mahasiswa_pt
      $p = array(
         (int) $offsetProses,
         (int) $limitProses
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function getDataSyncCrawlInsertMhsPtStatusSkip(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];

      //get data for insert to mahasiswa dan mahasiswa_pt
      $p = array(
         (int) $offsetProses,
         (int) $limitProses
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertMhsPtStatusSkip'], $p);
   }

   function updateAfterSyncCrawlMhs(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            /*$p = array(
               $dataList[$i]['pddikti_id_reg_pd'],
               $dataList[$i]['pddikti_id_pd'],
               'sukses',
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsPt'], $p);
            if($proses == false) $prosesUpdate = false;*/

            $p = array(
               $dataList[$i]['pddikti_id_pd'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhs'], $p);
            if($proses == false) $prosesUpdate = false;
            
            $p = array(
               $dataList[$i]['pddikti_id_pd'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsIdpdMhspt'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            /*$p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsPtGagal'], $p);
            if($proses == false) $prosesUpdate = false;*/

            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsGagal'], $p);
            if($proses == false) $prosesUpdate = false;
            
            if ($dataList[$i]['error_code'] == '200') { //Mahasiswa dengan nama, tempat, tanggal lahir dan ibu kandung yang sama sudah ada
               $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateStatusDataMhs'], array($dataList[$i]['unikKey']));
               if($proses == false) $prosesUpdate = false;
            }
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }
   
   function updateAfterSyncCrawlMhs2(){
      $dataList = $this->GetProperty("DataProceed");
      //return($dataList);
      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               $dataList[$i]['pddikti_id_reg_pd'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsPt'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsPtGagal'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function updateAfterSyncCrawlMhs2StatusSkip(){
      $dataList = $this->GetProperty("DataProceed");
      //return($dataList);
      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               $dataList[$i]['pddikti_id_reg_pd'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsPt'], $p);
            if($proses == false) $prosesUpdate = false;
            
            $p = array(
               $dataList[$i]['id_pd'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsStatusSkip'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsPtGagal'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function showCrawlUpdateMahasiswaGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $sql = $this->mSqlQueries['showCrawlUpdateMahasiswaGetInfoRow'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mhs_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array());
      return $data[0]['BANYAK'];
   }

   function showCrawlUpdateMahasiswa(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      $sql = $this->mSqlQueries['showCrawlUpdateMahasiswaGetDataList'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mhs_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      //$this->StartTransaction();
      $prosesAll = true;

      $dataList = $this->GetAllDataAsArray($sql, array($offsetProses,$limitProses));

      //return $dataList;
      $successMhs = array();
      $successMhsPt = array();
      $errorMhs = array();
      $errorMhsPt = array();

      for ($i=0; $i < count($dataList); $i++) {
         //mahasiswa
         $this->StartTransaction();
         $p = array(
            $dataList[$i]['nipd'],
            $dataList[$i]['id_pd']
         );
         $dataMahasiswa = $this->GetAllDataAsArray($this->mSqlQueries['showCrawlUpdateMahasiswaGetDataMhs'], $p);

         //update nya
         $p = array(
            $dataMahasiswa[0]['nm_pd'],
            $dataMahasiswa[0]['jk'],
            $dataMahasiswa[0]['nisn'],
            $dataMahasiswa[0]['nik'],
            $dataMahasiswa[0]['tmpt_lahir'],
            $dataMahasiswa[0]['tgl_lahir'],
            $dataMahasiswa[0]['id_agama'],
            $dataMahasiswa[0]['id_kk'],
            $dataMahasiswa[0]['jln'],
            $dataMahasiswa[0]['rt'],
            $dataMahasiswa[0]['rw'],
            $dataMahasiswa[0]['nm_dsn'],
            $dataMahasiswa[0]['ds_kel'],
            $dataMahasiswa[0]['id_wil'],
            $dataMahasiswa[0]['kode_pos'],
            $dataMahasiswa[0]['id_jns_tinggal'],
            $dataMahasiswa[0]['telepon_rumah'],
            $dataMahasiswa[0]['telepon_seluler'],
            $dataMahasiswa[0]['email'],
            $dataMahasiswa[0]['a_terima_kps'],
            $dataMahasiswa[0]['no_kps'],
            $dataMahasiswa[0]['stat_pd'],
            $dataMahasiswa[0]['nm_ayah'],
            $dataMahasiswa[0]['tgl_lahir_ayah'],
            $dataMahasiswa[0]['id_jenjang_pendidikan_ayah'],
            $dataMahasiswa[0]['id_pekerjaan_ayah'],
            $dataMahasiswa[0]['id_penghasilan_ayah'],
            $dataMahasiswa[0]['id_kebutuhan_khusus_ayah'],
            $dataMahasiswa[0]['nm_ibu_kandung'],
            $dataMahasiswa[0]['tgl_lahir_ibu'],
            $dataMahasiswa[0]['id_jenjang_pendidikan_ibu'],
            $dataMahasiswa[0]['id_penghasilan_ibu'],
            $dataMahasiswa[0]['id_pekerjaan_ibu'],
            $dataMahasiswa[0]['id_kebutuhan_khusus_ibu'],
            $dataMahasiswa[0]['nm_wali'],
            $dataMahasiswa[0]['tgl_lahir_wali'],
            $dataMahasiswa[0]['id_jenjang_pendidikan_wali'],
            $dataMahasiswa[0]['id_pekerjaan_wali'],
            $dataMahasiswa[0]['id_penghasilan_wali'],
            $dataMahasiswa[0]['kewarganegaraan'],
            $dataList[$i]['id_pd']
         );
         $updateMhs = $this->ExecuteUpdateQuery($this->mSqlQueries['updateCrawlUpdateMahasiswa'], $p);
         //if($updateMhs == false) $prosesAll = false;
         $this->CompleteTransaction($updateMhs);
         if ($updateMhs){
            $successMhs[] = 1;
         }else{
            $errorMhs[] = 1;
         }

         $this->StartTransaction();
         //mahasiswa_pt
         $p = array(
            $dataList[$i]['nipd'],
            $dataList[$i]['id_reg_pd']
         );
         $dataMahasiswaPt = $this->GetAllDataAsArray($this->mSqlQueries['showCrawlUpdateMahasiswaGetDataMhsPt'], $p);

         //update nya
         $p = array(
            $dataMahasiswaPt[0]['id_sms'],
            $dataMahasiswaPt[0]['id_jns_daftar'],
            $dataMahasiswaPt[0]['tgl_masuk_sp'],
            $dataMahasiswaPt[0]['id_keluar'],
            $dataMahasiswaPt[0]['tgl_keluar'],
            $dataMahasiswaPt[0]['ket'],
            $dataMahasiswaPt[0]['skhun'],
            $dataMahasiswaPt[0]['a_pernah_paud'],
            $dataMahasiswaPt[0]['a_pernah_tk'],
            $dataMahasiswaPt[0]['mulai_smt'],
            $dataMahasiswaPt[0]['sks_diakui'],
            $dataMahasiswaPt[0]['jalur_skripsi'],
            $dataMahasiswaPt[0]['judul_skripsi'],
            $dataMahasiswaPt[0]['bln_awal_bimbingan'],
            $dataMahasiswaPt[0]['bln_akhir_bimbingan'],
            $dataMahasiswaPt[0]['sk_yudisium'],
            $dataMahasiswaPt[0]['tgl_sk_yudisium'],
            $dataMahasiswaPt[0]['ipk'],
            $dataMahasiswaPt[0]['no_seri_ijazah'],
            $dataMahasiswaPt[0]['a_pindah_mhs_asing'],
            $dataMahasiswaPt[0]['nm_pt_asal'],
            $dataMahasiswaPt[0]['nm_prodi_asal'],
            $dataList[$i]['id_reg_pd']
         );
         $updateMhsPt = $this->ExecuteUpdateQuery($this->mSqlQueries['updateCrawlUpdateMahasiswaPt'], $p);
         $this->CompleteTransaction($updateMhsPt);
         if ($updateMhs){
            $successMhsPt[] = 1;
         }else{
            $errorMhsPt[] = 1;
         }
         //if($updateMhsPt == false) $prosesAll = false;
      }

      //$this->CompleteTransaction($prosesAll);
      $response = array(
         'mahasiswa' => array(
            'success' => count($successMhs),
            'error' => count($errorMhs)
            ),
         'mahasiswa_pt' => array(
            'success' => count($successMhsPt),
            'error' => count($errorMhsPt)
            )
         );
      return $response;
   }

   function showSyncDataCrawlUpdateMahasiswaGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $sql = $this->mSqlQueries['showSyncDataCrawlUpdateMahasiswaGetInfoRow'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array());
      return $data[0]['BANYAK'];
   }

   function prosesSyncDataUpdateMhsGetDataList(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];

      $sql = $this->mSqlQueries['prosesSyncDataUpdateMhsGetDataList'];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mhs_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      return $this->GetAllDataAsArray($sql, array($offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlUpdateDataMhs(){
      //return true;
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMhs'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMhs'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function updateAfterSyncCrawlUpdateDataMhsPt(){
      //return true;
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_reg_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMhsPt'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_reg_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMhsPt'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertMhsUpdateStatusAfterProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $sql = $this->mSqlQueries['getStatusAfterProsesCrawlInsertMhs'];

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mahasiswa_pt.mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $this->StartTransaction();
      $prosesAll = true;
      $proses = true;

      //tabel mahasiswa
      $dataList = $this->GetAllDataAsArray($sql, array());
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertMhs'], $p);
            if($proses == false) $prosesAll = false;
         }
      }
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertMhs'], array()); // ini dikomen agar yg gagal biarkan statusnya tetap gagal
      if($proses == false) $prosesAll = false;

      //tabel mahasiswa_pt
      // mhs_pt biarkan tetap status insert, krn blm diproses 
      /*$dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertMhsPt'], array());
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_reg_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertMhsPt'], $p);
            if($proses == false) $prosesAll = false;
         }
      }*/
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertMhsPt'], array()); // ini dikomen agar yg gagal biarkan statusnya tetap gagal
      if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

   function syncCrawlInsertMhsUpdateStatusAfterProses2(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $sql = $this->mSqlQueries['resetCrawlStatusInsertMhsPt'];

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $this->StartTransaction();
      $prosesAll = true;

      //tabel mahasiswa
      $prosesAll = $this->ExecuteUpdateQuery($sql, array());

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

   //repair mhs
   function dataListMhsFailTotalRows(){
      $params = $this->GetProperty('DataProceed');
      $nama = $params[0];
      $tahun = $params[1];
      $sql = $this->mSqlQueries['dataListMhsFailTotalRows'];

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array('%'.$nama.'%'));
      return $data[0]['BANYAK'];
   }

   function dataListMhsFail(){
      $params = $this->GetProperty('DataProceed');
      $nama = '%'.$params[0].'%';
      $offset = $params[1];
      $rows = $params[2];
      $tahun = $params[3];
      $sql = $this->mSqlQueries['dataListMhsFail'];

      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere .= ' LEFT(mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array($nama, $offset, $rows));
      return $data;
   }

   function repairMhsFail(){
      $params = $this->GetProperty('DataProceed');
      $id_pd_store = $params[0];
      $id_pd_old = $params[1];
      $update = $this->ExecuteUpdateQuery($this->mSqlQueries['repairMhsFail'], array($id_pd_store, $id_pd_store, $id_pd_old, $id_pd_old));
      return $update;
   }

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

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

      //cek satu2 untuk setiap nilai di setiap prodinya.. jika belum ada di insertkan..jika sudah ada dilewatkan saja
      $paramInsert = 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['crawlInsertBobotNilaiCekNilaiFeeder'], $p);

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

      //insert kan ke tabel feeder sia
      $rowEffected = 0;
      $this->StartTransaction();
      $prosesInsert = true;

      for ($i=0; $i < count($paramInsert); $i++) {
         $p = array(
            $paramInsert[$i]['kode_bobot_nilai'],
            $paramInsert[$i]['id_sms'],
            $paramInsert[$i]['nilai_huruf'],
            $paramInsert[$i]['bobot_nilai_min'],
            $paramInsert[$i]['bobot_nilai_maks'],
            $paramInsert[$i]['nilai_indeks'],
            $paramInsert[$i]['tgl_mulai_efektif'],
            $paramInsert[$i]['tgl_akhir_efektif']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertBobotNilaiInsertFeeder'], $p);
         if($proses == false) $prosesInsert = false;
         $rowEffected += $this->getAffectedRow();
      }

      $this->CompleteTransaction($prosesInsert);*/
      
      $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertBobotNilaiInsertFeeder'], array());
      $rowEffected = $this->getAffectedRow();
      if($prosesInsert == false){   //return vsprintf($this->mSqlQueries['crawlInsertBobotNilaiInsertFeeder'], $a);
         $rowEffected = 0;
      }

      $arrReturn['prosesNya'] = $prosesInsert;
      $arrReturn['rowEfek'] = $rowEffected;
      return $arrReturn;
   }

   function dataListHasilCrawlInsertBobotNilaiTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $sql = $this->mSqlQueries['dataListHasilCrawlBobotNilaiTotalRows'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default')";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active'";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" || $filterStatusCrawl == "delete" ) ){
         if($sqlWhere=="")
            {$sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }
      if($sqlWhere!='' AND $sqlWhere !=null)
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql);
      else   $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql); 
      $result = $this->GetAllDataAsArray($sql, array());
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlInsertBobotNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $offset = $dataParam[2];
      $limit = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlBobotNilai'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" || $filterStatusCrawl == "insert" || $filterStatusCrawl == "delete" ) ){
         if($sqlWhere=="")
            {$sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }
      if($sqlWhere!='' AND $sqlWhere !=null)
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql);
      else   $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
     $p = array(
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlInsertBobotNilaiXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $sql = $this->mSqlQueries['dataListHasilCrawlBobotNilaiXls'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default')";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active'";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" || $filterStatusCrawl == "insert" || $filterStatusCrawl == "delete" ) ){
         if($sqlWhere=="")
            {$sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }
      if($sqlWhere!='' AND $sqlWhere !=null)
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql);
      else   $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $result = $this->GetAllDataAsArray($sql, array());
      return $result;
   }

   function cancelCrawlInsertDataBobotNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $kode_bobot_nilai = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            "none",
            $kode_bobot_nilai
         );
      }else{
         $p = array(
            "default",
            "insert",
            $kode_bobot_nilai
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataBobotNilai'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataBobotNilaiProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeKodeBobotNilai = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeKodeBobotNilai = substr(trim($rangeKodeBobotNilai), 0, -1);
      $arrTemp = explode('@',$rangeKodeBobotNilai);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               "none",
               $arrTemp[$i]
            );
         }else{
            $p = array(
               "default",
               "insert",
               $arrTemp[$i]
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataBobotNilai'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function setDeleteCrawlDataBobotNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $kode_bobot_nilai = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteBobotNilai'],array($kode_bobot_nilai));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['kode_bobot_nilai'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $kode_bobot_nilai
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $kode_bobot_nilai
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataBobotNilai'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlInsertBobotNilai(){
      //get data for insert to mahasiswa dan mahasiswa_pt
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertBobotNilai'], array());
   }

   function updateAfterSyncCrawlBobotNilai(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               $dataList[$i]['pddikti_kode_bobot_nilai'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }else{
            $p = array(
               $dataList[$i]['unikKey'],
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlBobotNilai'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertBobotNilaiUpdateStatusAfterProses(){
      $this->StartTransaction();
      $prosesAll = true;

      //tabel mahasiswa
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertBobotNilai'], array());
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['kode_bobot_nilai']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertBobotNilai'], $p);
            if($proses == false) $prosesAll = false;
         }
      }
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertBobotNilai'], array());
      if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

   function getDataSyncCrawlDeleteBobotNilai(){
      //get data for Delete to mahasiswa dan mahasiswa_pt
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlDeleteBobotNilai'], array());
   }

   function updateAfterSyncCrawlDeleteBobotNilai(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['kode_bobot_nilai']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['kode_bobot_nilai']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataBobotNilai'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function showCrawlUpdateBobotNilai(){
      $this->StartTransaction();
      $prosesAll = true;

      //ambil seluruh data
      $dataList = $this->ExecuteUpdateQuery($this->mSqlQueries['showCrawlUpdateBobotNilaiGetDataList'], array());
      $prosesAll = $dataList;

      //ambil data updatenya dari data s_nilai_matakuliah
      /*for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['nilai_huruf'],
            $dataList[$i]['id_jenjang'],
         );
         $dataUpdateFromSia = $this->GetAllDataAsArray($this->mSqlQueries['showCrawlUpdateBobotNilaiGetUpdateValue'], $p);

         if($dataUpdateFromSia[0]['bobot_nilai_min'] == "") $dataUpdateFromSia[0]['bobot_nilai_min'] = 0;
         $dataList[$i]['bobot_nilai_min'] = $dataUpdateFromSia[0]['bobot_nilai_min'];

         if($dataUpdateFromSia[0]['bobot_nilai_maks'] == "") $dataUpdateFromSia[0]['bobot_nilai_maks'] = 0;
         $dataList[$i]['bobot_nilai_maks'] = $dataUpdateFromSia[0]['bobot_nilai_maks'];

         if($dataUpdateFromSia[0]['nilai_indeks'] == "") $dataUpdateFromSia[0]['nilai_indeks'] = 0;
         $dataList[$i]['nilai_indeks'] = $dataUpdateFromSia[0]['nilai_indeks'];

         //lakukan update
         $p = array(
            $dataList[$i]['bobot_nilai_min'],
            $dataList[$i]['bobot_nilai_maks'],
            $dataList[$i]['nilai_indeks'],
            $dataList[$i]['kode_bobot_nilai']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['showCrawlUpdateBobotNilaiUpdateTabelFeeder'], $p);
         if($proses == false) $prosesAll = false;
      }*/

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

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

   function updateAfterSyncCrawlUpdateDataBobotNilai(){
      //return true;
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['kode_bobot_nilai']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['kode_bobot_nilai']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataBobotNilai'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function crawlInsertKurikulum(){
      //ambil data kurikulum dari sia
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['crawlInsertKurikulumGetDataList'], array());

      //insert kan ke tabel feeder sia
      $this->StartTransaction();
      $rowEffected = 0;
      $prosesInsert = true;

      if($dataList[0]['kurId'] != ""){
         for ($i=0; $i < count($dataList); $i++) {
            $p = array(
               //$i.'-temp',
               $dataList[$i]['kurId'].'-temp',
               $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'],
               $dataList[$i]['kurId'],
               $dataList[$i]['status_proses_dikti_'],
               $dataList[$i]['status_data_']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertKurikulumInsertFeeder'], $p);
            if($proses == false) {
               $prosesInsert = false;
            }
            $rowEffected += $this->getAffectedRow();
         }
      }

      $this->CompleteTransaction($prosesInsert);
      if($prosesInsert == false){
         $rowEffected = 0;
      }

      $arrReturn['prosesNya'] = $prosesInsert;
      $arrReturn['rowEfek'] = $rowEffected;
      return $arrReturn;
   }

   function dataListHasilCrawlInsertKurikulumTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $sql = $this->mSqlQueries['dataListHasilCrawlKurikulumTotalRows'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default')";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active'";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         if($sqlWhere=="")
            {$sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }
      if($sqlWhere!='' AND $sqlWhere !=null)
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql);
      else   $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $result = $this->GetAllDataAsArray($sql, array());
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlInsertKurikulum(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $offset = $dataParam[2];
      $limit = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlKurikulum'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         if($sqlWhere=="")
            {$sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }
      if($sqlWhere!='' AND $sqlWhere !=null)
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql);
      else   $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
     $p = array(
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlInsertKurikulumXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $sql = $this->mSqlQueries['dataListHasilCrawlKurikulumXls'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default')";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active'";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         if($sqlWhere=="")
            {$sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') ";}
         else {
            $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."') ";
         }
      }
      if($sqlWhere!='' AND $sqlWhere !=null)
         $sql = str_replace("[SQL_WHERE_STATUS_DATA]", "WHERE ".$sqlWhere, $sql);
      else   $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $result = $this->GetAllDataAsArray($sql, array());
      return $result;
   }

   function cancelCrawlInsertDataKurikulum(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_kurikulum_sp = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            "none",
            $id_kurikulum_sp
         );
      }else{
         $p = array(
            "default",
            "insert",
            $id_kurikulum_sp
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataKurikulum'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataKurikulumProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdKurikulumSp = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdKurikulumSp = substr(trim($rangeIdKurikulumSp), 0, -1);
      $arrTemp = explode('@',$rangeIdKurikulumSp);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               "none",
               $arrTemp[$i]
            );
         }else{
            $p = array(
               "default",
               "insert",
               $arrTemp[$i]
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataKurikulum'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlDeleteKurikulum(){
      //get data for Delete to mahasiswa dan mahasiswa_pt
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlDeleteKurikulum'], array());
   }

   function updateAfterSyncCrawlDeleteKurikulum(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kurikulum_sp']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kurikulum_sp']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlDeleteDataKurikulum'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

   function updateAfterSyncCrawlKurikulum(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               $dataList[$i]['pddikti_id_kurikulum_sp'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }else{
            $p = array(
               $dataList[$i]['unikKey'],
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlKurikulum'], $p);//return vsprintf($this->mSqlQueries['updateAfterSyncCrawlKurikulum'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertKurikulumUpdateStatusAfterProses(){
      $this->StartTransaction();
      $prosesAll = true;

      //tabel mahasiswa
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertKurikulum'], array());
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_kurikulum_sp']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertKurikulum'], $p);
            if($proses == false) $prosesAll = false;
         }
      }
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertKurikulum'], array()); // ini dikomen agar yg gagal biarkan statusnya tetap gagal
      if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

   function setDeleteCrawlDataKurikulum(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_kurikulum_sp = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteKurikulum'],array($id_kurikulum_sp));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_kurikulum_sp'], 'temp');
      
      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI!==true && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_kurikulum_sp
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI!==true && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_kurikulum_sp
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataKurikulum'], $p); 
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function showCrawlUpdateKurikulum(){
      $this->StartTransaction();
      $prosesAll = true;

      //ambil seluruh data
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['showCrawlUpdateKurikulumGetDataList'], array());

      //ambil data updatenya dari data s_nilai_matakuliah
      for ($i=0; $i < count($dataList); $i++) {
         //lakukan update
         $p = array(
            $dataList[$i]['nm_kurikulum_sp'],
            $dataList[$i]['jml_sem_normal'],
            $dataList[$i]['jml_sks_lulus'],
            $dataList[$i]['id_sms'],
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['id_smt_berlaku'],
            $dataList[$i]['id_kurikulum_sp']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['showCrawlUpdateKurikulumUpdateTabelFeeder'], $p);
         if($proses == false) $prosesAll = false;
      }

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

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

   function updateAfterSyncCrawlUpdateDataKurikulum(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['id_kurikulum_sp']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataKurikulum'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['id_kurikulum_sp']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataKurikulum'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function crawlInsertMatkul(){
      //insert kan ke tabel feeder sia
      $this->StartTransaction();
      $prosesInsert = true;
      $rowEffected = 0;

      //ambil data matakulaih dari sia
      $prosesInsert = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertMatkulGetDataList'], array());
      $rowEffected = $this->getAffectedRow();

      $this->CompleteTransaction($prosesInsert);
      if($prosesInsert == false){
         $rowEffected = 0;
      }

      $arrReturn['prosesNya'] = $prosesInsert;
      $arrReturn['rowEfek'] = $rowEffected;
      return $arrReturn;

      /*
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['mkkurId'] != ""){
            $p = array(
               $i.'-temp',
               $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'],
               $dataList[$i]['mkkurId']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertMatkulInsertFeeder'], $p);
            if($proses == false) $prosesInsert = false;
         }
      }

      $this->CompleteTransaction($prosesInsert);
      return $prosesInsert;
      */
   }

   function dataListHasilCrawlInsertMatkulTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterProdi = $dataParam[2];
      $filterNamaMatkul = '%'.$dataParam[3].'%';

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMatkulTotalRows'];
      //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete" ) ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $filterProdi,
         $filterProdi,
         $filterNamaMatkul
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlInsertMatkulXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterProdi = $dataParam[2];
      $filterNamaMatkul = '%'.$dataParam[3].'%';

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMatkulXls'];
      //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $filterProdi,
         $filterProdi,
         $filterNamaMatkul
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function dataListHasilCrawlInsertMatkul(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterProdi = $dataParam[2];
      $filterNamaMatkul = '%'.$dataParam[3].'%';
      $offset = $dataParam[4];
      $limit = $dataParam[5];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMatkul'];
      //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $filterProdi,
         $filterProdi,
         $filterNamaMatkul,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function cancelCrawlInsertDataMatkul(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_mk = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            "none",
            $id_mk
         );
      }else{
         $p = array(
            "default",
            "insert",
            $id_mk
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMatkul'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataMatkulProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdMk = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdMk = substr(trim($rangeIdMk), 0, -1);
      $arrTemp = explode('@',$rangeIdMk);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               "none",
               $arrTemp[$i]
            );
         }else{
            $p = array(
               "default",
               "insert",
               $arrTemp[$i]
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMatkul'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlInsertMatkulGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $mode = $dataParam[0];
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertMatkulGetInfoRow'], array($mode));   //return vsprintf($this->mSqlQueries['getDataSyncCrawlInsertMatkulGetInfoRow'], $mode);
      /*
      if($result === FALSE){
         $arr_gagal['q'][] = vsprintf($this->mSqlQueries['getDataSyncCrawlInsertMatkulGetInfoRow'], $mode);
         $arr_gagal['err'][] = $this->mDbErrorMessage;
         print_r($arr_gagal);exit;
      }
      //*/
      return $result[0]['BANYAK'];
   }
   
   function getDataSyncCrawlUpdateMatkulGetInfoRow(){
      $result = $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlUpdateMatkulGetInfoRow'], array());
      return $result[0]['BANYAK'];
   }

   function getDataSyncCrawlInsertMatkul(){
      $dataParam = $this->GetProperty("DataProceed");
      $offset = $dataParam[0];
      $limit = $dataParam[1];
      $mode = $dataParam[2];

      $p = array(
         $mode,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertMatkul'], $p);
   }

   function updateAfterSyncCrawlMatkul(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               $dataList[$i]['pddikti_id_mk'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }else{
            $p = array(
               $dataList[$i]['unikKey'],
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMatkul'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlDeleteMatkul(){
      //get data for Delete to mahasiswa dan mahasiswa_pt
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlDeleteMatkul'], array());
   }

   function updateAfterSyncCrawlDeleteMatkul(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_mk']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_mk']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMatkul'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertMatkulUpdateStatusAfterProses(){
      $this->StartTransaction();
      $prosesAll = true;
      
      $prosesAll = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertMatkul'], $p);

      //tabel mahasiswa
      /*$dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertMatkul'], array());
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_mk']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertMatkul'], $p);
            if($proses == false) $prosesAll = false;
         }
      }*/
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertMatkul'], array()); // ini dikomen agar yg gagal biarkan statusnya tetap gagal
      //if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

   function showCrawlUpdateMatkul(){
      $this->StartTransaction();
      $prosesAll = true;

      //ambil seluruh data
      //$dataList = $this->GetAllDataAsArray($this->mSqlQueries['showCrawlUpdateMatkulGetDataList'], array());
      $dataList = $this->ExecuteUpdateQuery($this->mSqlQueries['showCrawlUpdateMatkulGetDataList'], array());
      $prosesAll = $dataList;

      /*for ($i=0; $i < count($dataList); $i++) {
         //lakukan update
         $p = array(
            $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]['a_sap'],
            $dataList[$i]['a_silabus'],
            $dataList[$i]['a_bahan_ajar'],
            $dataList[$i]['acara_prak'],
            $dataList[$i]['a_diktat'],
            $dataList[$i]['id_mk']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['showCrawlUpdateMatkulUpdateTabelFeeder'], $p);
         if($proses == false) $prosesAll = false;
      }*/

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

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

   function setDeleteCrawlDataMatkul(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_mk = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteMatkul'],array($id_mk));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_mk'], '_temp');
      
      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_mk
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_mk
         );
      }else {
         return false;
      }
      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataMatkul'], $p);
      if($proses == false) $prosesUpdate = false;
      
      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function updateAfterSyncCrawlUpdateDataMatkul(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_mk']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_mk']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMatkul'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function crawlInsertMatkulKur(){
      $rowEffected = 0;

      //ambil data dari sia
      $dataList = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertMatkulKurGetDataList'], array());
      $rowEffected = $this->getAffectedRow();
      $prosesInsert = $dataList;

      if($prosesInsert == false){
         $rowEffected = 0;
      }
//return vsprintf($this->mSqlQueries['crawlInsertMatkulKurGetDataList'], $p);
      $arrReturn['prosesNya'] = $prosesInsert;
      $arrReturn['rowEfek'] = $rowEffected;
      return $arrReturn;

      //insert kan ke tabel feeder sia
      /*$this->StartTransaction();
      $prosesInsert = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['id_kurikulum_sp'] != ""){
            $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']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertMatkulKurInsertFeeder'], $p);
            if($proses == false) $prosesInsert = false;
         }
      }

      $this->CompleteTransaction($prosesInsert);
      return $prosesInsert;*/
   }

   function dataListHasilCrawlInsertMatkulKurTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNmKur = $dataParam[2];
      $filterNmMk = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMatkulKurTotalRows'];
      //filter status data
      // if($filterStatusData == "all"){
      //    $sqlWhere = "(a.`status_crawl` = 'insert' OR a.`status_data` = 'not_active')";
      //    $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      // }
      // if($filterStatusData == "default"){
      //    $sqlWhere = "(a.`status_crawl` = 'insert' AND a.`status_data` = 'default')";
      //    $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      // }
      // if($filterStatusData == "not_active"){
      //    $sqlWhere = "a.`status_data` = 'not_active'";
      //    $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      // }

      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete" ) ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         '%'.$filterNmKur.'%',
         '%'.$filterNmMk.'%'
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlInsertMatkulKur(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNmKur = $dataParam[2];
      $filterNmMk = $dataParam[3];
      $offset = $dataParam[4];
      $limit = $dataParam[5];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMatkulKur'];
      //filter status data
      // if($filterStatusData == "all"){
      //    $sqlWhere = "(a.`status_crawl` = 'insert' OR a.`status_data` = 'not_active')";
      //    $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      // }
      // if($filterStatusData == "default"){
      //    $sqlWhere = "(a.`status_crawl` = 'insert' AND a.`status_data` = 'default')";
      //    $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      // }
      // if($filterStatusData == "not_active"){
      //    $sqlWhere = "a.`status_data` = 'not_active'";
      //    $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      // }

      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         '%'.$filterNmKur.'%',
         '%'.$filterNmMk.'%',
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlInsertMatkulKurXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $filterStatusData = $dataParam[0];
      $filterStatusCrawl = $dataParam[1];
      $filterNmKur = $dataParam[2];
      $filterNmMk = $dataParam[3];

      $sql = $this->mSqlQueries['dataListHasilCrawlInsertMatkulKurXls'];

      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         '%'.$filterNmKur.'%',
         '%'.$filterNmMk.'%'
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function cancelCrawlInsertDataMatkulKur(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_mk = $dataParam[0];
      $arrTemp = explode('_', $id_mk);
      $id_kurikulum_sp = $arrTemp[0];
      $id_mk = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            "none",
            $id_kurikulum_sp,
            $id_mk
         );
      }else{
         $p = array(
            "default",
            "insert",
            $id_kurikulum_sp,
            $id_mk
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMatkulKur'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlInsertDataMatkulKurProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdUnik = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdUnik = substr(trim($rangeIdUnik), 0, -1);
      $arrTemp = explode('@',$rangeIdUnik);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         $arrTempUnik = explode('_', $arrTemp[$i]);
         $id_kurikulum_sp = $arrTempUnik[0];
         $id_mk = $arrTempUnik[1];

         if($setAksi == "setNotAktif"){
         $p = array(
               "not_active",
               "none",
               $id_kurikulum_sp,
               $id_mk
            );
         }else{
            $p = array(
               "default",
               "insert",
               $id_kurikulum_sp,
               $id_mk
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlInsertDataMatkulKur'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertMatkulKurGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $mode = $dataParam[0];
      
      $result = $this->GetAllDataAsArray($this->mSqlQueries['syncCrawlInsertMatkulKurGetInfoRow'], array($mode));//return vsprintf($this->mSqlQueries['syncCrawlInsertMatkulKurGetInfoRow'], $mode);
      return $result[0]['BANYAK'];
   }

   function getDataSyncCrawlInsertMatkulKur(){
      $dataParam = $this->GetProperty("DataProceed");
      $offset = $dataParam[0];
      $limit = $dataParam[1];
      $mode = $dataParam[2];

      $p = array(
         $mode,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertMatkulKur'], $p);
   }

   function updateAfterSyncCrawlDeleteMatkulKur(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kurikulum_sp'],
               $dataList[$i]['id_mk']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kurikulum_sp'],
               $dataList[$i]['id_mk']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMatkulKur'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function updateAfterSyncCrawlMatkulKur(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $arrTemp = explode('_', $dataList[$i]['unikKey']);
         $id_kurikulum_sp = $arrTemp[0];
         $id_mk = $arrTemp[1];
         if($dataList[$i]['proses'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_kurikulum_sp,
               $id_mk
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_kurikulum_sp,
               $id_mk
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMatkulKur'], $p);
         
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertMatkulKurUpdateStatusAfterProses(){
      $this->StartTransaction();
      $prosesAll = true;
      
      $prosesAll = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertMatkulKur'], $p);

      /*$dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertMatkulKur'], array());
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_kurikulum_sp'],
               $dataList[$i]['id_mk']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertMatkulKur'], $p);
            if($proses == false) $prosesAll = false;
         }
      }*/
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertMatkulKur'], array()); // ini dikomen agar yg gagal biarkan statusnya tetap gagal
      //if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

   function setDeleteCrawlDataMatkulKur(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_mk = $dataParam[0];
      $arrTemp = explode('_', $id_mk);
      $id_kurikulum_sp = $arrTemp[0];
      $id_mk = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteMatkulKur'],array($id_mk, $id_kurikulum_sp));

      $statusIdMk = strpos( $statusDataDelete[0]['id_mk'], 'temp');
      $statusIdKurikulumSp = strpos( $statusDataDelete[0]['id_kurikulum_sp'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusIdMk===false && $statusIdKurikulumSp === false &&$statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_mk,
            $id_kurikulum_sp
         );
      }else if ($setAksi == "setDelete" && $statusIdMk === false && $statusIdKurikulumSp == false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_mk,
            $id_kurikulum_sp
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataMatkulKur'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function showCrawlUpdateMatkulKur(){
      $this->StartTransaction();
      $prosesAll = true;

      //ambil seluruh data
      //$dataList = $this->GetAllDataAsArray($this->mSqlQueries['showCrawlUpdateMatkulKurGetDataList'], array());
      $dataList = $this->ExecuteUpdateQuery($this->mSqlQueries['showCrawlUpdateMatkulKurGetDataList'], array());
      $prosesAll = $dataList;

      /*for ($i=0; $i < count($dataList); $i++) {
         //lakukan update
         $p = array(
            $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]['id_kurikulum_sp'],
            $dataList[$i]['id_mk']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['showCrawlUpdateMatkulKurUpdateTabelFeeder'], $p);
         if($proses == false) $prosesAll = false;
      }*/

      $this->CompleteTransaction($prosesAll);
      return $prosesAll;
   }

   // fungsi ini digantikan getDataSyncCrawlInsertMatkulKur() digunakan bersama utk update dan insert
   /*
   function prosesSyncDataUpdateMatkulKurGetDataList(){
      return $this->GetAllDataAsArray($this->mSqlQueries['prosesSyncDataUpdateMatkulKurGetDataList'], array());
   }*/

   //fungsi ini digantikan oleh updateAfterSyncCrawlMatkulKur(), digunakan bersama untuk update dan insert
   /*function updateAfterSyncCrawlUpdateDataMatkulKur(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $arrTemp = explode('_', $dataList[$i]['id_unik']);
         $id_kurikulum_sp = $arrTemp[0];
         $id_mk = $arrTemp[1];

         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $id_kurikulum_sp,
               $id_mk
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMatkulKur'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $id_kurikulum_sp,
               $id_mk
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataMatkulKur'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }*/

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

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

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

      //insert kan ke tabel feeder sia
      $this->StartTransaction();
      $dataListForInsertRaw = true;
      $totalAfektedRow = 0;

      //ambil data yg perlu di insertkan
      $dataListForInsertRaw = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertKlsKulGetDataInsert'], array($semid));
      $totalAfektedRow = $this->getAffectedRow();

      $this->CompleteTransaction($dataListForInsertRaw);
      if($dataListForInsertRaw == false){
         $totalAfektedRow = 0;
      }
      return $totalAfektedRow;
      
      /*
      //prep data insert kelas (hilangkan yg sudah tercatat sebelumnya, acuannya gt_id)
      $dataListForInsert = array();
      $increData = 0;
      for ($i=0; $i < count($dataListForInsertRaw); $i++) {
         //cek gt_id
         $p = array(
            $dataListForInsertRaw[$i]['gt_id']
         );
         $cek = $this->GetAllDataAsArray($this->mSqlQueries['crawlInsertKlsKulGetDataInsertCekData'], $p);

         if($cek[0]['BANYAK'] == "0"){
            $dataListForInsert[$increData] = $dataListForInsertRaw[$i];
            $increData++;
         }
      }*/

      /*if($dataListForInsert[0]['gt_id'] != ""){
         //$counterNmKelas = 1;
         for ($i=0; $i < count($dataListForInsert); $i++) {
            //set nmKelas
            
            #if(strlen($counterNmKelas) == 1){
            #   $nmKelas = '0'.$counterNmKelas;
            #}else{
            #   $nmKelas = $counterNmKelas;
            #}
            

            $p = array(
               //$i.'-temp',
               $dataListForInsert[$i]['gt_id'].'-'.substr($dataListForInsert[$i]['id_mk'], 0, 7), // ini karena ditemukan data mk di pddikti feeder ada yang ganda
               $dataListForInsert[$i]['id_sms'],
               $dataListForInsert[$i]['id_smt'],
               $dataListForInsert[$i]['id_mk'],
               //$nmKelas,
               $dataListForInsert[$i]['nm_kls'],
               $dataListForInsert[$i]['sks_mk'],
               $dataListForInsert[$i]['sks_tm'],
               $dataListForInsert[$i]['sks_prak'],
               $dataListForInsert[$i]['sks_prak_lap'],
               $dataListForInsert[$i]['sks_sim'],
               $dataListForInsert[$i]['bahasan_case'],
               $dataListForInsert[$i]['tgl_mulai_koas'],
               $dataListForInsert[$i]['tgl_selesai_koas'],
               $dataListForInsert[$i]['gt_id']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertKlsKulInsertKeFeeder'], $p);
            if($proses == false) {
               $prosesAll = false;
               return 'gagal';
            }
            $totalAfektedRow += $this->getAffectedRow();

            
            #if($dataListForInsert[$i]['id_unik'] == $dataListForInsert[$i+1]['id_unik']){
            #   $counterNmKelas++;
            #}else{
            #   $counterNmKelas = 1;
            #}
            
         }
      }*/

      //hapus duplikat data
      /*$proses = $this->ExecuteDeleteQuery($this->mSqlQueries['crawlInsertKlsKulDeleteDuplikat'], array());
      $totalAfektedRow = $totalAfektedRow - $this->getAffectedRow();*/

      /*$this->CompleteTransaction($prosesAll);
      if($prosesAll == false) {
         $totalAfektedRow = 0;
      }
      return $totalAfektedRow;*/
   }

   function dataListHasilCrawlKlsKulTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaKls = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlKlsKulTotalRows'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete" ) ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNamaKls
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaKls = '%'.$dataParam[3].'%';
      $offset = $dataParam[4];
      $limit = $dataParam[5];

      $sql = $this->mSqlQueries['dataListHasilCrawlKlsKul'];
      //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete" ) ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $p = array(
         $semid,
         $filterNamaKls,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlKlsKulXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaKls = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlKlsKulXls'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNamaKls
      );
       
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function cancelCrawlDataKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_kls = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            $id_kls
         ); 
      }else{
         $p = array(
            "default",
            $id_kls
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataKlsKul'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataKlsKulProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdKls = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdKls = substr(trim($rangeIdKls), 0, -1);
      $arrTemp = explode('@',$rangeIdKls);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               // "none",
               $arrTemp[$i]
            );
         }else{
            $p = array(
               "default",
               // "insert",
               $arrTemp[$i]
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataKlsKul'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function setDeleteCrawlDataKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_kls = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteKlsKul'],array($id_kls));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_kls'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_kls
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_kls
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataKlsKul'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

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

   function getDataSyncCrawlDeleteKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlDeleteKlsKul'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlDeleteKlsKul(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               $dataList[$i]['id_kls'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kls']
            );
         }else{
            $p = array(
               $dataList[$i]['id_kls'],
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kls']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlKlsKul'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

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

   function getDataSyncCrawlInsertKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertKlsKul'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlKlsKul(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               $dataList[$i]['pddikti_id_kls'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }else{
            $p = array(
               $dataList[$i]['unikKey'],
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlKlsKul'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);//return $dataList;
      return $prosesUpdate;
   }

   function syncCrawlInsertKlsKulUpdateStatusAfterProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $prosesAll = true;

      $prosesAll = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertKlsKul'], array());
      
      /*$this->StartTransaction();
      $prosesAll = true;

      //tabel mahasiswa
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertKlsKul'], array($semid));
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_kls']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertKlsKul'], $p);
            if($proses == false) $prosesAll = false;
         }
      }
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertKlsKul'], array($semid)); // ini dikomen agar yg gagal biarkan statusnya tetap gagal
      if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);*/
      return $prosesAll;
   }

   function getCrawlUpdateKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $totalAfektedRow = 0;

      //ambil data yg perlu di updatekan
      $dataListForUpdate = $this->GetAllDataAsArray($this->mSqlQueries['crawlUpdateKlsKulGetDataUpdate'], array($semid));
      //ambil data kelas dg kondisi gt_id = 0 atau null
      $dataListForUpdateExtra = $this->GetAllDataAsArray($this->mSqlQueries['crawlUpdateKlsKulGetDataUpdateExtra'], array($semid));

      if ($dataListForUpdate && $dataListForUpdateExtra){
         $dataListForUpdate = array_merge($dataListForUpdate, $dataListForUpdateExtra);
      }else
      if (!$dataListForUpdate && $dataListForUpdateExtra){
         $dataListForUpdate = $dataListForUpdateExtra;
      }

      $this->StartTransaction();
      $prosesAll = true;
      $rows = array();

      for ($i=0; $i < count($dataListForUpdate); $i++) {
         $p = array(
            $dataListForUpdate[$i]['id_sms'],
            $dataListForUpdate[$i]['id_mk'],
            $dataListForUpdate[$i]['nm_kls'],
            $dataListForUpdate[$i]['sks_mk'],
            $dataListForUpdate[$i]['sks_tm'],
            $dataListForUpdate[$i]['sks_prak'],
            $dataListForUpdate[$i]['sks_prak_lap'],
            $dataListForUpdate[$i]['sks_sim'],
            $dataListForUpdate[$i]['tanggal_mulai'],
            $dataListForUpdate[$i]['tanggal_selesai'],
            $dataListForUpdate[$i]['gt_id'],
            $dataListForUpdate[$i]['id_kls']
         );
         $update = $this->ExecuteUpdateQuery($this->mSqlQueries['crawlUpdateKlsKulUpdateKeFeeder'], $p);
         if($update == false){
            $prosesAll = false;
         }else
         if ($update && $this->getAffectedRow() > 0){
            $rows[] = 1;
         }
      }

      $this->CompleteTransaction($prosesAll);
      // if($prosesAll == false){
      //    $totalAfektedRow = 0;
      // }else{
      //    $totalAfektedRow = $this->getAffectedRow();
      // }
      //return $totalAfektedRow;
      if ($prosesAll){
         $affectedRows = count($rows);
      }else{
         $affectedRows = 0;
      }
      return $affectedRows;
   }

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

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

   function getDataSyncCrawlUpdateKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlUpdateKlsKul'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlUpdateDataKlsKul(){
      //return true;
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['id_kls']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataKlsKul'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['id_kls']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataKlsKul'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

   function generateKodeParalel(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $reset = $this->ExecuteUpdateQuery($this->mSqlQueries['resetKodeParalel'], array($semid));
      if ($reset){
         $return = $this->ExecuteUpdateQuery($this->mSqlQueries['generateKodeParalel'], array($semid, $semid, $semid));
      }else{
         $return = false;
      }
      return $return;
   }

   function updateCrawlKlsKul(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $return = $this->ExecuteUpdateQuery($this->mSqlQueries['updateCrawlKlsKul'], array($semid));
      return $return;
   }

   function crawlInsertAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $totalAfektedRow = 0;
      
      $prosesAll = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertAjarDsnGetDataInsert'], array($semid,$semid));
      $totalAfektedRow = $this->getAffectedRow();
      
      //ambil data yg perlu di insertkan
      /*$dataListForInsert = $this->GetAllDataAsArray($this->mSqlQueries['crawlInsertAjarDsnGetDataInsert'], array($semid,$semid));

      $this->StartTransaction();
      $prosesAll = true;

      for ($i=0; $i < count($dataListForInsert); $i++) {
         if($dataListForInsert[$i]['id_kls'] != ""){
            $p = array(
               //$i.'-temp',
               $dataListForInsert[$i]['id_kls'].'-'.substr($dataListForInsert[$i]['id_reg_ptk'], 0, 7), // bisa jadi 1 kelas diajar lebih dari 1 dosen
               $dataListForInsert[$i]['id_reg_ptk'],
               $dataListForInsert[$i]['id_kls'],
               $dataListForInsert[$i]['sks_subst_tot'],
               $dataListForInsert[$i]['sks_tm_subst'],
               $dataListForInsert[$i]['sks_prak_subst'],
               $dataListForInsert[$i]['sks_sim_subst'],
               $dataListForInsert[$i]['jml_tm_renc'],
               $dataListForInsert[$i]['jml_tm_real'],
               $dataListForInsert[$i]['id_jns_eval']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertAjarDsnInsertKeFeeder'], $p);
            if($proses == false) $prosesAll = false;
            $totalAfektedRow += $this->getAffectedRow();
         }
      }

      $this->CompleteTransaction($prosesAll);*/
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function dataListHasilCrawlAjarDsnTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNama = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlAjarDsnTotalRows'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNama
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $offset = $dataParam[3];
      $limit = $dataParam[4];
      $filterNama = '%'.$dataParam[5].'%';

      $sql = $this->mSqlQueries['dataListHasilCrawlAjarDsn'];
      //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $p = array(
         $semid,
         $filterNama,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlAjarDsnXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNama = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlAjarDsnXls'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNama
      );

      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }
   
   function setDeleteCrawlDataAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_ajar = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteAjarDsn'],array($id_ajar));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_ajar'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_ajar
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_ajar
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataAjarDsn'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }


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

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

   function getDataSyncCrawlDeleteAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlDeleteAjarDsn'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlDeleteAjarDsn(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               $dataList[$i]['id_ajar'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ajar']
            );
         }else{
            $p = array(
               $dataList[$i]['id_ajar'],
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ajar']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlAjarDsn'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_ajar = $dataParam[0];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            $id_ajar
         ); 
      }else{
         $p = array(
            "default",
            $id_ajar
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataAjarDsn'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataAjarDsnProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdAjar = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdAjar = substr(trim($rangeIdAjar), 0, -1);
      $arrTemp = explode('@',$rangeIdAjar);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               // "none",
               $arrTemp[$i]
            );
         }else{
            $p = array(
               "default",
               // "insert",
               $arrTemp[$i]
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataAjarDsn'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

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

   function getDataSyncCrawlInsertAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertAjarDsn'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlAjarDsn(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               $dataList[$i]['pddikti_id_ajar'],
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }else{
            $p = array(
               $dataList[$i]['unikKey'],
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['unikKey']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlAjarDsn'], $p); //if (!$proses) return vsprintf($this->mSqlQueries['updateAfterSyncCrawlAjarDsn'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertAjarDsnUpdateStatusAfterProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      
      $prosesAll = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertAjarDsn'], array());

      /*$this->StartTransaction();
      $prosesAll = true;

      //tabel
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertAjarDsn'], array($semid));
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_ajar']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertAjarDsn'], $p);
            if($proses == false) $prosesAll = false;
         }
      }
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertAjarDsn'], array($semid));
      if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);*/
      return $prosesAll;
   }

   function getCrawlUpdateAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $totalAfektedRow = 0;

      //ambil data yg perlu di updatekan
      $dataListForUpdate = $this->GetAllDataAsArray($this->mSqlQueries['crawlUpdateAjarDsnGetDataUpdate'], array($semid, $semid));

      $this->StartTransaction();
      $prosesAll = true;

      for ($i=0; $i < count($dataListForUpdate); $i++) {
         $p = array(
            $dataListForUpdate[$i]['sks_subst_tot'],
            $dataListForUpdate[$i]['sks_tm_subst'],
            $dataListForUpdate[$i]['sks_prak_subst'],
            $dataListForUpdate[$i]['sks_prak_lap_subst'],
            $dataListForUpdate[$i]['sks_sim_subst'],
            $dataListForUpdate[$i]['jml_tm_renc'],
            $dataListForUpdate[$i]['jml_tm_real'],
            $dataListForUpdate[$i]['id_ajar']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['crawlUpdateAjarDsnUpdateKeFeeder'], $p);
         if($proses == false) {
            $prosesAll = false;
         }
      }

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

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

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

   function getDataSyncCrawlUpdateAjarDsn(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlUpdateAjarDsn'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlUpdateDataAjarDsn(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['id_ajar']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataAjarDsn'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['id_ajar']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataAjarDsn'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function crawlInsertNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $totalAfektedRow = 0;

      //ambil data yg perlu di insertkan
      $dataListForInsert = $this->GetAllDataAsArray($this->mSqlQueries['crawlInsertNilaiGetDataInsert'], array($semid));
      $prosesAll = $dataListForInsert;
      $totalAfektedRow += $this->getAffectedRow();

      /*$this->StartTransaction();
      $prosesAll = true;

      for ($i=0; $i < count($dataListForInsert); $i++) {
         if($dataListForInsert[$i]['id_kls'] != ""){
            $p = array(
               $dataListForInsert[$i]['id_kls'],
               $dataListForInsert[$i]['id_reg_pd'],
               $dataListForInsert[$i]['asal_data'],
               $dataListForInsert[$i]['nilai_angka'],
               $dataListForInsert[$i]['nilai_huruf'],
               $dataListForInsert[$i]['nilai_indeks'],
               $dataListForInsert[$i]['krsdtId']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertNilaiInsertKeFeeder'], $p);
            if($proses == false) $prosesAll = false;
            $totalAfektedRow += $this->getAffectedRow();
         }
      }

      $this->CompleteTransaction($prosesAll);*/
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function dataListHasilCrawlNilaiTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNama = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlNilaiTotalRows'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNama
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $offset = $dataParam[3];
      $limit = $dataParam[4];
      $nama = '%'.$dataParam[5].'%';

      $sql = $this->mSqlQueries['dataListHasilCrawlNilai'];
      //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $p = array(
         $semid,
         $nama,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlNilaiXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNama = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlNilaiXls'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNama
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

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

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

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

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

   function getDataSyncCrawlDeleteNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlDeleteNilai'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlDeleteNilai(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kls'],
               $dataList[$i]['id_reg_pd']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_kls'],
               $dataList[$i]['id_reg_pd']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlNilai'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('_', $id_unik);
      $id_kls = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            $id_kls,
            $id_reg_pd
         ); 
      }else{
         $p = array(
            "default",
            $id_kls,
            $id_reg_pd
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataNilai'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataNilaiProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdUnik = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdUnik = substr(trim($rangeIdUnik), 0, -1);
      $arrTemp = explode('@',$rangeIdUnik);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         $arrTemp1 = explode('_', $arrTemp[$i]);
         $id_kls = $arrTemp1[0];
         $id_reg_pd = $arrTemp1[1];
      
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               // "none",
               $id_kls,
               $id_reg_pd
            );
         }else{
            $p = array(
               "default",
               // "insert",
               $id_kls,
               $id_reg_pd
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataNilai'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

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

   function getDataSyncCrawlInsertNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertNilai'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlNilai(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $arrTemp = explode('_', $dataList[$i]['unikKey']);
         $id_kls = $arrTemp[0];
         $id_reg_pd = $arrTemp[1];

         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_kls,
               $id_reg_pd
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_kls,
               $id_reg_pd
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlNilai'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertNilaiUpdateStatusAfterProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      
      $prosesAll = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertNilai'], array());

      /*$this->StartTransaction();
      $prosesAll = true;

      //tabel
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertNilai'], array($semid));
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_kls'],
               $dataList[$i]['id_reg_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertNilai'], $p);
            if($proses == false) $prosesAll = false;
         }
      }
      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertNilai'], array($semid));
      if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);*/
      return $prosesAll;
   }

   function getCrawlUpdateNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $totalAfektedRow = 0;
      $setMaintenenceNullValue = false;

      //ambil data yg perlu di updatekan
      // //$dataListForUpdate = $this->GetAllDataAsArray($this->mSqlQueries['crawlUpdateNilaiGetDataUpdate'], array($semid));
      // $prosesAll = $dataListForUpdate;
      // $totalAfektedRow += $this->getAffectedRow();
      $rows = array();
      $dataListForUpdate = $this->ExecuteUpdateQuery($this->mSqlQueries['crawlUpdateNilaiGetDataUpdate'], array($semid));
      $rows[] = $this->getAffectedRow();
      // menanggulangi nilai gt_id = 0 atau null
      /**/
      if ($setMaintenenceNullValue){
         $dataListForUpdateExtra = $this->ExecuteUpdateQuery($this->mSqlQueries['crawlUpdateNilaiGetDataUpdateExtra'], array($semid));
         $rows[] = $this->getAffectedRow();
      }      
      $totalAfektedRow = array_sum($rows);

      /*$this->StartTransaction();
      $prosesAll = true;

      for ($i=0; $i < count($dataListForUpdate); $i++) {
         $p = array(
            $dataListForUpdate[$i]['nilai_angka'],
            $dataListForUpdate[$i]['nilai_huruf'],
            $dataListForUpdate[$i]['nilai_indeks'],
            $dataListForUpdate[$i]['id_kls'],
            $dataListForUpdate[$i]['id_reg_pd']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['crawlUpdateNilaiUpdateKeFeeder'], $p);
         if($proses == false) {
            $prosesAll = false;
         }
      }

      $this->CompleteTransaction($prosesAll);*/
      //if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

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

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

   function getDataSyncCrawlUpdateNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlUpdateNilai'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlUpdateDataNilai(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $arrTemp = explode('_', $dataList[$i]['id_unik']);
         $id_kls = $arrTemp[0];
         $id_reg_pd = $arrTemp[1];

         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_kls,
               $id_reg_pd
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataNilai'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_kls,
               $id_reg_pd
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataNilai'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function setDeleteCrawlDataNilai(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('_', $id_unik);
      $id_kls = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteNilai'],array($id_kls,
            $id_reg_pd));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_kls'].$statusDataDelete[0]['id_reg_pd'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_kls,
            $id_reg_pd
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_kls,
            $id_reg_pd
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataNilai'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getInfoCountDataNilaiTransferInsert(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getInfoCountDataNilaiTransferInsert'];
      $tahun = implode(",", $tahun);
      $sqlWhere = 'LEFT(mpt.mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array());
      return $data[0]['BANYAK'];
   }

   function crawlInsertNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $totalAfektedRow = 0;
      $sql = $this->mSqlQueries['crawlInsertNilaiTransferGetDataInsert'];
      //ambil data yg perlu di insertkan
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mpt.mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $dataListForInsert = $this->GetAllDataAsArray($sql, array($tahun));
      $prosesAll = $dataListForInsert;
      $totalAfektedRow += $this->getAffectedRow();
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function dataListHasilCrawlNilaiTransferTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlNilaiTransferTotalRows'];
       //filter status data
      $sqlWhere = ($tahun == 'all') ? 
         "a.id_ekuivalensi IS NOT NULL " : " LEFT(mahasiswa_pt.mulai_smt, 4)  = ".$tahun;
      if($filterStatusData == "default"){
         $sqlWhere = " AND (a.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " AND a.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."') ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $filterNamaMhs
      );
      $_result = $this->GetAllDataAsArray($sql, $p);
      $result = (int) $_result[0]['BANYAK'];
      return $result;
   }

   function dataListHasilCrawlNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $offset = $dataParam[4];
      $limit = $dataParam[5];

      $sql = $this->mSqlQueries['dataListHasilCrawlNilaiTransfer'];
      //filter status data
      $sqlWhere = ($tahun == 'all') ? 
         "a.id_ekuivalensi IS NOT NULL " : " LEFT(mahasiswa_pt.mulai_smt, 4)  = ".$tahun;
      if (!empty($filterStatusData) && $filterStatusData == 'default'){
         $sqlWhere = " AND (a.`status_data` = 'default')";
      }else
      if (!empty($filterStatusData) && $filterStatusData == 'not_active'){
         $sqlWhere = " AND (a.`status_data` = 'not_active')";
      }

      if($filterStatusCrawl != "all" && 
         ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."')";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $p = array(
         $filterNamaMhs,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlNilaiTransferXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlNilaiTransferXls'];
       //filter status data
      $sqlWhere = ($tahun == 'all') ?
         "a.id_ekuivalensi IS NOT NULL " : " LEFT(mahasiswa_pt.mulai_smt, 4) = ".$tahun;
      if($filterStatusData == "default"){
         $sqlWhere = " AND (a.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " AND (a.`status_data` = 'not_active') ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " AND (a.`status_crawl` = '".$filterStatusCrawl."')";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $filterNamaMhs
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function setDeleteCrawlDataNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('_', $id_unik);
      $id_ekuivalensi = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteNilaiTransfer'], array($id_ekuivalensi,
            $id_reg_pd));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_ekuivalensi'].$statusDataDelete[0]['id_reg_pd'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_ekuivalensi,
            $id_reg_pd
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_ekuivalensi,
            $id_reg_pd
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataNilaiTransfer'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('_', $id_unik);
      $id_ekuivalensi = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            $id_ekuivalensi,
            $id_reg_pd
         ); 
      }else{
         $p = array(
            "default",
            $id_ekuivalensi,
            $id_reg_pd
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataNilaiTransfer'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataNilaiTransferProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdUnik = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdUnik = substr(trim($rangeIdUnik), 0, -1);
      $arrTemp = explode('@',$rangeIdUnik);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         $arrTemp1 = explode('_', $arrTemp[$i]);
         $id_ekuivalensi = $arrTemp1[0];
         $id_reg_pd = $arrTemp1[1];
      
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               // "none",
               $id_ekuivalensi,
               $id_reg_pd
            );
         }else{
            $p = array(
               "default",
               // "insert",
               $id_ekuivalensi,
               $id_reg_pd
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataNilaiTransfer'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlInsertNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      $sql = $this->mSqlQueries['getDataSyncCrawlInsertNilaiTransfer'];
      //ambil data yg perlu di insertkan
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      return $this->GetAllDataAsArray($sql, array($offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlNilaiTransfer(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $gt_id = $dataList[$i]['gt_id'];
         $id_ekuivalensi = $dataList[$i]['id_ekuivalensi'];

         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_ekuivalensi,
               $gt_id
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_ekuivalensi,
               $gt_id
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlNilaiTransfer'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getCrawlUpdateNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $totalAfektedRow = 0;
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['crawlUpdateNilaiTransferGetDataUpdate'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      //ambil data yg perlu di updatekan
      $dataListForUpdate = $this->GetAllDataAsArray($sql, array($tahun));
      $prosesAll = $dataListForUpdate;
      $totalAfektedRow += $this->getAffectedRow();
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function getInfoCountDataNilaiTransferUpdate(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getInfoCountDataNilaiTransferUpdate'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array($tahun));
      return $data[0]['BANYAK'];
   }

   function getDataSyncCrawlUpdateNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getDataSyncCrawlUpdateNilaiTransfer'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      return $this->GetAllDataAsArray($sql, array($offsetProses, $limitProses));
   }

   function updateAfterSyncCrawlUpdateDataNilaiTransfer(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $arrTemp = explode('_', $dataList[$i]['id_unik']);
         $id_ekuivalensi = $arrTemp[0];
         $id_reg_pd = $arrTemp[1];

         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_ekuivalensi,
               $id_reg_pd
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataNilaiTransfer'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_ekuivalensi,
               $id_reg_pd
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataNilaiTransfer'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertNilaiTransferUpdateStatusAfterProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['resetStatusProsesDiktiInsertNilaiTransfer'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4)  IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $prosesAll = $this->ExecuteUpdateQuery($sql, array($tahun));
      return $prosesAll;
   }

   function getDataSyncCrawlDeleteNilaiTransfer(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getDataSyncCrawlDeleteNilaiTransfer'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      return $this->GetAllDataAsArray($sql, array($offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlDeleteNilaiTransfer(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ekuivalensi'],
               $dataList[$i]['gt_id']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ekuivalensi'],
               $dataList[$i]['gt_id']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlNilaiTransfer'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function crawlInsertKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $totalAfektedRow = 0;

      //ambil data yg perlu di insertkan
      $dataListForInsert = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertKulMhsGetDataInsertDirect'], array($semid));
      $prosesAll = $dataListForInsert;
      $totalAfektedRow += $this->getAffectedRow();

      /*$this->StartTransaction();
      $prosesAll = true;

      for ($i=0; $i < count($dataListForInsert); $i++) {
         if($dataListForInsert[$i]['id_smt'] != ""){
            $p = array(
               $dataListForInsert[$i]['id_smt'],
               $dataListForInsert[$i]['id_reg_pd'],
               $dataListForInsert[$i]['ips'],
               $dataListForInsert[$i]['sks_smt'],
               $dataListForInsert[$i]['ipk'],
               $dataListForInsert[$i]['sks_total'],
               $dataListForInsert[$i]['id_stat_mhs']
            );
            $proses = $this->ExecuteInsertQuery($this->mSqlQueries['crawlInsertKulMhsInsertKeFeeder'], $p);
            if($proses == false) $prosesAll = false;
            $totalAfektedRow += $this->getAffectedRow();
         }
      }

      $this->CompleteTransaction($prosesAll);*/
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function dataListHasilCrawlKulMhsTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlKulMhsTotalRows'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNamaMhs
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result[0]['BANYAK'];
   }

   function dataListHasilCrawlKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $offset = $dataParam[4];
      $limit = $dataParam[5];

      $sql = $this->mSqlQueries['dataListHasilCrawlKulMhs'];
      //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $p = array(
         $semid,
         $filterNamaMhs,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function dataListHasilCrawlKulMhsXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlKulMhsXls'];
       //filter status data
      $sqlWhere="";
      if($filterStatusData == "default"){
         $sqlWhere = " (a.`status_data` = 'default') AND ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " a.`status_data` = 'not_active' AND ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " (a.`status_crawl` = '".$filterStatusCrawl."') AND ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $semid,
         $filterNamaMhs
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function setDeleteCrawlDataKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('_', $id_unik);
      $id_smt = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteKulMhs'],array($id_smt,
            $id_reg_pd));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_smt'].$statusDataDelete[0]['id_reg_pd'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $statusDataDelete[0]['id_smt'],
            $statusDataDelete[0]['id_reg_pd']
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $statusDataDelete[0]['id_smt'],
            $statusDataDelete[0]['id_reg_pd']
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataKulMhs'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertMhsGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $mode = $dataParam[0];
      $tahun = $dataParam[1];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['syncCrawlInsertMhsGetInfoRow'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4)  IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $result = $this->GetAllDataAsArray($sql, array($mode));//return 
      return $result[0]['BANYAK'];
   }

   function syncCrawlInsertMhsPtGetInfoRow(){
      $dataParam = $this->GetProperty("DataProceed");
      $mode = $dataParam[0];
      $tahun = $dataParam[1];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['syncCrawlInsertMhsPtGetInfoRow'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4)  IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $result = $this->GetAllDataAsArray($sql, array($mode));//return 
      return $result[0]['BANYAK'];
   }

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

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

   function getDataSyncCrawlDeleteKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlDeleteKulMhs'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlDeleteKulMhs(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_smt'],
               $dataList[$i]['id_reg_pd']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_smt'],
               $dataList[$i]['id_reg_pd']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlKulMhs'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('_', $id_unik);
      $id_smt = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            $id_smt,
            $id_reg_pd
         ); 
      }else{
         $p = array(
            "default",
            $id_smt,
            $id_reg_pd
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataKulMhs'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataKulMhsProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdUnik = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdUnik = substr(trim($rangeIdUnik), 0, -1);
      $arrTemp = explode('@',$rangeIdUnik);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         $arrTemp1 = explode('_', $arrTemp[$i]);
         $id_smt = $arrTemp1[0];
         $id_reg_pd = $arrTemp1[1];
      
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               // "none",
               $id_smt,
               $id_reg_pd
            );
         }else{
            $p = array(
               "default",
               // "insert",
               $id_smt,
               $id_reg_pd
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataKulMhs'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

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

   function getDataSyncCrawlInsertKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlInsertKulMhs'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlKulMhs(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $arrTemp = explode('_', $dataList[$i]['unikKey']);
         $id_smt = $arrTemp[0];
         $id_reg_pd = $arrTemp[1];

         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_smt,
               $id_reg_pd
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_smt,
               $id_reg_pd
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlKulMhs'], $p);
         if($proses == false) $prosesUpdate = false;
      /*
      //if($proses === FALSE){
         $arr_gagal['q'][] = vsprintf($this->mSqlQueries['updateAfterSyncCrawlKulMhs'], $p);
         $arr_gagal['err'][] = $this->mDbErrorMessage;
         print_r($arr_gagal);exit;
      //}
      //*/
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertKulMhsUpdateStatusAfterProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      
      $prosesAll = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertKulMhs'], array($semid));

      /*$this->StartTransaction();
      $prosesAll = true;

      //tabel
      $dataList = $this->GetAllDataAsArray($this->mSqlQueries['getStatusAfterProsesCrawlInsertKulMhs'], array($semid));
      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['status_proses_dikti'] == 'sukses'){
            $p = array(
               $dataList[$i]['id_smt'],
               $dataList[$i]['id_reg_pd']
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetCrawlStatusInsertKulMhs'], $p);
            if($proses == false) $prosesAll = false;
         }
      }
      //$proses = $this->ExecuteUpdateQuery($this->mSqlQueries['resetStatusProsesDiktiInsertKulMhs'], array($semid));
      if($proses == false) $prosesAll = false;

      $this->CompleteTransaction($prosesAll);*/
      return $prosesAll;
   }

   function getCrawlUpdateKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $semid = $dataParam[0];
      $totalAfektedRow = 0;

      //ambil data yg perlu di updatekan
      $dataListForUpdate = $this->GetAllDataAsArray($this->mSqlQueries['crawlUpdateKulMhsGetDataUpdate'], array($semid));
      $prosesAll = $dataListForUpdate;
      $totalAfektedRow = $this->getAffectedRow();

      /*$this->StartTransaction();
      $prosesAll = true;

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

      $this->CompleteTransaction($prosesAll);*/
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

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

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

   function getDataSyncCrawlUpdateKulMhs(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $semid = $dataParam[2];

      return $this->GetAllDataAsArray($this->mSqlQueries['getDataSyncCrawlUpdateKulMhs'], array($semid,$offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlUpdateDataKulMhs(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $arrTemp = explode('_', $dataList[$i]['id_unik']);
         $id_smt = $arrTemp[0];
         $id_reg_pd = $arrTemp[1];

         if($dataList[$i]['prosesUpdate'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_smt,
               $id_reg_pd
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataKulMhs'], $p);
            if($proses == false) $prosesUpdate = false;
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $id_smt,
               $id_reg_pd
            );
            $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlUpdateDataKulMhs'], $p);
            if($proses == false) $prosesUpdate = false;
         }
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncKurikulumDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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['reSyncKurikulumGetGtId'], $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
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['reSyncKurikulum'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncMatKulDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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['reSyncMatKulGetGtId'], $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
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['reSyncMatKul'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncMatKulKurDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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']
         );
         $proses = $this->ExecuteInsertQuery($this->mSqlQueries['reSyncMatKulKur'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncMhsDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncMhs'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncMhsPtDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncMhsPt'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncDosenDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncDosen'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncDosenPtDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncDosenPt'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

      //hapus dl semua datanya
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncBobotNilaiDeleteFirst'], array());
      if($proses == false) $prosesAll = false;

      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']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncBobotNilai'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

   function reSyncKelasKuliahDeleteTable(){
      //create tabel memory temporary
      $proses = $this->ExecuteInsertQuery($this->mSqlQueries['reSyncKelasKuliahCreateTempTable'], array());

      //insertkan dl datanya ke tabel temp sebelum didelete
      $proses = $this->ExecuteInsertQuery($this->mSqlQueries['reSyncKelasKuliahCopyTempTable'], array());

      //proses delete
      $proses = $this->ExecuteDeleteQuery($this->mSqlQueries['reSyncKelasKuliahDeleteTable'], array());
      return $proses;
   }

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

      for ($i=0; $i < count($dataList); $i++) {
         //proses untuk gt_id nya diisi dengan kls_id
         //cek ke tabel temp dl
         $p = array(
            $dataList[$i]['id_kls'],
         );
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['reSyncKelasKuliahGetGtIdFromTabelTemp'], $p);
         if($dataId[0]['gt_id'] == ""){
            $p = array(
               $dataList[$i]['id_smt'],
               $dataList[$i]['id_mk'],
               $dataList[$i]['nm_kls']
            );
            $dataId = $this->GetAllDataAsArray($this->mSqlQueries['reSyncKelasKuliahGetGtId'], $p);
            $gt_id = $dataId[0]['klsId'];
         }else{
            $gt_id = $dataId[0]['gt_id'];
         }

         $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
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncKelasKuliah'], $p);
         if($proses == FALSE){
            $prosesAll = FALSE;
         }
      }

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

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

   function reSyncAjarDosen(){
      $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']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncAjarDosen'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

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

   function reSyncNilai(){
      $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['reSyncNilaiGetGtId'], $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(
            $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."'))";
      }
      $impDataInsert = implode(",",$arrInsert);
      $sqlNya = str_replace('[SYNC_NILAI_DATA_INSERT]', $impDataInsert, $this->mSqlQueries['reSyncNilai']);
      $proses = $this->ExecuteInsertQuery($sqlNya, array());
      if($proses == FALSE) $prosesAll = FALSE;
      $this->CompleteTransaction($prosesAll);

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

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

   function reSyncKuliahMhs(){
      $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']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['reSyncKuliahMhs'], $p);
         if($proses == FALSE) $prosesAll = FALSE;
      }

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

   function getKodeProdiDiktiFeederDefault(){
      $data = $this->GetAllDataAsArray($this->mSqlQueries['getKodeProdiDiktiFeederDefault'], array());
      return $data[0]['prodiProdidiktiKode'];
   }

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

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

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

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

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

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

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

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

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

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

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

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

      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['copyTabelRowCopyingDosen'], $p);
         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

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

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

      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['copyTabelRowCopyingDosenPt'], $p);
         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

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

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

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

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

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

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

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

   function getComboProdiIdSms(){
      return $this->GetAllDataAsArray($this->mSqlQueries['getComboProdiIdSms'], array());
   }
   
   function copyTabelRowCopyingKelasKuliah(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;
      $totalAfektedRow = 0;
      $semid = $dataList[0]; //semid
	  
      for ($i=0; $i < count($dataList); $i++) {
         $params = array(
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_mk'],
            $dataList[$i]['nm_kls']
         );
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataIdKelasKuliah'], $params);
         $gt_id = empty($dataId) ? 0 : $dataId[0]['klsId'];
         if (empty($gt_id)){
            continue;
         }
         $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['copyTabelRowCopyingKelasKuliah'], $p, array($semid));

         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
	  
   }
   
   function copyTabelRowCopyingAjarDosen(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;
      $totalAfektedRow = 0;
			 
      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['copyTabelRowCopyingAjarDosen'], $p);
         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }
   
   function copyTabelRowCopyingNilai(){
      $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;
      $totalAfektedRow = 0;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_kls'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['asal_data'],
            $dataList[$i]['nilai_angka'],
            $dataList[$i]['nilai_huruf'],
            $dataList[$i]['nilai_indeks'],
			$dataList[$i]['id_kls'], //update
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['asal_data'],
            $dataList[$i]['nilai_angka'],
            $dataList[$i]['nilai_huruf'],
			$dataList[$i]['nilai_indeks']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['copyTabelRowCopyingNilai'], $p);
         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            /* insert */
            $dataList[$i]['id_ekuivalensi'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['id_mk'],
            $dataList[$i]['kode_mk_asal'],
            $dataList[$i]['nm_mk_asal'],
            $dataList[$i]['sks_asal'],
            $dataList[$i]['sks_diakui'],
            $dataList[$i]['nilai_huruf_asal'],
            $dataList[$i]['nilai_huruf_diakui'],
            $dataList[$i]['nilai_angka_diakui'],
            /* on duplicate */
            $dataList[$i]['id_ekuivalensi'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['id_mk'],
            $dataList[$i]['kode_mk_asal'],
            $dataList[$i]['nm_mk_asal'],
            $dataList[$i]['sks_asal'],
            $dataList[$i]['sks_diakui'],
            $dataList[$i]['nilai_huruf_asal'],
            $dataList[$i]['nilai_huruf_diakui'],
            $dataList[$i]['nilai_angka_diakui']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['copyTabelRowCopyingNilaiTransfer'], $p);
         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

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

   /* dosen pembimbing */
   function getInfoCountDataDosenPembimbingInsert(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getInfoCountDataDosenPembimbingInsert'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.') ';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array());
      return $data[0]['BANYAK'];
   }

   function crawlInsertDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $totalAfektedRow = 0;
      $sql = $this->mSqlQueries['crawlInsertDosenPembimbingGetDataInsert'];
      //ambil data yg perlu di insertkan
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = 'LEFT(mulai_smt, 4)  IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $dataListForInsert = $this->GetAllDataAsArray($sql, array($tahun));
      $prosesAll = $dataListForInsert;
      $totalAfektedRow += $this->getAffectedRow();
      //if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function dataListHasilCrawlDosenPembimbingTotalRows(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $filterNamaDosen = '%'.$dataParam[4].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlDosenPembimbingTotalRows'];
       //filter status data
      $sqlWhere = ($tahun == 'all') ? 
         "dp.id_ptk IS NOT NULL " : " LEFT(mpt.mulai_smt, 4)  = ".$tahun;
      if($filterStatusData == "default"){
         $sqlWhere = " AND (dp.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere = " AND dp.`status_data` = 'not_active' ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " AND (dp.`status_crawl` = '".$filterStatusCrawl."') ";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $filterNamaMhs,
         $filterNamaDosen
      );
      $_result = $this->GetAllDataAsArray($sql, $p);
      $result = (int) $_result[0]['BANYAK'];
      return $result;
   }

   function dataListHasilCrawlDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $filterNamaDosen = '%'.$dataParam[4].'%';
      $offset = $dataParam[5];
      $limit = $dataParam[6];

      $sql = $this->mSqlQueries['dataListHasilCrawlDosenPembimbing'];
      //filter status data
      $sqlWhere = ($tahun == 'all') ? 
         "dp.id_ptk IS NOT NULL " : " LEFT(mpt.mulai_smt, 4)  = ".$tahun;
      if (!empty($filterStatusData) && $filterStatusData == 'default'){
         $sqlWhere .= " AND (dp.`status_data` = 'default')";
      }else
      if (!empty($filterStatusData) && $filterStatusData == 'not_active'){
         $sqlWhere .= " AND (dp.`status_data` = 'not_active')";
      }

      if($filterStatusCrawl != "all" && 
         ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " AND (dp.`status_crawl` = '".$filterStatusCrawl."')";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);
      $p = array(
         $filterNamaMhs,
         $filterNamaDosen,
         (int) $offset,
         (int) $limit
      );
      return $this->GetAllDataAsArray($sql, $p);
   }

   function cancelCrawlDataDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('__', $id_unik);
      $id_ptk = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      if($setAksi == "setNotAktif"){
         $p = array(
            "not_active",
            $id_ptk,
            $id_reg_pd
         ); 
      }else{
         $p = array(
            "default",
            $id_ptk,
            $id_reg_pd
         );
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataDosenPembimbing'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function cancelCrawlDataDosenPembimbingProAll(){
      $dataParam = $this->GetProperty("DataProceed");
      $rangeIdUnik = $dataParam[0];
      $setAksi = $dataParam[1];

      //hilangkan 1 char terakhir
      $rangeIdUnik = substr(trim($rangeIdUnik), 0, -1);
      $arrTemp = explode('@',$rangeIdUnik);

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($arrTemp); $i++) {
         $arrTemp1 = explode('__', $arrTemp[$i]);
         $id_ptk = $arrTemp1[0];
         $id_reg_pd = $arrTemp1[1];
      
         if($setAksi == "setNotAktif"){
            $p = array(
               "not_active",
               // "none",
               $id_ptk,
               $id_reg_pd
            );
         }else{
            $p = array(
               "default",
               // "insert",
               $id_ptk,
               $id_reg_pd
            );
         }

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['cancelCrawlDataDosenPembimbing'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function dataListHasilCrawlDosenPembimbingXls(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $filterStatusData = $dataParam[1];
      $filterStatusCrawl = $dataParam[2];
      $filterNamaMhs = '%'.$dataParam[3].'%';
      $filterNamaDosen = '%'.$dataParam[4].'%';
      $sql = $this->mSqlQueries['dataListHasilCrawlDosenPembimbingXls'];
       //filter status data
      $sqlWhere = ($tahun == 'all') ?
         "dp.id_ptk IS NOT NULL " : " LEFT(mpt.mulai_smt, 4)  = ".$tahun;
      if($filterStatusData == "default"){
         $sqlWhere .= " AND (dp.`status_data` = 'default') ";
      }
      else if($filterStatusData == "not_active"){
         $sqlWhere .= " AND (dp.`status_data` = 'not_active') ";
      }

      if($filterStatusCrawl != "all" && ($filterStatusCrawl == "none" || $filterStatusCrawl == "update" ||$filterStatusCrawl == "insert" ||$filterStatusCrawl == "delete") ){
         $sqlWhere .= " AND (dp.`status_crawl` = '".$filterStatusCrawl."')";
      }

      $sql = str_replace("[SQL_WHERE_STATUS_DATA]", $sqlWhere, $sql);

      $p = array(
         $filterNamaMhs,
         $filterNamaDosen
      );
      $result = $this->GetAllDataAsArray($sql, $p);
      return $result;
   }

   function setDeleteCrawlDataDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $id_unik = $dataParam[0];
      $arrTemp = explode('_', $id_unik);
      $id_ptk = $arrTemp[0];
      $id_reg_pd = $arrTemp[1];
      $setAksi = $dataParam[1];

      $this->StartTransaction();
      $prosesUpdate = true;

      $statusDataDelete = $this->GetAllDataAsArray($this->mSqlQueries['cekStatusDataDeleteDosenPembimbing'], array($id_ptk,
            $id_reg_pd));
      $statusSyncPDDIKTI = strpos( $statusDataDelete[0]['id_ptk'].$statusDataDelete[0]['id_reg_pd'], 'temp');

      if($setAksi == "setDeleteBatal" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='delete'){
         $p = array(
            "none",
            $id_ptk,
            $id_reg_pd
         );
      }else if ($setAksi == "setDelete" && $statusSyncPDDIKTI===false && $statusDataDelete[0]['status_crawl']=='none'){
         $p = array(
            "delete",
            $id_ptk,
            $id_reg_pd
         );
      }else {
         return false;
      }

      $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['setDeleteCrawlDataDosenPembimbing'], $p);
      if($proses == false) $prosesUpdate = false;

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function getDataSyncCrawlInsertDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      $sql = $this->mSqlQueries['getDataSyncCrawlInsertDosenPembimbing'];
      //ambil data yg perlu di insertkan
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4)  IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      return $this->GetAllDataAsArray($sql, array($offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlDosenPembimbing(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         $gt_id = $dataList[$i]['gt_id'];
         $id_ekuivalensi = $dataList[$i]['id_ekuivalensi'];

         if($dataList[$i]['prosesInsert'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ptk'],
               $dataList[$i]['id_ptk_old'],
               $dataList[$i]['id_reg_pd']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ptk_old'],
               $dataList[$i]['id_ptk_old'],
               $dataList[$i]['id_reg_pd']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlDosenPembimbing'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

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

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

   function getDataSyncCrawlDeleteDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getDataSyncCrawlDeleteDosenPembimbing'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      return $this->GetAllDataAsArray($sql, array($offsetProses,$limitProses));
   }

   function updateAfterSyncCrawlDeleteDosenPembimbing(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesUpdate = true;

      for ($i=0; $i < count($dataList); $i++) {
         if($dataList[$i]['prosesDelete'] == true){
            $p = array(
               'sukses',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ptk'],
               $dataList[$i]['id_ptk'],
               $dataList[$i]['id_reg_pd']
            );
         }else{
            $p = array(
               'gagal',
               $dataList[$i]['error_code'],
               $dataList[$i]['error_desc'],
               $dataList[$i]['id_ptk'],
               $dataList[$i]['id_ptk'],
               $dataList[$i]['id_reg_pd']
            );
         }
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlDosenPembimbing'], $p);
         if($proses == false) $prosesUpdate = false;
      }

      $this->CompleteTransaction($prosesUpdate);
      return $prosesUpdate;
   }

   function syncCrawlInsertDosenPembimbingUpdateStatusAfterProses(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['resetStatusProsesDiktiInsertDosenPembimbing'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4)  IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $prosesAll = $this->ExecuteUpdateQuery($sql, array($tahun));
      return $prosesAll;
   }

   function getCrawlUpdateDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      $totalAfektedRow = 0;
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['crawlUpdateDosenPembimbingGetDataUpdate'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4)  IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      //ambil data yg perlu di updatekan
      $dataListForUpdate = $this->GetAllDataAsArray($sql, array($tahun));
      $prosesAll = $dataListForUpdate;
      $totalAfektedRow += $this->getAffectedRow();
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
   }

   function getInfoCountDataDosenPembimbingUpdate(){
      $dataParam = $this->GetProperty("DataProceed");
      $tahun = $dataParam[0];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getInfoCountDataDosenPembimbingUpdate'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      $data = $this->GetAllDataAsArray($sql, array($tahun));
      return $data[0]['BANYAK'];
   }

   function getDataSyncCrawlUpdateDosenPembimbing(){
      $dataParam = $this->GetProperty("DataProceed");
      $offsetProses = $dataParam[0];
      $limitProses = $dataParam[1];
      $tahun = $dataParam[2];
      if ($tahun == 'all'){
         $th = $this->syncTransComboAngkatan();
         if (!empty($th)){
            $tahun = array();
            foreach ($th as $key => $value) {
               $tahun[] = $value['tahun_masuk'];
            }
         }
      }else{
         $tahun = array($tahun);
      }
      $sql = $this->mSqlQueries['getDataSyncCrawlUpdateDosenPembimbing'];
      $tahun = implode(",", $tahun);
      $sqlWhere = ' LEFT(mulai_smt, 4) IN ('.$tahun.')';
      $sql = str_replace("[SQL_WHERE_DATA]", $sqlWhere, $sql);
      return $this->GetAllDataAsArray($sql, array($offsetProses, $limitProses));
   }

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            /* insert */
            $dataList[$i]['id_ptk'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['urutan_promotor'],
            /* on duplicate */
            $dataList[$i]['id_ptk'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['urutan_promotor'],
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['copyTabelRowCopyingDosenPembimbing'], $p);
         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

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

   /* end dosen pembimbing (end) */

   function copyTabelRowCopyingKuliahMahasiswa(){
	   
	  $dataList = $this->GetProperty("DataProceed");
      $this->StartTransaction();
      $prosesAll = TRUE;
      $totalAfektedRow = 0;
	  $semid = $dataList[0]; //semid

      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]['id_smt'], //update
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['ips'],
            $dataList[$i]['sks_smt'],
            $dataList[$i]['ipk'],
            $dataList[$i]['sks_total'],
			$dataList[$i]['id_stat_mhs']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['copyTabelRowCopyingKuliahMahasiswa'], $p, array($semid));
         if($proses == FALSE){
            $prosesAll = FALSE;
         }else{
            $totalAfektedRow++;
         }
      }

      $this->CompleteTransaction($prosesAll);
      if($prosesAll == false) $totalAfektedRow = 0;
      return $totalAfektedRow;
	  
   }
   
    function copyTransComboSemId(){
      return $this->GetAllDataAsArray($this->mSqlQueries['copyTransComboSemId'], array());
   }
   
   function updateAfterSyncCrawlMhsDuplicated(){
      $dataParam = $this->GetProperty("DataProceed");
      $dataSet = $dataParam;
      if (empty($dataSet)){
         return 0;
      }
      $s = 0;
      $g = 0;

      $this->StartTransaction();
      foreach ($dataSet as $key => $value) {
         $nm_pd = explode("'", $value['nm_pd']);
         $nm_ibu_kandung = explode("'", $value['nm_ibu_kandung']);
         $tgl_lahir = $value['tgl_lahir'];
         $tmpt_lahir = $value['tmpt_lahir'];

         $paramsUpdate = array(
            $value['id_pd'],
            '%'.$nm_pd[0].'%', 
            $tmpt_lahir, 
            $tgl_lahir, 
            '%'.$nm_ibu_kandung[0].'%'
            );
         $prosesMhsPT = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsPtDuplicated'], $paramsUpdate);
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateAfterSyncCrawlMhsDuplicated'], $paramsUpdate);         
         if ($proses && $prosesMhsPT){
            $s++;
         }else{
            $g++;
         }
      }
      $this->CompleteTransaction(true);
      return array('sukses' => $s, 'gagal' => $g);
   }

}
?>