ceklog(); $this->load->library('pdf_dppdpk'); $this->load->library('rhrpt'); $this->load->library('rhlib'); } function ceklog() { $user = $this->session->userdata("user_id1unla"); if($user==""){ redirect('user/login'); } } 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 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($date1,$date2){ $KEDUA= $this->load->database('second', TRUE); $query = $KEDUA->query("SELECT * FROM v_dpp_dpk WHERE date(tglkuitansi) BETWEEN '$date1' AND '$date2';"); $result = array(); if ($query->num_rows() > 0) { $result = $query->result(); } return $result; } function get_data_sum($cara1,$cara2,$cara3,$date1,$date2){ $KEDUA= $this->load->database('second', TRUE); $parameters = array( 'bayar1'=> $cara1, 'bayar2'=> $cara2, 'bayar3'=> $cara3, 'tgl1'=> $date1, 'tgl2'=> $date2, ); $q = "CALL sp_getSumDppDpk(?,?,?,?,?)"; $query = $KEDUA->query($q, $parameters); $result = array(); if ($query->num_rows() > 0) { $result = $query->result(); } return $result; } function get_rows($date1,$date2){ $data = $this->get_data($date1,$date2); $rows = ""; $fakultas=''; $kdfakultas=''; foreach($data as $item) { if($item->kdfakultas == $kdfakultas){ $rows .= " ".$item->nmprodi." ".$item->nokuitansi." ".$item->tglkuitansi." ".$item->nim." ".$item->nmmhs." ".$item->kdjnsbiaya." ".$item->nmcarabyr." ".number_format($item->jmlbayar , 2 , ',' , '.' )." ".$item->catatan." "; } else { $kdfakultas = $item->kdfakultas; $fakultas = $item->nmfakultas; $rows .= " - $fakultas
".$item->nmprodi." ".$item->nokuitansi." ".$item->tglkuitansi." ".$item->nim." ".$item->nmmhs." ".$item->kdjnsbiaya." ".$item->nmcarabyr." ".number_format($item->jmlbayar , 2 , ',' , '.' )." ".$item->catatan." "; } } return $rows; } function get_sum($cara1,$cara2,$cara3,$date1,$date2){ $data = $this->get_data_sum($cara1,$cara2,$cara3,$date1,$date2); $rows = ""; $fakultas=''; $kdfakultas=''; foreach($data as $item) { $sum1=($item->sumcash) ? $item->sumcash:0; $sum2=($item->sumtransfer) ? $item->sumtransfer:0; $sum3=($item->sumviabank) ? $item->sumviabank:0; $sumall=($item->sumall) ? $item->sumall:0; $rows .= " CARA BAYAR Cash/Tunai Rp. ".number_format($sum1 , 2 , ',' , '.' )." Transfer Rp. ".number_format($sum2 , 2 , ',' , '.' )." Via Bank Rp. ".number_format($sum3 , 2 , ',' , '.' )." Total Rp. ".number_format($sumall , 2 , ',' , '.' )." "; } return $rows; } function get_dppdpk($var){ $par = explode("istra", $var); $cara1 = $par[0]; $cara2 = $par[1]; $cara3 = $par[2]; $date1 = $par[3]; $date2 = $par[4]; $this->pdf_dppdpk->SetCreator(PDF_CREATOR); $datahead['code'] = 'LAP-DPP/DPK-KUI'; $this->pdf_dppdpk->addHeaderParams($datahead); // set default header data $this->pdf_dppdpk->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING); $this->pdf_dppdpk->setPrintHeader(true); $this->pdf_dppdpk->setPrintFooter(false); // set header and footer fonts $this->pdf_dppdpk->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); $this->pdf_dppdpk->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $this->pdf_dppdpk->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $this->pdf_dppdpk->SetMargins('20', '40', '20'); $this->pdf_dppdpk->SetHeaderMargin('10'); $this->pdf_dppdpk->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $this->pdf_dppdpk->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $this->pdf_dppdpk->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // --------------------------------------------------------- // set font $this->pdf_dppdpk->SetFont('helvetica', 'B', 14); $this->pdf_dppdpk->SetCellPadding(0); // add a page $this->pdf_dppdpk->AddPage('L','F4'); $this->pdf_dppdpk->Write(0, 'LAPORAN PENERIMAAN DPP/DPK', '', 0, 'C', true, 0, false, false, 0); $this->pdf_dppdpk->Write(0, 'PERIODE '.$this->TanggalIndo(date("Ymd",strtotime($date1))).' s/d '.$this->TanggalIndo(date("Ymd",strtotime($date2))), '', 0, 'C', true, 0, false, false, 0); //$this->pdf_dppdpk->Cell(0,0,'',0,1,'L'); // untuk memberi space $this->pdf_dppdpk->SetFont('helvetica', 'B', 9); $rows_dpp = $this->get_rows($date1,$date2); $sum_dpp = $this->get_sum($cara1,$cara2,$cara3,$date1,$date2); $tbl = <<
$rows_dpp
Fakultas / Program Studi No. Kuitansi Tgl. Kuitansi NPM Nama Mahasiswa Jenis
Biaya
Cara Bayar Nominal Keterangan


SUMMARY

$sum_dpp

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