public function get_cuti_by_pb_name($name, $kd_user = null) { $sql = "SELECT a.KD_CUTI as KD_CUTI,\r\n a.KD_JNS_SRT_CUTI as KD_JNS_SRT_CUTI,\r\n a.KD_PB as KD_PB,\r\n a.NO_CUTI as NO_CUTI,\r\n a.TGL_CUTI AS TGL_CUTI,\r\n a.PRD_MUL_CUTI as PRD_MUL_CUTI,\r\n a.PRD_SEL_CUTI as PRD_SEL_CUTI,\r\n a.PERK_STOP as PERK_STOP,\r\n a.PERK_GO as PERK_GO,\r\n a.FILE_CUTI as FILE_CUTI\r\n FROM " . $this->t_cuti . " a \r\n LEFT JOIN d_pb b ON a.KD_PB=b.KD_PB\r\n LEFT JOIN r_jur c ON b.KD_JUR=c.KD_JUR\r\n LEFT JOIN r_fakul d ON c.KD_FAKUL=d.KD_FAKUL\r\n LEFT JOIN r_univ e ON d.KD_UNIV=e.KD_UNIV\r\n WHERE b.NM_PB LIKE '%" . $name . "%'"; if (!is_null($kd_user)) { $sql .= " AND e.KD_USER="******"-" . $d_pb->get_nip() . "-" . $d_jur->get_nama()); $cuti->set_no_surat_cuti($v['NO_CUTI']); $cuti->set_tgl_surat_cuti($v['TGL_CUTI']); $cuti->set_prd_mulai($v['PRD_MUL_CUTI']); $cuti->set_prd_selesai($v['PRD_SEL_CUTI']); $cuti->set_perk_stop($v['PERK_STOP']); $cuti->set_perk_go($v['PERK_GO']); unset($pb); unset($jur); $data[] = $cuti; } return $data; }
public function delCuti($id) { $sc = new JenisSuratCuti($this->registry); if (is_null($id)) { throw new Exception(); echo "id belum dimasukkan!"; return; } $sc->set_kode($id); $sc->delete_jsc(); header('location:' . URL . 'admin/addCuti'); }
public function datasc($id = 0, $halaman = 1, $batas = 10) { $ct = new Cuti($this->registry); if (isset($_POST['sb_add'])) { $noct = $_POST['no_sc']; $jsc = $_POST['jsc']; $tgl_sc = $_POST['tgl_sc']; $kd_pb = $_POST['kd_pb']; // $jur = $_POST['jur']; $sem_mul = $_POST['sem_mulai']; $thn_mul = $_POST['thn_mulai']; $sem_sel = $_POST['sem_sel']; $thn_sel = $_POST['thn_sel']; $bln_stop = $_POST['bln_stop']; $thn_stop = $_POST['thn_stop']; $bln_go = $_POST['bln_go']; $thn_go = $_POST['thn_go']; $data = $noct . " " . $jsc . " " . $tgl_sc . " " . $kd_pb . " " . $jur . " " . $sem_mul . " " . $sem_sel . " " . $thn_mul . " " . $thn_sel . " " . $bln_stop . " " . $bln_go . " " . $thn_stop . " " . $thn_go . " " . $_FILES['fupload']['name']; // echo $data; $pb = new Penerima($this->registry); $pb->set_kd_pb($kd_pb); $d_pb = $pb->get_penerima_by_id($pb); // $upload = $this->registry->upload; $cname = array('CUTI', $d_pb->get_nip(), $thn_mul); $this->registry->upload->init('fupload'); $this->registry->upload->setDirTo('files/cuti/'); $this->registry->upload->changeFileName($this->registry->upload->getFileName(), $cname); $file = $this->registry->upload->getFileTo(); // echo $file; $ct->set_no_surat_cuti($noct); $ct->set_jenis_cuti($jsc); $ct->set_tgl_surat_cuti(Tanggal::ubahFormatTanggal($tgl_sc)); $ct->set_pb($kd_pb); $ct->set_prd_mulai($sem_mul . " " . $thn_mul); $ct->set_prd_selesai($sem_sel . " " . $thn_sel); $ct->set_perk_stop($bln_stop . " " . $thn_stop); $ct->set_perk_go($bln_go . " " . $thn_go); $ct->set_file($file); if ($ct->add_cuti()) { // $pb->set_kd_pb($kd); $d_pb->set_status(4); $d_pb->update_penerima(); $this->registry->upload->uploadFile(); $ref = " no SC " . $noct; ClassLog::write_log('cuti', 'rekam', $ref); header('location:' . URL . 'cuti/datasc'); } else { $this->view->d_rekam = $ct; } } if ($id != 0) { $ct->set_kode_cuti($id); $this->view->d_ubah = $ct->get_cuti_by_id($ct, $this->kd_user); // var_dump($this->view->d_ubah); $pb = new Penerima($this->registry); $pb->set_kd_pb($ct->get_pb()); $this->view->d_pb_ubah = $pb->get_penerima_by_id($pb, $this->kd_user); $is_exist_file = $this->view->d_ubah->get_file() != NULL && $this->view->d_ubah->get_file() != '' ? true : false; $file = array('file_exist' => $is_exist_file); } else { $file = array('file_exist' => false); } $jsc = new JenisSuratCuti($this->registry); $univ = new Universitas($this->registry); $st = new SuratTugas($this->registry); $pb = new Penerima($this->registry); if (Session::get('role') == 2) { $this->view->d_pb = $pb->get_penerima($this->kd_user); $this->view->d_ct_all = $ct->get_cuti($this->kd_user); $this->view->d_univ = $univ->get_univ($this->kd_user); } else { $this->view->d_pb = $pb->get_penerima(0); $this->view->d_ct_all = $ct->get_cuti(0); $this->view->d_univ = $univ->get_univ(); } $this->view->d_jsc = $jsc->get_jsc(); $this->view->d_th_masuk = $st->get_list_th_masuk(); $this->view->curr_year = date('Y'); $this->view->d_file_exist = json_encode($file); /**start paging**/ $url = ''; if ($id == 0) { $url = 'cuti/datasc/0'; } else { $url = 'cuti/datasc/' . $id; } $this->view->url = $url; $this->view->paging = new Paging($url, $batas, $halaman); $this->view->jmlData = count($this->view->d_ct_all); $posisi = $this->view->paging->cari_posisi(); if (Session::get('role') == 2) { $this->view->d_ct = $ct->get_cuti_limit($posisi, $batas, $this->kd_user); } else { $this->view->d_ct = $ct->get_cuti_limit($posisi, $batas, 0); } /**end paging**/ $this->view->render('riwayat_tb/data_cuti'); }