public function updateUangSkripsi() { if (isset($_POST['ubah_uskripsi'])) { if (isset($_POST['js']) && $_POST['js'] == 1) { header('location:' . URL . 'elemenBeasiswa/viewSkripsi'); } if ($_POST['kd_el'] && $_POST['setuju'] != "" && $_POST['r_elem'] != "" && $_POST['kode_jur'] != "" && $_POST['tahun_masuk'] != "" && $_POST['biaya_skripsi'] != "" && $_POST['total_bayar'] != "") { $elem = new ElemenBeasiswa(); $pb = $_POST['setuju']; $jml_peg = count($pb); $elem->set_kd_d($_POST['kd_el']); $elem->set_jml_peg($jml_peg); $elem->set_kd_r($_POST['r_elem']); $elem->set_kd_jur($_POST['kode_jur']); $elem->set_thn_masuk($_POST['tahun_masuk']); $elem->set_biaya_per_peg(str_replace(',', '', $_POST['biaya_skripsi'])); $elem->set_total_bayar(str_replace(',', '', $_POST['total_bayar'])); $elem->set_no_sp2d($_POST['no_sp2d']); $elem->set_tgl_sp2d(date('Y-m-d', strtotime($_POST['tgl_sp2d']))); //var_dump($elem); //echo $kd_elemen_beasiswa; //exit(); //var_dump($elem); $upload = new Upload(); $upload->init('fupload'); if ($upload->getFileName() != "") { $upload->setDirTo("files/sp2d/"); $nama = array($elem->get_no_sp2d(), $elem->get_tgl_sp2d()); //$upload->uploadFile2("", $nama); if ($upload->uploadFile2("", $nama) == false) { $url = URL . 'elemenBeasiswa/editJadup/' . $elem->get_kd_d(); echo '<script> alert("File gagal diupload.") </script>'; echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>'; exit; } $elem->set_file_sp2d($upload->getFileTo()); //echo $upload->getFileName(); if ($_POST['fupload_lama'] != "") { $file = "files/sp2d/" . $_POST['fupload_lama']; //echo $file; if (file_exists($file)) { unlink($file); } } //echo $upload->getFileName(); } else { if ($_POST['fupload_lama'] != "") { $elem->set_file_sp2d($_POST['fupload_lama']); //echo $_POST['fupload_lama']; } else { $elem->set_file_sp2d(""); } } $elem->update_elem($elem); $penerima = new PenerimaElemenBeasiswa(); $penerima->delete($elem->get_kd_d()); foreach ($pb as $val) { $penerima_elemen = new PenerimaElemenBeasiswa(); $penerima_elemen->kd_elemen_beasiswa = $elem->get_kd_d(); $penerima_elemen->kd_pb = $val; $penerima_elemen->add($penerima_elemen); } ClassLog::write_log("elemen beasiswa", "ubah uang penelitian", "kd_el." . $elem->get_kd_d()); //$url = URL . 'elemenBeasiswa/editSkripsi/' . $elem->get_kd_d(); $url = URL . 'elemenBeasiswa/viewSkripsi'; echo '<script> alert("Data berhasil disimpan") </script>'; echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>'; } else { header('location:' . URL . 'elemenBeasiswa/editSkripsi/' . $elem->get_kd_d()); } } else { header('location:' . URL . 'elemenBeasiswa/viewSkripsi'); } }
public function get_list_elem($univ = NULL, $jurusan = NULL, $tahun = NULL, $sts = NULL, $user = NULL) { $sql = "SELECT \r\n a.KD_D_ELEM_BEASISWA AS KD_D_ELEM_BEASISWA,\r\n a.KD_R_ELEM_BEASISWA AS KD_R_ELEM_BEASISWA,\r\n a.TAHUN_MASUK AS TAHUN_MASUK,\r\n a.KD_JUR AS KD_JUR,\r\n b.NM_JUR as NM_JUR,\r\n c.KD_FAKUL AS KD_FAKUL,\r\n d.NM_UNIV as NM_UNIV,\r\n a.NO_SP2D_D_ELEM_BEASISWA as NO_SP2D_D_ELEM_BEASISWA,\r\n a.TGL_SP2D_D_ELEM_BEASISWA as TGL_SP2D_D_ELEM_BEASISWA,\r\n a.JML_PEG_D_ELEM_BEASISWA as JML_PEG_D_ELEM_BEASISWA,\r\n a.BLN_D_ELEM_BEASISWA as BLN_D_ELEM_BEASISWA,\r\n a.THN_D_ELEM_BEASISWA as THN_D_ELEM_BEASISWA,\r\n a.TOTAL_BAYAR_D_ELEM_BEASISWA as TOTAL_BAYAR_D_ELEM_BEASISWA\r\n FROM " . $this->_table . " a\r\n LEFT JOIN r_jur b ON a.KD_JUR = b.KD_JUR\r\n LEFT JOIN r_fakul c ON b.KD_FAKUL = c.KD_FAKUL\r\n LEFT JOIN r_univ d ON c.KD_UNIV = d.KD_UNIV\r\n "; if ($user != "") { $sql .= " WHERE d.KD_USER = '******'"; } if ($univ != "") { if ($user != "") { $sql .= " AND d.KD_UNIV ='" . $univ . "'"; } else { $sql .= " WHERE d.KD_UNIV ='" . $univ . "'"; } } if ($jurusan != "") { if ($user != "" || $univ != "") { $sql .= " AND b.KD_JUR ='" . $jurusan . "'"; } else { $sql .= " WHERE b.KD_JUR ='" . $jurusan . "'"; } } if ($tahun != "") { if ($user != "" || $univ != "" || $jurusan != "") { $sql .= " AND a.TAHUN_MASUK ='" . $tahun . "'"; } else { $sql .= " WHERE a.TAHUN_MASUK ='" . $tahun . "'"; } } if ($sts != "") { if ($user != "" || $univ != "" || $jurusan != "" || $tahun != "") { if ($sts == "1") { $sql .= " AND NO_SP2D_D_ELEM_BEASISWA IS NULL OR NO_SP2D_D_ELEM_BEASISWA =''"; } if ($sts == "2") { $sql .= " AND NO_SP2D_D_ELEM_BEASISWA !=''"; } } else { if ($sts == "1") { $sql .= " WHERE NO_SP2D_D_ELEM_BEASISWA IS NULL OR NO_SP2D_D_ELEM_BEASISWA =''"; } if ($sts == "2") { $sql .= " WHERE NO_SP2D_D_ELEM_BEASISWA !=''"; } } } $sql .= " order by a.KD_D_ELEM_BEASISWA desc"; $result = $this->db->select($sql); $data = array(); foreach ($result as $key => $value) { $elem = new ElemenBeasiswa(); $elem->set_kd_d($value['KD_D_ELEM_BEASISWA']); $elem->set_kd_r($value['KD_R_ELEM_BEASISWA']); $elem->set_no_sp2d($value['NO_SP2D_D_ELEM_BEASISWA']); $elem->set_tgl_sp2d(date('d-m-Y', strtotime($value['TGL_SP2D_D_ELEM_BEASISWA']))); $elem->set_univ($value['NM_UNIV']); $elem->set_thn_masuk($value['TAHUN_MASUK']); $elem->set_kd_jur($value['KD_JUR']); $elem->set_jml_peg($value['JML_PEG_D_ELEM_BEASISWA']); $elem->set_bln($value['BLN_D_ELEM_BEASISWA']); $elem->set_biaya_per_peg($v['BIAYA_PER_PEG_D_ELEM_BEASISWA']); $elem->set_thn($value['THN_D_ELEM_BEASISWA']); $elem->set_total_bayar($value['TOTAL_BAYAR_D_ELEM_BEASISWA']); $data[] = $elem; } //var_dump($data); return $data; }