Example #1
0
 public function cek_pb_konek_st_ct(Penerima $pb, $jenis_cek = 'all', $is_lulus = false, $luaran = false)
 {
     if ($pb->get_kd_pb() == '' || is_null($pb->get_kd_pb())) {
         return false;
     }
     if ($pb->get_st() == '' || is_null($pb->get_st())) {
         $pb = $pb->get_penerima_by_id($pb);
     }
     $kd_st = $pb->get_st();
     $status = $pb->get_status();
     switch ($jenis_cek) {
         case 'all':
             if (!$is_lulus) {
                 //status belum lulus
                 $sts_cuti = $this->cek_pb_konek_st_ct($pb, 'cuti', false);
                 //cek masih cuti?
                 //                    var_dump($sts_cuti);
                 if ($sts_cuti) {
                     $status = $this->cek_pb_konek_st_ct($pb, 'cuti', false, true);
                     if ($luaran) {
                         return $status;
                     }
                     return true;
                 } else {
                     //jika tidak dalam keadaan cuti
                     $status = $this->cek_pb_konek_st_ct($pb, 'st', false, true);
                     return $status;
                 }
             } else {
                 //TO DO cek lebih ke st, tp cek dulu dia dalam keadaancuti apa tidak
                 //klo dalam keadaan cuti ya tidak bisa dong, harus dikembalikan ke cuti
                 $sts_cuti = $this->cek_pb_konek_st_ct($pb, 'cuti', true);
                 if ($sts_cuti) {
                     $status = $this->cek_pb_konek_st_ct($pb, 'cuti', true, true);
                     if ($luaran) {
                         return $status;
                     }
                     return true;
                 } else {
                     $status = $this->cek_pb_konek_st_ct($pb, 'st', true, true);
                     return $status;
                 }
             }
             break;
         case 'cuti':
             $ct = new Cuti($this->registry);
             $d_ct = $ct->get_cuti(Session::get('kd_user'), $pb);
             //TO DO cek apakah masa cuti masih ada
             $exist_data = count($d_ct) > 0;
             if ($exist_data) {
                 if ($luaran) {
                     return 4;
                     //saat cuti tidak boleh lulus
                 } else {
                     return true;
                 }
             } else {
                 if ($is_lulus) {
                     //untuk kode lulus
                     if ($luaran) {
                         $status = $this->cek_pb_konek_st_ct($pb, 'st', true, true);
                         //kode untuk lulus
                         return $status;
                     } else {
                         //TO DO kembalian boolean
                         return true;
                     }
                 } else {
                     //untuk kode belum lulus
                     if ($luaran) {
                         $status = $this->cek_pb_konek_st_ct($pb, 'st', false, true);
                         //kode sebelum lulus
                         return $status;
                     } else {
                         //TO DO kembalian boolean
                         return false;
                     }
                 }
                 if (!$luaran) {
                     return false;
                 }
             }
             break;
         case 'st':
             $st = new SuratTugas($this->registry);
             $st->set_kd_st($kd_st);
             $st = $st->get_surat_tugas_by_id($st);
             $tgl_sel_st = $st->get_tgl_selesai();
             $child = $st->is_child($kd_st);
             //child pertama
             if ($child) {
                 $st_child = new SuratTugas($this->registry);
                 $st_child->set_kd_st($st->get_st_lama());
                 //st parent
                 $st_child = $st_child->get_surat_tugas_by_id($st_child);
                 $second_child = $st_child->is_child($st_child->get_kd_st());
                 if ($second_child) {
                     //jika child kedua
                     if ($is_lulus) {
                         //untuk status lulus
                         if ($pb->get_tgl_lapor() == '' || is_null($pb->get_tgl_lapor())) {
                             $tgl_lapor = date('Y-m-d');
                         } else {
                             $tgl_lapor = $pb->get_tgl_lapor();
                         }
                         $status = $pb->get_status_change_pb($st, $tgl_lapor, $tgl_sel_st);
                     } else {
                         $status = 3;
                     }
                     return $status;
                 } else {
                     if ($is_lulus) {
                         if ($pb->get_tgl_lapor() == '' || is_null($pb->get_tgl_lapor())) {
                             $tgl_lapor = date('Y-m-d');
                         } else {
                             $tgl_lapor = $pb->get_tgl_lapor();
                         }
                         $status = $pb->get_status_change_pb($st, $tgl_lapor, $tgl_sel_st);
                     } else {
                         $status = 2;
                     }
                     return $status;
                 }
             } else {
                 return 1;
             }
             break;
         default:
             throw new Exception();
     }
 }
 public function cetak_profil($id)
 {
     $pb = new Penerima($this->registry);
     //mendapatkan informasi pb
     $st = new SuratTugas($this->registry);
     //mendapatkan informasi surat tugas
     $el = new ElemenBeasiswa($this->registry);
     //mendapatkan pembayaran
     $bank = new Bank($this->registry);
     //mendapatkan nama bank
     $jst = new JenisSuratTugas($this->registry);
     //mendapatkan jenis surat tugas
     $jur = new Jurusan($this->registry);
     $univ = new Universitas($this->registry);
     $nilai = new Nilai($this->registry);
     $cuti = new Cuti($this->registry);
     $mas = new MasalahPenerima($this->registry);
     $pemb = new PemberiBeasiswa();
     $beaya = new Biaya();
     $role = Session::get('role');
     $pb->set_kd_pb($id);
     $this->view->d_pb = $pb->get_penerima_by_id($pb, $this->kd_user);
     if ($role == 3) {
         $this->view->d_pb = $pb->get_penerima_by_id($pb);
     }
     $st->set_kd_st($this->view->d_pb->get_st());
     $this->view->d_st = $st->get_surat_tugas_by_id($st, $this->kd_user);
     if ($role == 3) {
         $this->view->d_st = $st->get_surat_tugas_by_id($st);
     }
     $pemb = $pemb->get_by_id($this->view->d_st->get_pemberi());
     $this->view->d_pemb = $pemb->nama_pemberi;
     $this->view->d_bank = $bank->get_bank_id($this->view->d_pb->get_bank());
     $jur->set_kode_jur($this->view->d_pb->get_jur());
     $this->view->d_jur = $jur->get_jur_by_id($jur);
     $jst->set_kode($this->view->d_st->get_jenis_st());
     $this->view->d_jst = $jst->get_jst_by_id($jst);
     $this->view->d_univ = $univ->get_univ_by_jur($this->view->d_jur->get_kode_jur());
     $this->view->d_nil = $nilai->get_nilai($pb);
     $this->view->d_cur_ipk = $nilai->get_current_ipk($pb);
     $this->view->d_cuti = $cuti->get_cuti($this->kd_user, $pb);
     if ($role == 3) {
         $this->view->d_cuti = $cuti->get_cuti(0, $pb);
     }
     $this->view->d_rwt_beas = $pb->get_penerima_by_column($pb, $this->kd_user, 'nip', true);
     if ($role == 3) {
         $this->view->d_rwt_beas = $pb->get_penerima_by_column($pb, 0, 'nip', true);
     }
     $elem = $el->get_elem_per_pb($pb, false);
     $bea = $beaya->get_cost_per_pb($pb, false);
     $this->view->d_mas = $mas->get_masalah($pb);
     $d_bea = array();
     /*
      * sementara versi dummy dulu ye :p
      */
     foreach ($elem as $v) {
         $d = new BiayaPenerimaBeasiswa();
         $is_jadup = $v->get_kd_r() == 'tunjangan hidup';
         $is_buku = $v->get_kd_r() == 'buku';
         $nama = $v->get_kd_r();
         if ($is_jadup) {
             $nama .= " " . $v->get_bln() . " " . $v->get_thn();
         }
         if ($is_buku) {
             $bulan = Tanggal::bulan_num($v->get_bln());
             $bulan = $bulan == 1 ? 'ganjil' : 'genap';
             $nama .= " semester " . $bulan . " " . $v->get_thn();
         }
         $d->set_nama_biaya($nama);
         $d->set_jumlah_biaya($v->get_total_bayar());
         $d_bea[] = $d;
     }
     foreach ($bea as $v) {
         $d = new BiayaPenerimaBeasiswa();
         $d->set_nama_biaya($v->nama_tagihan);
         $d->set_jumlah_biaya($v->biaya_per_pegawai);
         $d_bea[] = $d;
     }
     $this->view->d_bea = $d_bea;
     $this->view->load('profil/cetak_profil');
 }
