ceklog(); $this->load->library('pdf_transkrip'); $this->load->library('rhrpt'); $this->load->library('rhlib'); } function ceklog() { $user = $this->session->userdata("user_id1unla"); if($user==""){ redirect('user/login'); } } function get_bilangan($num){ return $this->rhlib->get_bilangan($num); } function get_par_val($table,$fieldName,$condition){ return $this->rhlib->get_par_val($table,$fieldName,$condition); } function get_row_pars($table,$fields,$condition){ return $this->rhlib->get_row_pars($table,$fields,$condition); } function squery($query){ $KEDUA= $this->load->database('second', TRUE); $query = $KEDUA->query($query); $row= ''; if ($query->num_rows() != 0) { $row = $query->row(); } return $row; } function nm_field2($column,$tbl,$whereb, $wherea){ $KEDUA= $this->load->database('second', TRUE); $q = "SELECT ".$column." as nm FROM ".$tbl." where ".$whereb." = '".$wherea."' " ; $query = $KEDUA->query($q); $nm= ''; if ($query->num_rows() != 0) { $row = $query->row(); $nm=$row->nm; } return $nm; } function nm_field2cond($column,$tbl,$whereb, $wherea, $whered, $wherec){ $KEDUA= $this->load->database('second', TRUE); $q = "SELECT ".$column." as nm FROM ".$tbl." where ".$whereb." = '".$wherea."' AND ".$whered." = '".$wherec."'" ; $query = $KEDUA->query($q); $nm= ''; if ($query->num_rows() != 0) { $row = $query->row(); $nm=$row->nm; } return $nm; } function TanggalIndo($date){ $BulanIndo = array("Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"); $tahun = substr($date, 0, 4); $bulan = substr($date, 4, 2); $tgl = substr($date, 6, 2); $result =$tgl . " " . $BulanIndo[(int)$bulan-1] . " ". $tahun; return($result); } function set_hari($tanggal){ $namahari = date('l', strtotime($tanggal)); if ($namahari == "Sunday") $namahari = "Minggu"; else if ($namahari == "Monday") $namahari = "Senin"; else if ($namahari == "Tuesday") $namahari = "Selasa"; else if ($namahari == "Wednesday") $namahari = "Rabu"; else if ($namahari == "Thursday") $namahari = "Kamis"; else if ($namahari == "Friday") $namahari = "Jumat"; else if ($namahari == "Saturday") $namahari = "Sabtu"; else $namahari = ''; return $namahari; } function getmahasiswa($wherex=''){ $KEDUA= $this->load->database('second', TRUE); $KEDUA->select("*"); $KEDUA->from("vv_mahasiswa_profile2"); if($wherex !=''){ $KEDUA->where('nim',$wherex); } $q = $KEDUA->get(); $result = array(); if ($q->num_rows() > 0) { $result = $q->result(); } return $result; } function getprodi($wherex=''){ $KEDUA= $this->load->database('second', TRUE); $KEDUA->select("*"); $KEDUA->from("v_prodi"); if($wherex !=''){ $KEDUA->where('kdprodi',$wherex); } $q = $KEDUA->get(); $result = array(); if ($q->num_rows() > 0) { $result = $q->result(); } return $result; } function getvnilaiall($nim,$kdprodi,$tahunmsk,$limit,$start){ $KEDUA= $this->load->database('second', TRUE); $q = $KEDUA->query("SELECT `nilai`.`kdprodi` AS `kdprodi` , `nilai`.`kdmk` AS `kdmk` , `matakuliah`.`nmmkind` AS `nmmkind` , `matakuliah`.`nmmkeng` AS `nmmkeng` , ifnull((SELECT max(`nilai`.`nilaihuruf`) AS `nilaihuruf` FROM `nilai` WHERE ((`nilai`.`nim` = '".$nim."') AND (`nilai`.`kdprodi` = `kurikulum`.`kdprodi`) AND (`nilai`.`kdmk` = `kurikulum`.`kdmk`))), '-') AS `nilaihuruf` , ifnull((SELECT max(`nilai`.`bobotnilai`) AS `bobotnilai` FROM `nilai` WHERE ((`nilai`.`nim` = '".$nim."') AND (`nilai`.`kdprodi` = `kurikulum`.`kdprodi`) AND (`nilai`.`kdmk` = `kurikulum`.`kdmk`))), 0) AS `bobotnilai` , `kurikulum`.`jmlsks` AS `jmlsks` , ifnull(((SELECT max(`nilai`.`bobotnilai`) AS `bobotnilai` FROM `nilai` WHERE ((`nilai`.`nim` = '".$nim."') AND (`nilai`.`kdprodi` = `kurikulum`.`kdprodi`) AND (`nilai`.`kdmk` = `kurikulum`.`kdmk`))) * `kurikulum`.`jmlsks`), 0) AS `mutu` FROM ((`nilai` JOIN `matakuliah` ON (((`nilai`.`kdprodi` = `matakuliah`.`kdprodi`) AND (`nilai`.`kdmk` = `matakuliah`.`kdmk`)))) JOIN `kurikulum` ON (((`kurikulum`.`kdprodi` = `nilai`.`kdprodi`) AND (`kurikulum`.`kdmk` = `nilai`.`kdmk`)))) WHERE ((`nilai`.`kdprodi` = '".$kdprodi."') AND (`nilai`.`nim` = '".$nim."') AND (`kurikulum`.thnmasuk ='".$tahunmsk."') AND ((`nilai`.`idstsetuju` = '1') OR isnull(`nilai`.`idstsetuju`))) GROUP BY `nilai`.`kdmk` ORDER BY `nilai`.`kdstsemester` , `nilai`.`kdmk` LIMIT ".$start.", ".$limit.""); $result = array(); if ($q->num_rows() > 0) { $result = $q->result(); } return $result; } function cekjumlahvnilaiall($nim,$kdprodi,$tahunmsk){ $KEDUA= $this->load->database('second', TRUE); $q = $KEDUA->query("SELECT `nilai`.`kdprodi` AS `kdprodi` , `nilai`.`kdmk` AS `kdmk` , `matakuliah`.`nmmkind` AS `nmmkind` , `matakuliah`.`nmmkeng` AS `nmmkeng` , ifnull((SELECT max(`nilai`.`nilaihuruf`) AS `nilaihuruf` FROM `nilai` WHERE ((`nilai`.`nim` = '".$nim."') AND (`nilai`.`kdprodi` = `kurikulum`.`kdprodi`) AND (`nilai`.`kdmk` = `kurikulum`.`kdmk`))), '-') AS `nilaihuruf` , ifnull((SELECT max(`nilai`.`bobotnilai`) AS `bobotnilai` FROM `nilai` WHERE ((`nilai`.`nim` = '".$nim."') AND (`nilai`.`kdprodi` = `kurikulum`.`kdprodi`) AND (`nilai`.`kdmk` = `kurikulum`.`kdmk`))), 0) AS `bobotnilai` , `kurikulum`.`jmlsks` AS `jmlsks` , ifnull(((SELECT max(`nilai`.`bobotnilai`) AS `bobotnilai` FROM `nilai` WHERE ((`nilai`.`nim` = '".$nim."') AND (`nilai`.`kdprodi` = `kurikulum`.`kdprodi`) AND (`nilai`.`kdmk` = `kurikulum`.`kdmk`))) * `kurikulum`.`jmlsks`), 0) AS `mutu` FROM ((`nilai` JOIN `matakuliah` ON (((`nilai`.`kdprodi` = `matakuliah`.`kdprodi`) AND (`nilai`.`kdmk` = `matakuliah`.`kdmk`)))) JOIN `kurikulum` ON (((`kurikulum`.`kdprodi` = `nilai`.`kdprodi`) AND (`kurikulum`.`kdmk` = `nilai`.`kdmk`)))) WHERE ((`nilai`.`kdprodi` = '".$kdprodi."') AND (`nilai`.`nim` = '".$nim."') AND (`kurikulum`.thnmasuk ='".$tahunmsk."') AND ((`nilai`.`idstsetuju` = '1') OR isnull(`nilai`.`idstsetuju`))) GROUP BY `nilai`.`kdmk` ORDER BY `nilai`.`kdstsemester` , `nilai`.`kdmk`"); $result = 0; if ($q->num_rows() > 0) { $result = $q->num_rows(); } else { $result = 0; } return $result; } function get_rows($nim,$kdprodi,$tahunmsk){ $numrows = $this->cekjumlahvnilaiall($nim,$kdprodi,$tahunmsk); // jumlah baris $batas = 35; // batas record per tabel $jmlsks = 0; $jmlskskali = 0; $jmlmutu = 0; $nh = array("A", "B", "C", "D", "E"); if ($numrows <= $batas) { $nilai = $this->getvnilaiall($nim,$kdprodi,$tahunmsk,$batas,0); $tr = ""; $no=0; foreach($nilai as $item) { $no++; $tr .= " $no $item->nmmkind $item->nilaihuruf ".intval($item->bobotnilai)." $item->jmlsks ".intval($item->mutu)." "; $jmlsks = $jmlsks + $item->jmlsks; if ($item->nilaihuruf != "-") {//if (in_array($item->nilaihuruf, $nh)) { $jmlskskali = $jmlskskali + $item->jmlsks; $jmlmutu = $jmlmutu + intval($item->mutu); } } $tbl['data'] = "
$tr
No. Mata Kuliah HM AM sks M
"; } else { $nilai1 = $this->getvnilaiall($nim,$kdprodi,$tahunmsk,$batas,0); $nilai2 = $this->getvnilaiall($nim,$kdprodi,$tahunmsk,$batas,$batas); $tr1 = ""; $tr2 = ""; $no=0; foreach($nilai1 as $item) { $no++; $tr1 .= " $no $item->nmmkind $item->nilaihuruf ".intval($item->bobotnilai)." $item->jmlsks ".intval($item->mutu)." "; $jmlsks = $jmlsks + $item->jmlsks; if ($item->nilaihuruf != "-") {//if (in_array($item->nilaihuruf, $nh)) { $jmlskskali = $jmlskskali + $item->jmlsks; $jmlmutu = $jmlmutu + intval($item->mutu); } } $no=35; foreach($nilai2 as $item) { $no++; $tr2 .= " $no $item->nmmkind $item->nilaihuruf ".intval($item->bobotnilai)." $item->jmlsks ".intval($item->mutu)." "; $jmlsks = $jmlsks + $item->jmlsks; if (in_array($item->nilaihuruf, $nh)) { $jmlskskali = $jmlskskali + $item->jmlsks; $jmlmutu = $jmlmutu + intval($item->mutu); } } $tbl['data'] = "
$tr1
No. Mata Kuliah HM AM sks M
             $tr2
No. Mata Kuliah HM AM sks M
"; } $tbl['data'] .= "
Keterangan: HM: Huruf Mutu, AM: Angka Mutu, sks: satuan kredit semester, M: HM x AM.

"; $tbl['sks'] = $jmlsks; $tbl['ipk'] = $jmlmutu/$jmlskskali; return $tbl; } function get_transkrip($nim,$kdprodi,$tahunmsk,$tglcetak) { $prodinya = $this->getprodi($kdprodi); foreach($prodinya as $itemprodi){ if ($itemprodi->nmstakreditasi) { $akreditasi = strtoupper('Terakreditasi, ').'"'.$itemprodi->kdstakreditasi.'"'; $nosk = 'No. '.$itemprodi->noskakreditasi; $tglsk = 'Tanggal '.$this->TanggalIndo(date("Ymd",strtotime($itemprodi->tglskakreditasi))); } else { $akreditasi = '-'; $nosk = ''; $tglsk = ''; } } $this->pdf_transkrip->SetCreator(PDF_CREATOR); $this->pdf_transkrip->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING); $this->pdf_transkrip->setPrintHeader(false); $this->pdf_transkrip->setPrintFooter(false); // set header and footer fonts $this->pdf_transkrip->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); $this->pdf_transkrip->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $this->pdf_transkrip->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $this->pdf_transkrip->SetMargins('7', '40', '20'); $this->pdf_transkrip->SetHeaderMargin('10'); $this->pdf_transkrip->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $this->pdf_transkrip->SetAutoPageBreak(TRUE, '10'); // set image scale factor $this->pdf_transkrip->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // --------------------------------------------------------- // set font $this->pdf_transkrip->SetFont('helvetica', 'B', 11); $this->pdf_transkrip->SetCellPadding(0); // add a page $this->pdf_transkrip->AddPage(); $mhs = $this->getmahasiswa($nim); foreach($mhs as $item) { $this->pdf_transkrip->Write(0, 'TRANSKRIP AKADEMIK', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->SetFont('helvetica', '', 9); $this->pdf_transkrip->Write(0, 'Nomor: '.$item->notranskrip, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->SetFont('helvetica', '', 11); $this->pdf_transkrip->Write(0, 'Nama Mahasiswa: '.$item->nmmhs, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->SetFont('helvetica', '', 9); $skripsi=$item->jdlskripsiind; $tgllhr = $this->TanggalIndo(date("Ymd",strtotime($item->tgllahir))); $pimpin1=$this->nm_field2('nmpimpinan', 'pimpinan', 'jabatan','1'); $pimpin1gelar=$this->nm_field2('gelar', 'pimpinan', 'jabatan','1'); $pimpin2=$this->nm_field2cond('nmpimpinan', 'pimpinan', 'jabatan','5', 'kdfakultas',$item->kdfakultas); $head = <<
Nomor Pokok Mahasiswa : $item->nim Fakultas : $item->nmfakultas
Tempat, tanggal lahir : $item->tptlahir, $tgllhr Program Studi : $item->nmprodi
Tahun Masuk : $item->thnmasuk Status Program Studi : $akreditasi
Status Awal Mahasiswa : $item->nmstawalmhs $nosk
Jenjang Pendidikan : $item->nmjenjangstudi $tglsk

EOD; } $this->pdf_transkrip->writeHTML($head,true,false,false,false); $rows_mhs = $this->get_rows($nim,$kdprodi,$tahunmsk); $this->pdf_transkrip->writeHTML($rows_mhs['data'],true,false,false,false); $jmlsksall = $rows_mhs['sks']; $ipkall = round($rows_mhs['ipk'],2); $yudisium = $this->squery("select * from setipk where '".$ipkall."' between ipkdari and ipksampai"); if ($yudisium) { $yudisium = $yudisium->keterangan; } else { $yudisium = null; } $foot = <<
Jumlah sks : $jmlsksall Judul Tugas Akhir :
IPK : $ipkall $skripsi
Yudisium : $yudisium



EOD; $this->pdf_transkrip->writeHTML($foot,true,false,false,false); $photo = "





Dekan,




".$pimpin2."








FOTO 4 X 6







Bandung, ".$this->TanggalIndo(date("Ymd",strtotime($tglcetak)))."
Rektor,




".$pimpin1."
".$pimpin1gelar."
"; $this->pdf_transkrip->writeHTML($photo,true,false,false,false); $this->pdf_transkrip->Output('transkrip'.$nim.'.pdf', 'I'); } }