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');
 }