load->library('session'); $this->load->library('rhlib'); } function autoNumber($column,$tbl){ $q = "SELECT max(".$column.")+1 as max FROM ".$tbl."" ; $query = $this->db->query($q); $max = ''; if ($query->num_rows() != 0) { $row = $query->row(); $max=$row->max; } if ($max == null){ $max=0; } return $max; } function getJsonFromSP($sql, $parameters){ $KEDUA= $this->load->database('second', TRUE); $query = $KEDUA->query($sql, $parameters); $data = array(); $build_array = array ("success"=>false,"results"=>-1,"data"=>array(),"msg"=>"error"); if ($query->num_rows() == 0) { $build_array["success"]=true; $build_array["results"]=0; $build_array["msg"]="no data"; } if ($query->num_rows() > 0) { $data = $query->result(); $ttl = count($data); if($ttl > 0){ $build_array["success"]=true; $build_array["results"]=$ttl; $build_array["data"]=$data; $build_array["msg"]= ""; } } echo json_encode($build_array); } function id_field($column,$tbl,$whereb, $wherea){ $q = "SELECT ".$column." as id FROM ".$tbl." where ".$whereb." = '".$wherea."' " ; $query = $this->db->query($q); $id = ''; if ($query->num_rows() != 0) { $row = $query->row(); $id=$row->id; } return $id; } function nm_field($column,$tbl,$whereb, $wherea){ $q = "SELECT ".$column." as nm FROM ".$tbl." where ".$whereb." = '".$wherea."' " ; $query = $this->db->query($q); $nm= ''; if ($query->num_rows() != 0) { $row = $query->row(); $nm=$row->nm; } return $nm; } function oto($var){ $q = "SELECT getOtonoPmb(".$var.") as nm;"; $query = $this->db->query($q); $nm= ''; if ($query->num_rows() != 0) { $row = $query->row(); $nm=$row->nm; } return $nm; } function kodeprodi2($wherea){ $q = "SELECT kdprodi2 FROM pmb WHERE nopmb = '".$wherea."' " ; $query = $this->db->query($q); $nm= ''; if ($query->num_rows() != 0) { $row = $query->row(); $nm=$row->kdprodi2; } return $nm; } function kodeprodi1($wherea){ $q = "SELECT kdprodi1 FROM pmb WHERE nopmb = '".$wherea."' " ; $query = $this->db->query($q); $nm= ''; if ($query->num_rows() != 0) { $row = $query->row(); $nm=$row->kdprodi1; } return $nm; } // START PENGGUNA function grid(){ //ISTRA $KEDUA= $this->load->database('second', TRUE); /*membuka koneksi database untuk d_mahasiswa*/ $kdstsemester = $this->input->post("kdstsemester"); $niduwali = $this->input->post("niduwali"); $q = $KEDUA->query("CALL sp_getPerwalian (?,?)",array($kdstsemester,$niduwali)); $data = array(); if ($q->num_rows() > 0) { $data = $q->result(); } $datax = count($data); $ttl = $datax; $build_array = array ("success"=>true,"results"=>$ttl,"data"=>array()); foreach($data as $row) { array_push($build_array["data"],array( 'kdstsemester'=>$row->kdstsemester, 'tglkrs'=>$row->tglkrs, 'nim'=>$row->nim, 'nmmhs'=>$row->nmmhs, 'kdjnskelamin'=>$row->kdjnskelamin, 'nmprodi'=>$row->nmprodi, 'kdprodi'=>$row->kdprodi, 'nmklsmhs'=>$row->nmklsmhs, 'tahunmsk'=>$row->thnmasuk, 'nmstkrs'=>$row->nmstkrs, 'nmkodtbkod'=>$row->nmstawalmhs, 'bayardpp'=>$row->bayardpp, 'diskondpp'=>$row->diskondpp, 'persendpp'=>$row->persendpp, 'tagihandpk'=>$row->tagihandpk, 'bayardpk'=>$row->bayardpk, 'stlunasdpk'=>$row->stlunasdpk, )); } echo json_encode($build_array); } //tabel_excel// /* function grid_perwalian_excel($tglkrs, $kdstsemester, $nidu, $nmdosdgngelar, $nim, $nmmhs, $kdjnskelamin, $kdprodi, $nmprodi, $thnmasuk, $nmstawalmhs, $idstkrs, $nmstkrs){ $KEDUA= $this->load->database('second', TRUE); $dataArray = array( 'tglkrs'=>$row->tglkrs, 'kdstsemester'=>$row->kdstsemester, 'nidu'=>$row->nidu, 'nmdosdgngelar'=>$row->nmdosdgngelar, 'nim'=>$row->nim, 'nmmhs'=>$row->nmmhs, 'kdjnskelamin'=>$row->kdjnskelamin, 'kdprodi'=>$row->kdprodi, 'nmprodi'=>$row->nmprodi, 'thnmasuk'=>$row->thnmasuk, 'nmstawalmhs'=>$row->nmstawalmhs, 'idstkrs'=>$row->idstkrs, 'nmstkrs'=>$row->nmstkrs, ); $ret = $KEDUA->insert("excel_perwalian",$dataArray); return $ret; } */ /* function grid_perwalian_excel2(){ if (isset($_POST['kdstsemester']) && isset($_POST['niduwali'])){ $kdstsemester = $_POST['kdstsemester']; $niduwali = $_POST['niduwali']; $sql = "CALL sp_getPerwalian_excel(?,?)"; $parameters = array($kdstsemester, $niduwali); $this->getJsonFromSP($sql, $parameters); } else json_encode(array("success"=>false,"results"=>0,"data"=>array(),"msg"=>"no data")); } */ function save(){ // ISTRA $arr_tgl1 = explode('/',$this->input->post("tgltransfer")); $tgltransfer = $arr_tgl1[2]."-".$arr_tgl1[0]."-".$arr_tgl1[1]; $arr_tgl2 = explode('/',$this->input->post("tgllahir")); $tgllahir = $arr_tgl2[2]."-".$arr_tgl2[0]."-".$arr_tgl2[1]; $arr_tgl3 = explode('/',$this->input->post("tglijazahslta")); $tglijazahslta = $arr_tgl3[2]."-".$arr_tgl3[0]."-".$arr_tgl3[1]; $data = array( 'nopmb'=> $this->oto($_POST['h_kdjadwalpmb']), 'tglpmb'=>$tglijazahslta, 'idjadwalpmb'=> $this->nm_field('idjadwalpmb', 'jadwalpmb', 'nmjadwalpmb',$_POST['nmjadwalpmb']), 'idstmskmhs'=> $this->nm_field('idstmskmhs', 'stmskmhs', 'nmstmskmhs',$_POST['idstmskmhs']), 'kdprodi1'=> $_POST['h_kdprodi1'],//$_POST['kdprodi1'], 'kdprodi2'=> $_POST['h_kdprodi2'],//$_POST['kdprodi2'], 'idklsmhs1'=> $this->nm_field('idklsmhs', 'klsmhs', 'nmklsmhs',$_POST['idklsmhs1']), //1 10 'idklsmhs2'=> $this->nm_field('idklsmhs', 'klsmhs', 'nmklsmhs',$_POST['idklsmhs2']), 'nama'=> $_POST['nama'], 'kdjk'=> $_POST['kdjk'], //10 'tptlahir'=> $_POST['tptlahir'], 'tgllahir'=> $tgllahir, 'alamatasal'=> $_POST['alamatasal'], 'kelurahanasal'=> $_POST['kelurahanasal'], 'kecamatanasal'=> $_POST['kecamatanasal'], 'kdkotkabasal'=> $_POST['kdkotkabasal'], //nmkotkabtampil nmpropinsitampil // 'nmkotkabtampil'=> $_POST['nmkotkabtampil'], // 'nmpropinsitampil'=> $_POST['nmpropinsitampil'], 'alamatsurat'=> $_POST['alamatsurat'], //2 10 'kdpossurat'=> $_POST['kdpossurat'], 'notelp'=> $_POST['notelp'], 'nmslta'=> $_POST['nmslta'], //20 'kdkotkabslta'=> $_POST['kdkotkabslta'], //nmkotkabsltatampil nmpropinsisltatampil // 'nmkotkabsltatampil'=> $_POST['nmkotkabsltatampil'], // 'nmpropinsisltatampil'=> $_POST['nmpropinsisltatampil'], 'thnlulusslta'=> $_POST['thnlulusslta'], 'nemslta'=> $_POST['nemslta'], 'rangkingslta'=> $_POST['rangkingslta'], 'noijazahslta'=> $_POST['noijazahslta'], 'tglijazahslta'=> $tglijazahslta, 'nmortu'=> $_POST['nmortu'], 'idpekerjaanortu'=> $this->nm_field('idpekerjaanortu', 'pekerjaanortu', 'nmpekerjaanortu', $_POST['idpekerjaanortu']) , //3 10 'alamatortu'=> $_POST['alamatortu'], 'nmtptbekerjamhs'=> $_POST['nmtptbekerjamhs'], //30 'idpekerjaanmhs'=> $this->nm_field('idpekerjaanortu', 'pekerjaanortu', 'nmpekerjaanortu', $_POST['idpekerjaanmhs']), //ds pekerjaan ortu 'alamatkerjamhs'=> $_POST['alamatkerjamhs'], 'kdptasal'=> $_POST['kdptasal'], //nmptasal 'nmptasal'=> $_POST['nmptasal'], 'kdkotkabptasal'=> $_POST['kdkotkabptasal'], //nmkotkabpttampil nmpropinsipttampil // 'nmkotkabpttampil'=> $_POST['nmkotkabpttampil'], // 'nmpropinsipttampil'=> $_POST['nmpropinsipttampil'], 'fakultasasal'=> $_POST['fakultasasal'], 'kdprodiasal'=> $_POST['kdprodiasal'], 'nmprodiasal'=> $_POST['nmprodiasal'], 'idjenpdkpendaftar'=> $this->nm_field('idjenpdkpendaftar', 'jenpdkpendaftar', 'nmjenpdkpendaftar',$_POST['idjenpdkpendaftar']), 'nimasal'=> $_POST['nimasal'], //4 10 //40 'idstakreditasi'=> $this->nm_field('idstakreditasi', 'stakreditasi', 'nmstakreditasi',$_POST['idstakreditasi']), // 'password'=> $_POST['password'], // 'setbiayapmb'=> $_POST['setbiayapmb'], 'nobuktitransfer'=> $_POST['nobuktitransfer'], 'tgltransfer'=> $tgltransfer, 'antransfer'=> $_POST['antransfer'], 'idsbrinfo'=> $this->nm_field('idsbrinfo', 'sbrinfo', 'nmsbrinfo',$_POST['idsbrinfo']), //5 10 'idrekpmb'=> $this->nm_field('idrekpmb', 'rekpmb', 'nmrekpmb',$_POST['idrekpmb']), 'nmrekomendasi'=> $_POST['nmrekomendasi'], 'idalasanpendaftar'=> $_POST['idalasanpendaftar'], 'ketlainnya'=> $_POST['ketlainnya'], 'email'=> $_POST['email'], //49 //tambahan 'idcaradaftar'=>'1', 'idstpmb'=>'2', ); // $this->db->trans_begin(); $this->db->insert("pmb", $data); // $exec = $this->db->query("CALL SP_updateverifikasipmb ( // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,? // )",$data); // // if ($exec === FALSE) // { // $this->db->trans_rollback(); // $return["success"]=false; // $return["message"]="Ubah Data gagal"; // } // else // { // $this->db->trans_commit(); // $return["success"]=true; // $return["message"]="Ubah Data Berhasil"; // } // return $return; if($this->db->affected_rows()){ $ret["success"]=true; $ret["message"]='Simpan Data Berhasil'; }else{ $ret["success"]=false; $ret["message"]='Simpan Data Gagal'; } return $ret; } function update(){ // ISTRA $arr_tgl1 = explode('/',$this->input->post("tgltransfer")); $tgltransfer = $arr_tgl1[2]."-".$arr_tgl1[0]."-".$arr_tgl1[1]; $arr_tgl2 = explode('/',$this->input->post("tgllahir")); $tgllahir = $arr_tgl2[2]."-".$arr_tgl2[0]."-".$arr_tgl2[1]; $arr_tgl3 = explode('/',$this->input->post("tglijazahslta")); $tglijazahslta = $arr_tgl3[2]."-".$arr_tgl3[0]."-".$arr_tgl3[1]; $data = array( 'idjadwalpmb'=> $this->nm_field('idjadwalpmb', 'jadwalpmb', 'nmjadwalpmb',$_POST['nmjadwalpmb']), 'idstmskmhs'=> $this->nm_field('idstmskmhs', 'stmskmhs', 'nmstmskmhs',$_POST['idstmskmhs']), 'kdprodi1'=> $this->kodeprodi1($_POST['nopmb']),//$_POST['kdprodi1'], 'kdprodi2'=> $this->kodeprodi2($_POST['nopmb']),//$_POST['kdprodi2'], 'idklsmhs1'=> $this->nm_field('idklsmhs', 'klsmhs', 'nmklsmhs',$_POST['idklsmhs1']), //1 10 'idklsmhs2'=> $this->nm_field('idklsmhs', 'klsmhs', 'nmklsmhs',$_POST['idklsmhs2']), 'nama'=> $_POST['nama'], 'kdjk'=> $_POST['kdjk'], 'tptlahir'=> $_POST['tptlahir'], 'tgllahir'=> $tgllahir, 'alamatasal'=> $_POST['alamatasal'], 'kelurahanasal'=> $_POST['kelurahanasal'], 'kecamatanasal'=> $_POST['kecamatanasal'], 'kdkotkabasal'=> $_POST['kdkotkabasal'], //nmkotkabtampil nmpropinsitampil // 'nmkotkabtampil'=> $_POST['nmkotkabtampil'], // 'nmpropinsitampil'=> $_POST['nmpropinsitampil'], 'alamatsurat'=> $_POST['alamatsurat'], //2 10 'kdpossurat'=> $_POST['kdpossurat'], 'notelp'=> $_POST['notelp'], 'nmslta'=> $_POST['nmslta'], 'kdkotkabslta'=> $_POST['kdkotkabslta'], //nmkotkabsltatampil nmpropinsisltatampil // 'nmkotkabsltatampil'=> $_POST['nmkotkabsltatampil'], // 'nmpropinsisltatampil'=> $_POST['nmpropinsisltatampil'], 'thnlulusslta'=> $_POST['thnlulusslta'], 'nemslta'=> $_POST['nemslta'], 'rangkingslta'=> $_POST['rangkingslta'], 'noijazahslta'=> $_POST['noijazahslta'], 'tglijazahslta'=> $tglijazahslta, 'nmortu'=> $_POST['nmortu'], 'idpekerjaanortu'=> $this->nm_field('idpekerjaanortu', 'pekerjaanortu', 'nmpekerjaanortu', $_POST['idpekerjaanortu']) , //3 10 'alamatortu'=> $_POST['alamatortu'], 'nmtptbekerjamhs'=> $_POST['nmtptbekerjamhs'], 'idpekerjaanmhs'=> $this->nm_field('idpekerjaanortu', 'pekerjaanortu', 'nmpekerjaanortu', $_POST['idpekerjaanmhs']), //ds pekerjaan ortu 'alamatkerjamhs'=> $_POST['alamatkerjamhs'], 'kdptasal'=> $_POST['kdptasal'], //nmptasal 'nmptasal'=> $_POST['nmptasal'], 'kdkotkabptasal'=> $_POST['kdkotkabptasal'], //nmkotkabpttampil nmpropinsipttampil // 'nmkotkabpttampil'=> $_POST['nmkotkabpttampil'], // 'nmpropinsipttampil'=> $_POST['nmpropinsipttampil'], 'fakultasasal'=> $_POST['fakultasasal'], 'kdprodiasal'=> $_POST['kdprodiasal'], 'nmprodiasal'=> $_POST['nmprodiasal'], 'idjenpdkpendaftar'=> $this->nm_field('idjenpdkpendaftar', 'jenpdkpendaftar', 'nmjenpdkpendaftar',$_POST['idjenpdkpendaftar']), 'nimasal'=> $_POST['nimasal'], //4 10 'idstakreditasi'=> $this->nm_field('idstakreditasi', 'stakreditasi', 'nmstakreditasi',$_POST['idstakreditasi']), 'email'=> $_POST['email'], // 'password'=> $_POST['password'], // 'setbiayapmb'=> $_POST['setbiayapmb'], 'nobuktitransfer'=> $_POST['nobuktitransfer'], 'tgltransfer'=> $tgltransfer, 'antransfer'=> $_POST['antransfer'], 'idsbrinfo'=> $this->nm_field('idsbrinfo', 'sbrinfo', 'nmsbrinfo',$_POST['idsbrinfo']), //5 10 'idrekpmb'=> $this->nm_field('idrekpmb', 'rekpmb', 'nmrekpmb',$_POST['idrekpmb']), 'nmrekomendasi'=> $_POST['nmrekomendasi'], 'idalasanpendaftar'=> $_POST['idalasanpendaftar'], 'ketlainnya'=> $_POST['ketlainnya'], 'nopmb'=> $_POST['nopmb'], ); $this->db->trans_begin(); $where['nopmb']=$this->input->post('nopmb'); $this->db->where($where); $this->db->update("pmb", $data); // $exec = $this->db->query("CALL SP_updateverifikasipmb ( // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,?, // ?,?,?,?,?,?,?,?,?,? // )",$data); // // if ($exec === FALSE) // { // $this->db->trans_rollback(); // $return["success"]=false; // $return["message"]="Ubah Data gagal"; // } // else // { // $this->db->trans_commit(); // $return["success"]=true; // $return["message"]="Ubah Data Berhasil"; // } // return $return; if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $return["success"]=false; $return["message"]="Ubah Data gagal"; } else { $this->db->trans_commit(); $return["success"]=true; $return["message"]="Ubah Data Berhasil"; } return $return; } function verifikasiidcarabyr(){ // ISTRA $details=$this->input->post("details"); $this->db->trans_begin(); $rows = explode(";",$details); $row_count = count($rows); for($ri=0;$ri<$row_count;$ri++){ $rows2 = explode("x",$rows[$ri]); // $row_count2 = count($rows2); // $x=0; // for($rd=$x;$rd<=$row_count2;$rd++){ $this->db->query("CALL SP_verifikasipmbidcarabyr (?,?,?)",array($rows2[0],$rows2[1],$rows2[2])); // } } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $return["success"]=false; $return["message"]="Ubah Data gagal"; } else { $this->db->trans_commit(); $return["success"]=true; $return["message"]="Ubah Data Berhasil"; } return $return; } function delete(){ //ISTRA $where['kdpmb']=$this->input->post('hapus_id'); $this->db->trans_begin(); // $this->db->where($where); $this->db->delete("pmb",$where); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $return["success"]=false; $return["message"]="Hapus Data gagal"; } else { $this->db->trans_commit(); $return["success"]=true; $return["message"]="Hapus Data Berhasil"; } return $return; } //END JENIS KELOMPOK PENGGUNA //--------------------excel-----------------------// function export_excel($kdstsemester,$niduwali) { $KEDUA= $this->load->database('second', TRUE); $q = $KEDUA->query("CALL sp_getPerwalian (?,?)",array($kdstsemester,$niduwali)); $result = array(); if ($q->num_rows() > 0) { $result = $q->result(); } $build_array = array(); foreach($result as $row) { array_push($build_array,array( 'tglkrs'=>$row->tglkrs, 'kdstsemester'=>$row->kdstsemester, 'nidu'=>$row->nidu, 'nmdosdgngelar'=>$row->nmdosdgngelar, 'nim'=>$row->nim, 'nmmhs'=>$row->nmmhs, 'kdjnskelamin'=>$row->kdjnskelamin, 'kdprodi'=>$row->kdprodi, 'nmprodi'=>$row->nmprodi, 'nmklsmhs'=>$row->nmklsmhs, 'thnmasuk'=>$row->thnmasuk, 'nmstawalmhs'=>$row->nmstawalmhs, 'idstkrs'=>$row->idstkrs, 'nmstkrs'=>$row->nmstkrs, 'bayardpp'=>$row->bayardpp, 'diskondpp'=>$row->diskondpp, 'persendpp'=>$row->persendpp, 'tagihandpk'=>$row->tagihandpk, 'bayardpk'=>$row->bayardpk, 'stlunasdpk'=>$row->stlunasdpk, )); } $list_fields = array('tglkrs', 'kdstsemester', 'nidu', 'nmdosdgngelar', 'nim', 'nmmhs', 'kdjnskelamin', 'kdprodi', 'nmprodi', 'nmklsmhs', 'thnmasuk', 'nmstawalmhs', 'idstkrs', 'nmstkrs', 'bayardpp', 'diskondpp', 'persendpp', 'tagihandpk', 'bayardpk', 'stlunasdpk'); $data['eksport'] = $build_array; $data['table'] = "excel_perwalian"; $data['fieldname'] = $list_fields; $this->load->view('exportexcel', $data); } //DAFTAR DOSEN WALI function get_dos_wal(){ $kdstsemester = $_POST['kdstsemester']; $q = "SELECT a.nidu , a.nidn , a.nmdosdgngelar , a.kdjnskelamin , b.nmprodi AS nmprodiwali , e.nmstikj , f.nmstaktiv , count(dd.nim) AS cnim FROM dosen a LEFT JOIN (SELECT kdkodtbkod AS kdstikj , nmkodtbkod AS nmstikj FROM tbkod WHERE kdapltbkod = '03') e ON a.kdstikatankerjadosen = e.kdstikj LEFT JOIN (SELECT kdkodtbkod AS kdstaktiv , nmkodtbkod AS nmstaktiv FROM tbkod WHERE kdapltbkod = '15') f ON a.kdstaktivitasdosen = f.kdstaktiv JOIN dosenwali d ON a.nidu = d.nidu AND d.kdstsemester = '$kdstsemester' LEFT JOIN prodi b ON b.kdprodi = d.kdprodi LEFT JOIN dosenwalidet dd ON d.nidu = dd.nidu AND d.kdprodi = dd.kdprodi AND d.kdstsemester = dd.kdstsemester GROUP BY d.kdprodi , d.kdstsemester , d.nidu ORDER BY a.nmdosdgngelar"; $this->rhlib->jsonFromQueryWLimit2($q); } }