ceklog(); $this->load->library('pdf_dpk'); $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_data($thnmasuk,$kdprodi,$idjnskls){ $KEDUA= $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getDpkDet_perangkatan (?,?,?)",array($thnmasuk,$kdprodi,$idjnskls)); $result = array(); if ($query->num_rows() > 0) { $result = $query->result(); } return $result; } function get_rows_detdpk($thnmasuk,$kdprodi,$idklsmhs){ // data table $data = $this->get_data($thnmasuk,$kdprodi,$idklsmhs); $no = 1; $total = 0; $count = 0; $count2 = 0; $t_mhs = 0; $t_mhs_lns = 0; $t_biaya = 0; $tot_biaya = 0; $t_bayar = 0; $tot_bayar = 0; $t_tagih = 0; $tot_tagih = 0; $rows = ""; foreach($data as $item){ $bya = $item->biaya; $stlunas = $item->stlunas; $t_biaya += $item->biaya; $tot_biaya = number_format($t_biaya , 2 , ',' , '.' ); $t_bayar += $item->jmltotal; $tot_bayar = number_format($t_bayar , 2 , ',' , '.' ); $t_tagih += $item->sisa; $tot_tagih = number_format($t_tagih , 2 , ',' , '.' ); if ($stlunas == 'Belum Lunas'){ $count = 1; $t_mhs += $count; } if ($stlunas == 'Lunas'){ $count2 = 1; $t_mhs_lns += $count2; } $rows .= " $no. ".$item->nim." ".$item->nmmhs." ".$item->nmthnakademik." ".$item->nmstawalmhs." ".$item->nmstaktivitasmhs." ".$item->nmklsmhs." ".number_format($item->biaya , 2 , ',' , '.' )." ".number_format($item->smt1 , 2 , ',' , '.' )." ".number_format($item->smt2 , 2 , ',' , '.' )." ".number_format($item->smt3 , 2 , ',' , '.' )." ".number_format($item->smt4 , 2 , ',' , '.' )." ".number_format($item->smt5 , 2 , ',' , '.' )." ".number_format($item->jmltotal , 2 , ',' , '.' )." ".number_format($item->sisa , 2 , ',' , '.' )." ".$item->stlunas." "; $no++; } $rows .= " TOTAL LUNAS : $t_mhs_lns org TOTAL BELUM LUNAS : $t_mhs org TOTAL (Rp.) : $tot_biaya TOTAL (Rp.) : $tot_bayar $tot_tagih   "; return $rows; } function get_dpk_perangkatan($thnmasuk,$kdprodi,$idklsmhs){ $row_tahun = $this->get_row_pars("tahun","tahun","tahun='$thnmasuk'"); $row_jnskelas = ($idklsmhs == 4) ? 'SEMUA':$this->get_row_pars("jkls","nmjnskls","idjnskls='$idklsmhs'"); $row_prodi = $this->get_row_pars("prodi","nmprodi","kdprodi='$kdprodi'"); $tahun = $row_tahun->tahun; $kelas = ($idklsmhs == 4) ? 'SEMUA':$row_jnskelas->nmjnskls; $prodi = $row_prodi->nmprodi; $angkatan_gjl = $thnmasuk.'1'; $angkatan_gnp = $thnmasuk.'2'; $smt1ganjil = $this->get_row_pars("vv_status_semester","*","kdstsemester='$angkatan_gjl'"); $smt1ganjilthn = $smt1ganjil->kdthnakademik; $smt1ganjiljns = $smt1ganjil->nmjnssemester; $smt1genap = $this->get_row_pars("vv_status_semester","*","kdstsemester='$angkatan_gnp'"); $smt1genapjns = $smt1genap->nmjnssemester; $angkatan_plus = intval($thnmasuk)+1; $agktn_gjl = $angkatan_plus.'1'; $agktn_gnp = $angkatan_plus.'2'; $smt2ganjil = $this->get_row_pars("vv_status_semester","*","kdstsemester='$agktn_gjl'"); $smt2ganjilthn = $smt2ganjil->kdthnakademik; $smt2ganjiljns = $smt2ganjil->nmjnssemester; $smt2genap = $this->get_row_pars("vv_status_semester","*","kdstsemester='$agktn_gnp'"); $smt2genapjns = $smt2genap->nmjnssemester; $angkatan_plus_dua = intval($thnmasuk)+2; $agktn_gjl_plus_dua = $angkatan_plus_dua.'1'; $smt3ganjil = $this->get_row_pars("vv_status_semester","*","kdstsemester='$agktn_gjl_plus_dua'"); $smt3ganjilthn = $smt3ganjil->kdthnakademik; $smt3ganjiljns = $smt3ganjil->nmjnssemester; $this->pdf_dpk->SetCreator(PDF_CREATOR); $datahead['code'] = 'LAP-DPK-ANGKATAN'; $this->pdf_dpk->addHeaderParams($datahead); // set default header data $this->pdf_dpk->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING); $this->pdf_dpk->setPrintHeader(true); $this->pdf_dpk->setPrintFooter(false); // set header and footer fonts $this->pdf_dpk->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); $this->pdf_dpk->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $this->pdf_dpk->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $this->pdf_dpk->SetMargins('5', '35', '20'); $this->pdf_dpk->SetHeaderMargin('10'); $this->pdf_dpk->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $this->pdf_dpk->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $this->pdf_dpk->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // --------------------------------------------------------- // set font $this->pdf_dpk->SetFont('helvetica', 'B', 8); $this->pdf_dpk->SetCellPadding(0); // add a page $this->pdf_dpk->AddPage('L','F4'); $this->pdf_dpk->Write(0, 'LAPORAN KEUANGAN DPK', '', 0, 'C', true, 0, false, false, 0); $this->pdf_dpk->Write(0, 'SAMPAI DENGAN '.$smt2ganjilthn.' - '.strtoupper($smt2genapjns).' UNTUK ANGKATAN '.$smt1ganjilthn.' - '.strtoupper($smt1ganjiljns).' DAN '.$smt3ganjilthn.' - '.strtoupper($smt3ganjiljns).' UNTUK ANGKATAN '.$smt1ganjilthn.' - '.strtoupper($smt1genapjns), '', 0, 'C', true, 0, false, false, 0); $this->pdf_dpk->Write(0, 'TAHUN MASUK / ANGKATAN '.$tahun, ' ', 0, 'C', true, 0, false, false, 0); $this->pdf_dpk->Write(0, 'JENIS KELAS '.$kelas, '', 0, 'C', true, 0, false, false, 0); //$this->pdf_dpk->Write(0, 'TAHUN MASUK / ANGKATAN '.$tahun, ' PROGRAM STUDI '.$prodi, '', 0, 'C', true, 0, false, false, 0); $this->pdf_dpk->Write(0, 'PROGRAM STUDI '.$prodi, '', 0, 'C', true, 0, false, false, 0); //$this->pdf_dpk->Cell(0,0,'',0,1,'L'); // untuk memberi space $this->pdf_dpk->SetFont('helvetica', 'B', 8); //$rows_get_dpk = $this->get_rows_detdpk($thnmasuk,$jns_kelas,$kdprodi,$persen); $rows_get_dpk = $this->get_rows_detdpk($thnmasuk,$kdprodi,$idklsmhs,$smt1ganjilthn,$smt1ganjiljns,$smt1genapjns,$smt2ganjilthn,$smt2ganjiljns,$smt2genapjns,$smt3ganjilthn,$smt3ganjiljns); $tbl = <<
$rows_get_dpk
No. NPM Nama Mahasiswa Tahun Masuk Status Masuk Status Mahasiswa Kelas Biaya Tagihan $smt1ganjilthn $smt2ganjilthn $smt3ganjilthn Bayar Tunggakan Status Bayar
$smt1ganjiljns $smt1genapjns $smt2ganjiljns $smt2genapjns $smt3ganjiljns

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