Example #3
0
 public function get_cuti_by_id(Cuti $ct, $kd_user)
 {
     $sql = "SELECT * FROM " . $this->t_cuti;
     $sql .= " a LEFT JOIN d_pb b ON a.KD_PB=b.KD_PB";
     $sql .= " 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 ";
     $sql .= " WHERE a.KD_CUTI=" . $ct->get_kode_cuti();
     $sql .= " AND e.KD_USER=" . $kd_user;
     $result = $this->_db->select($sql);
     foreach ($result as $v) {
         $this->set_kode_cuti($v['KD_CUTI']);
         $this->set_jenis_cuti($v['KD_JNS_SRT_CUTI']);
         $this->set_no_surat_cuti($v['NO_CUTI']);
         $this->set_tgl_surat_cuti($v['TGL_CUTI']);
         $this->set_pb($v['KD_PB']);
         $this->set_prd_mulai($v['PRD_MUL_CUTI']);
         $this->set_prd_selesai($v['PRD_SEL_CUTI']);
         $this->set_perk_stop($v['PERK_STOP']);
         $this->set_perk_go($v['PERK_GO']);
         $this->set_file($v['FILE_CUTI']);
     }
     return $this;
 }
 public function cek_exist_nomor()
 {
     $nomor = $_POST['nomor'];
     $nomor = Validasi::remove_space($nomor);
     $sc = new Cuti($this->registry);
     $cek = $sc->cek_exist_nomor($nomor);
     if ($cek) {
         echo 1;
     } else {
         echo 0;
     }
 }