load->library('session'); $this->load->library('rhlib'); } function jsonFromQuery($q) { $this->rhlib->jsonFromQuery($q); } function jsonFromQueryWLimit($q){ $this->rhlib->jsonFromQueryWLimit($q); } function retValOrNull($val){ //especially for combo & looukup with no item selected $val = ($val=='')? null : $val; return $val; } function get_biaya_wisuda(){ $q = "SELECT * FROM setbiayawisuda where idstatus=1"; $this->jsonFromQuery($q); } function lookup_mhs_lulus(){ $q = "SELECT `mahasiswa`.`nim` AS `nim` , `mahasiswa`.`nmmhs` AS `nmmhs` , `mahasiswa`.`kdjnskelamin` AS `kdjnskelamin` , `mahasiswa`.`thnmasuk` AS `thnmasuk` , `mahasiswa`.`thnkeluar` AS `thnkeluar` , `staktifmhs`.`nmkodtbkod` AS `nmstaktivitasmhs` , `prodi`.`nmprodi` AS `nmprodi` , `prodi`.`kdjenjangstudi` AS `kdjenjangstudi` , `jenjangstudi`.`nmkodtbkod` AS `nmjenjangstudi` FROM `mahasiswa` LEFT JOIN `klsmhs` ON `mahasiswa`.`idklsmhs` = `klsmhs`.`idklsmhs` LEFT JOIN `pimpinan` ON `mahasiswa`.`idpimpinan1` = `pimpinan`.`idpimpinan` LEFT JOIN `prodi` ON `mahasiswa`.`kdprodi` = `prodi`.`kdprodi` LEFT JOIN `tbkod` `jenjangstudi` ON `prodi`.`kdjenjangstudi` = `jenjangstudi`.`kdkodtbkod` AND `jenjangstudi`.`kdapltbkod` = 4 LEFT JOIN `tbkod` `staktifmhs` ON `mahasiswa`.`kdstaktivitasmhs` = `staktifmhs`.`kdkodtbkod` AND `staktifmhs`.`kdapltbkod` = 5 WHERE `mahasiswa`.`kdstaktivitasmhs` = 'L' ORDER BY mahasiswa.thnkeluar DESC,`mahasiswa`.nim"; $this->jsonFromQueryWLimit($q); } function lookup_mhs_lulus_old(){ $q = "SELECT `mahasiswa`.`nim` AS `nim` , `mahasiswa`.`nmmhs` AS `nmmhs` , `mahasiswa`.`kdjnskelamin` AS `kdjnskelamin` , `mahasiswa`.`thnmasuk` AS `thnmasuk` , `mahasiswa`.`thnkeluar` AS `thnkeluar` FROM `mahasiswa`"; $this->jsonFromQueryWLimit($q); } function get_autokwiwisuda($tglkuiwisuda){ $q = "SELECT getOtoKuiWisuda('".$tglkuiwisuda."') as nokuitansi"; $query = $this->db->query($q); return $query->row()->nokuitansi; } function getFieldsAndValues(){ $dataArray = array( 'nokuiwisuda'=> $this->get_autokwiwisuda($_POST['tglkuiwisuda']), 'tglkuiwisuda'=> $_POST['tglkuiwisuda'], 'jamkuiwisuda'=> $_POST['jamkuiwisuda'], 'idcarabyr'=> $_POST['idcarabyr'], 'noref'=> $_POST['noref'], 'nim' => $_POST['nim'], 'idsetbiayawisuda' => $_POST['idsetbiayawisuda'], 'bayar' => $_POST['bayar'], 'tglinput' => date("Y-m-d"), 'useridinput' => $_POST['useridinput'], 'idstkuitansi' => 1, ); return $dataArray; } function insert_peserta_wisuda($nim){ $query = $this->db->query('SELECT * FROM syaratwisuda WHERE kdsyaratwisuda = "BY"'); foreach ($query->result() as $row){ $kdsyaratwisuda = $row->kdsyaratwisuda; } $query_stsemester = $this->db->query('SELECT * FROM stsemester WHERE idstatus = 1'); foreach ($query_stsemester->result() as $row){ $kdstsemester = $row->kdstsemester; } $dataArray = array( 'nim'=> $nim, 'kdstsemester'=> $kdstsemester, 'kdsyaratwisuda'=> $kdsyaratwisuda, 'idklppengguna'=> 6, ); $ret = $this->rhlib->insertRecord('klkpsyaratwisuda',$dataArray); if ($ret) { $return['success']=true; $return['message']='Simpan Data Berhasil'; } else { $return['success']=false; $return['message']='Simpan Data Gagal'; } return $return; } function simpan_kwiwisuda(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('kuitansiwisuda',$dataArray); if ($ret) { $this->insert_peserta_wisuda($_POST['nim']); $return['success']=true; $return['message']='Simpan Data Berhasil'; $return['nokuiwisuda']=$dataArray['nokuiwisuda']; } else { $return['success']=false; $return['message']='Simpan Data Gagal'; } echo json_encode($return); } function lookup_kwiwisuda(){ $q = "SELECT * FROM v_kuitansiwisuda WHERE idstkuitansi = 1 ORDER BY nokuiwisuda DESC"; $this->jsonFromQueryWLimit($q); } function batal_kwiwisuda(){ $this->db->trans_begin(); $where['nokuiwisuda']= $_POST['nokuiwisuda']; $this->db->where($where); $this->db->set('idstkuitansi', 2); $this->db->set('useridupdate', $_POST['useridinput']); $this->db->set('tglupdate',date("Y-m-d")); $this->db->update("kuitansiwisuda"); 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; } }