ceklog(); $this->load->library('pdf_dpp'); $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 get_all_mhs_dpp($kdstsemester,$idklsmhs) { $KEDUA= $this->load->database('second', TRUE); $data = $KEDUA->query("SELECT s.nim , p.kdprodi , cast(ifnull(ifnull(ks.jmlbayar, 0) * 100 / (ifnull(sb.biaya, 0) - ifnull(ds.diskon, 0)), 0) AS UNSIGNED) AS persenbayar FROM prodi p LEFT JOIN fakultas f ON p.kdfakultas = f.kdfakultas LEFT JOIN ( SELECT kdkodtbkod AS kdjenjangstudi , nmkodtbkod AS nmjenjangstudi FROM tbkod WHERE kdapltbkod = 4) jnj ON p.kdjenjangstudi = jnj.kdjenjangstudi LEFT JOIN mahasiswa m ON m.kdprodi = p.kdprodi JOIN stmhssemester s ON s.nim = m.nim AND s.kdstsemester = '$kdstsemester' LEFT JOIN ( SELECT idklsmhs , idjnskls FROM klsmhs WHERE CASE WHEN '$idklsmhs' = 4 THEN idklsmhs <> '$idklsmhs' WHEN '$idklsmhs' <> 4 THEN idklsmhs = '$idklsmhs' END) kls ON kls.idklsmhs = m.idklsmhs LEFT JOIN setbiaya sb ON sb.kdprodi = m.kdprodi AND sb.tahunmsk = m.thnmasuk AND sb.idjnskls = kls.idjnskls AND sb.idjnsbiaya = 1 AND sb.kdstsemester = '$kdstsemester' AND sb.idstatus = 1 LEFT JOIN diskonmhs ds ON ds.nim = s.nim AND ds.idsetbiaya = sb.idsetbiaya AND ds.kdstsemester = '$kdstsemester' LEFT JOIN ( SELECT k.nim , k.kdstsemester , k.idstkuitansi , k.idjnsbiaya , sum(k.jmlbayar) AS jmlbayar FROM kuitansi k WHERE k.idstkuitansi = 1 AND k.kdstsemester = '$kdstsemester' GROUP BY k.nim , k.idjnsbiaya ) ks ON ks.nim = s.nim AND ks.idjnsbiaya = sb.idjnsbiaya ORDER BY p.kdfakultas , p.nourutprodi; ")->result(); return $data; } function get_rows($kdstsemester,$idklsmhs){ $all_mhs_dpp = $this->get_all_mhs_dpp($kdstsemester,$idklsmhs); $KEDUA= $this->load->database('second', TRUE); $data = $KEDUA->query("SELECT v_prodi.kdfakultas AS kdfakultas , v_prodi.nmfakultas AS nmfakultas , v_prodi.kdprodi AS kdprodi , v_prodi.nmprodi AS nmprodi , v_prodi.nmjenjangstudi AS nmjenjangstudi , v_prodi.nourutprodi AS nourutprodi , (SELECT count(k.nim) AS cnim FROM kuitansi k LEFT JOIN mahasiswa m ON k.nim = m.nim WHERE CASE WHEN ('$idklsmhs' <> '4') THEN k.idjnsbiaya=6 AND m.kdprodi=v_prodi.kdprodi AND k.kdstsemester='$kdstsemester' AND m.idklsmhs = '$idklsmhs' WHEN ('$idklsmhs' = '4') THEN k.idjnsbiaya=6 AND m.kdprodi=v_prodi.kdprodi AND k.kdstsemester='$kdstsemester' END) AS dp9 FROM v_prodi WHERE v_prodi.nmjenjangstudi <> 'S-2' ORDER BY v_prodi.kdfakultas")->result(); $no=0; $p0=0; $p1to49=0; $p50=0; $p51to79=0; $p80=0; $p81to99=0; $p100=0; $persent=0; $dp9=0; $total=0; $tp0=0; $tp1to49=0; $tp50=0; $tp51to79=0; $tp80=0; $tp81to99=0; $tp100=0; $tpersent=0; $tdp9=0; $ttotal=0; $rows = ""; foreach($data as $row) { $no = $no + 1; foreach($all_mhs_dpp as $rowx) { if ($rowx->kdprodi == $row->kdprodi && $rowx->persenbayar == 0) { $p0 = $p0 + 1; } if ($rowx->kdprodi == $row->kdprodi && ($rowx->persenbayar >= 1 && $rowx->persenbayar <= 49)) { $p1to49 = $p1to49 + 1; } if ($rowx->kdprodi == $row->kdprodi && $rowx->persenbayar == 50) { $p50 = $p50 + 1; } if ($rowx->kdprodi == $row->kdprodi && ($rowx->persenbayar >= 51 && $rowx->persenbayar <= 79)) { $p51to79 = $p51to79 + 1; } if ($rowx->kdprodi == $row->kdprodi && $rowx->persenbayar == 80) { $p80 = $p80 + 1; } if ($rowx->kdprodi == $row->kdprodi && ($rowx->persenbayar >= 81 && $rowx->persenbayar <= 99)) { $p81to99 = $p81to99 + 1; } if ($rowx->kdprodi == $row->kdprodi && $rowx->persenbayar == 100) { $p100 = $p100 + 1; } } $persent = $p100 * 100 / ($p0 + $p1to49 + $p50 + $p51to79 + $p80 + $p81to99 + $p100); $dp9=$dp9 + $row->dp9; $total = $p0 + $p1to49 + $p50 + $p51to79 + $p80 + $p81to99 + $p100; $rows .= " ".$row->kdprodi." ".$row->nmprodi." ".$p0." ".$p1to49." ".$p50." ".$p51to79." ".$p80." ".$p81to99." ".$p100." ".round($persent,2)." % ".$row->dp9." ".$total." "; $tp0=$tp0 + $p0; $tp1to49=$tp1to49 + $p1to49; $tp50=$tp50 + $p50; $tp51to79=$tp51to79 + $p51to79; $tp80=$tp80 + $p80; $tp81to99=$tp81to99 + $p81to99; $tp100=$tp100 + $p100; $tpersent=$tpersent + $persent; $tdp9=$tdp9 + $dp9; $ttotal=$ttotal + $total; $p0=0; $p1to49=0; $p50=0; $p51to79=0; $p80=0; $p81to99=0; $p100=0; $persent=0; $dp9=0; $total=0; } $rows .= " TOTAL ".$tp0." ".$tp1to49." ".$tp50." ".$tp51to79." ".$tp80." ".$tp81to99." ".$tp100." ".round($tpersent/$no,2)." % ".$tdp9." ".$ttotal." "; return $rows; } function get_dpp_perpersentase($kdstsemester,$idklsmhs,$semestershow){ $thnakademikpar = substr($semestershow,0,4); $semesterpar = substr($semestershow,5,15); $row_semester = $this->get_row_pars("v_tahunakademik","kdthnakademik,nmthnakademik","kdstsemester='$semester'"); $row_jnskelas = ($idklsmhs == 4) ? 'SEMUA':$this->get_row_pars("klsmhs","concat(kdklsmhs, '-', nmklsmhs) AS nmjnskls","idklsmhs='$jenis_kelas'"); $tahun = $row_semester->kdthnakademik; $jns_kelas = ($idklsmhs == 4) ? 'SEMUA':$row_jnskelas->nmjnskls; $hari = array("Minggu","Senin","Selasa","Rabu","Kamis","Jum'at","Sabtu"); $bulan = array("","Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"); $tgl = date("j")." ".$bulan[date("n")]." ".date("Y"); $this->pdf_dpp->SetCreator(PDF_CREATOR); $datahead['code'] = 'LAP-DPP-% BAYAR'; $this->pdf_dpp->addHeaderParams($datahead); // set default header data $this->pdf_dpp->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING); $this->pdf_dpp->setPrintHeader(true); $this->pdf_dpp->setPrintFooter(false); // set header and footer fonts $this->pdf_dpp->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); $this->pdf_dpp->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $this->pdf_dpp->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $this->pdf_dpp->SetMargins('5', '35', '20'); $this->pdf_dpp->SetHeaderMargin('10'); $this->pdf_dpp->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $this->pdf_dpp->SetAutoPageBreak(TRUE, '10'); // set image scale factor $this->pdf_dpp->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // --------------------------------------------------------- // set font $this->pdf_dpp->SetFont('helvetica', 'B', 11); $this->pdf_dpp->SetCellPadding(0); // add a page $this->pdf_dpp->AddPage('L','F4'); $this->pdf_dpp->Write(0, 'REKAP MAHASISWA TAHUN AKADEMIK '.$thnakademikpar.'/'.$semesterpar, '', 0, 'C', true, 0, false, false, 0); $this->pdf_dpp->Write(0, 'BERDASARKAN PELUNASAN DPP', '', 0, 'C', true, 0, false, false, 0); $this->pdf_dpp->Write(0, 'JENIS KELAS '.$jns_kelas, '', 0, 'C', true, 0, false, false, 0); $this->pdf_dpp->Write(0, '', '', 0, 'C', true, 0, false, false, 0); $this->pdf_dpp->Write(0, $tgl, '', 0, 'R', true, 0, false, false, 0); $this->pdf_dpp->SetFont('helvetica', '', 11); $rows_dpppersen = $this->get_rows($kdstsemester,$idklsmhs); $tbl = <<
$rows_dpppersen
KODE PROGRAM STUDI 0 % 1 % - 49 % 50 % 51 % - 79 % 80 % 81 % - 99 % 100 % % LUNAS OVER SMT TOTAL

EOD; $this->pdf_dpp->writeHTML($tbl,true,false,false,false); $this->pdf_dpp->Output('dpp_perpersentase.pdf', 'I'); } } ?>