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_row_pars2($table,$fields,$condition){ return $this->rhlib->get_row_pars2($table,$fields,$condition); } function squery($query){ $KEDUA= $this->load->database('second', TRUE); $query = $KEDUA->query($query); $row= ''; if ($query->num_rows() != 0) { $data = $query->result(); } return $data; } 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 get_rekapmahasiswa($kdfakultas,$tahunmsk,$smtganjil,$smtgenap) { $row_kdstsemester = $this->get_row_pars2("v_tahunakademik","nmthnakademik","kdstsemester='$smtganjil'"); $smtganjilshow = $row_kdstsemester->nmthnakademik; $row_kdstsemester = $this->get_row_pars2("v_tahunakademik","nmthnakademik","kdstsemester='$smtgenap'"); $smtgenapshow = $row_kdstsemester->nmthnakademik; $row_fakultas = $this->get_row_pars2("fakultas","nmfakultas","kdfakultas='$kdfakultas'"); $fakultas = ($kdfakultas==99) ? "":"FAKULTAS ".$row_fakultas->nmfakultas; $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(true); $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('10', '40', '15'); $this->pdf_transkrip->SetHeaderMargin('20'); $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', 10); $this->pdf_transkrip->SetCellPadding(0); // add a page $this->pdf_transkrip->AddPage('P','A4'); $this->pdf_transkrip->Write(0, '', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'REKAP MAHASISWA PMB '.$fakultas, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'TAHUN MASUK '.$tahunmsk, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'TAHUN AKADEMIK - SEMESTER', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, $smtganjilshow.' DAN '.$smtgenapshow, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, '', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->SetFont('helvetica', '', 8); $kdfakultas = ($kdfakultas==99) ? "":"AND v_prodi.kdfakultas = '".$kdfakultas."'"; $data = $this->squery("SELECT `v_prodi`.`nourutprodi` AS `nourutprodi` , v_prodi.kdprodi , `v_prodi`.`nmprodi` AS `nmprodi` , `v_prodi`.`nmjenjangstudi` AS `nmjenjangstudi` , concat(`v_prodi`.`nourutprodi`, '. ',`v_prodi`.`nmprodi`,' (',`v_prodi`.`nmjenjangstudi`,')') AS lnmprodi , sum(if((mahasiswa.kdstsemester = '$smtganjil'), 1, 0)) AS ganjil , sum(if((mahasiswa.kdstsemester = '$smtgenap'), 1, 0)) AS genap , ifnull(count(mahasiswa.nim),0) as jml FROM v_prodi LEFT JOIN mahasiswa ON mahasiswa.kdprodi = v_prodi.kdprodi WHERE `v_prodi`.`nmjenjangstudi` <> 'S-2' ".$kdfakultas." AND mahasiswa.thnmasuk = '$tahunmsk' GROUP BY `v_prodi`.`nourutprodi` , `v_prodi`.`nmprodi` , `v_prodi`.`nmjenjangstudi`"); $rows = ""; $no = 1; foreach ($data as $item) { $rows .=" ".$no++." ".$item->lnmprodi." ".$item->ganjil." ".$item->genap." ".$item->jml." "; $sumganjil += $item->ganjil; $sumgenap += $item->genap; $sumtotal+= $item->jml; } $rows .=" TOTAL ".$sumganjil." ".$sumgenap." ".$sumtotal." "; $smtganjilfield= $smtganjilshow; $smtgenapfield= $smtgenapshow; $head = <<
$rows
No. Program Studi $smtganjilfield $smtgenapfield Jumlah

EOD; $this->pdf_transkrip->writeHTML($head,true,false,false,false); $this->pdf_transkrip->Output('rekapmahasiswa'.$tahunmsk.'.pdf', 'I'); } function get_daftarrekapmahasiswa($kdprodi,$tahunmsk,$smtganjil,$smtgenap) { $row_kdstsemester = $this->get_row_pars2("v_tahunakademik","nmthnakademik","kdstsemester='$smtganjil'"); $smtganjilshow = $row_kdstsemester->nmthnakademik; $row_kdstsemester = $this->get_row_pars2("v_tahunakademik","nmthnakademik","kdstsemester='$smtgenap'"); $smtgenapshow = $row_kdstsemester->nmthnakademik; $row_prodi = $this->get_row_pars2("prodi","nmprodi","kdprodi='$kdprodi'"); $nmprodi = "PROGRAM STUDI ".$row_prodi->nmprodi; $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(true); $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('10', '40', '15'); $this->pdf_transkrip->SetHeaderMargin('20'); $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', 10); $this->pdf_transkrip->SetCellPadding(0); // add a page $this->pdf_transkrip->AddPage('P','A4'); $this->pdf_transkrip->Write(0, '', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'DAFTAR MAHASISWA PMB '.$nmprodi, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'TAHUN MASUK '.$tahunmsk, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'TAHUN AKADEMIK - SEMESTER', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, $smtganjilshow, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, '', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->SetFont('helvetica', '', 8); $data = $this->squery("select mahasiswa.*,stawalmhs.nmkodtbkod AS nmstawal,staktifmhs.nmkodtbkod AS nmstaktivitas from mahasiswa LEFT JOIN `tbkod` `stawalmhs` ON `mahasiswa`.`kdstawalmhs` = `stawalmhs`.`kdkodtbkod` AND `stawalmhs`.`kdapltbkod` = 6 LEFT JOIN `tbkod` `staktifmhs` ON `mahasiswa`.`kdstaktivitasmhs` = `staktifmhs`.`kdkodtbkod` AND `staktifmhs`.`kdapltbkod` = 5 where kdprodi='$kdprodi' and thnmasuk='$tahunmsk' and kdstsemester='$smtganjil'"); $rows = ""; $no = 1; foreach ($data as $item) { $rows .=" ".$no++." ".$item->nim." ".$item->nmmhs." ".$item->kdjnskelamin." ".$item->thnmasuk." ".$item->nmstawal." ".$item->nmstaktivitas." "; } $head = <<
$rows
No. NPM Nama Mahasiswa (L/P) Tahun Masuk Status Masuk Status Aktivitas Mahasiswa

EOD; $this->pdf_transkrip->writeHTML($head,true,false,false,false); // set font $this->pdf_transkrip->SetFont('helvetica', 'B', 10); $this->pdf_transkrip->SetCellPadding(0); // add a page $this->pdf_transkrip->AddPage('P','A4'); $this->pdf_transkrip->Write(0, '', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'DAFTAR MAHASISWA PMB '.$nmprodi, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'TAHUN MASUK '.$tahunmsk, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, 'TAHUN AKADEMIK - SEMESTER', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, $smtgenapshow, '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->Write(0, '', '', 0, 'C', true, 0, false, false, 0); $this->pdf_transkrip->SetFont('helvetica', '', 8); $data = $this->squery("select mahasiswa.*,stawalmhs.nmkodtbkod AS nmstawal,staktifmhs.nmkodtbkod AS nmstaktivitas from mahasiswa LEFT JOIN `tbkod` `stawalmhs` ON `mahasiswa`.`kdstawalmhs` = `stawalmhs`.`kdkodtbkod` AND `stawalmhs`.`kdapltbkod` = 6 LEFT JOIN `tbkod` `staktifmhs` ON `mahasiswa`.`kdstaktivitasmhs` = `staktifmhs`.`kdkodtbkod` AND `staktifmhs`.`kdapltbkod` = 5 where kdprodi='$kdprodi' and thnmasuk='$tahunmsk' and kdstsemester='$smtgenap'"); $rows = ""; $no = 1; foreach ($data as $item) { $rows .=" ".$no++." ".$item->nim." ".$item->nmmhs." ".$item->kdjnskelamin." ".$item->thnmasuk." ".$item->nmstawal." ".$item->nmstaktivitas." "; } $head = <<
$rows
No. NPM Nama Mahasiswa (L/P) Tahun Masuk Status Masuk Status Aktivitas Mahasiswa

EOD; $this->pdf_transkrip->writeHTML($head,true,false,false,false); $this->pdf_transkrip->Output('daftarmahasiswa'.$tahunmsk.'.pdf', 'I'); } }