ceklog(); $this->load->library('pdf_dpk'); $this->load->library('rhrpt'); $this->load->library('rhlib'); #start check auth $authorizationHeader['Authorization'] = str_replace('Bearer ', '', $_SERVER['HTTP_AUTHORIZATION']); $login = @$this->my_usessionpublic->logged_in ? : false; if ($authorizationHeader['Authorization'] && $login) { if(strpos($_SERVER['HTTP_AUTHORIZATION'], 'Bearer ') !== 0){ $cek['status'] = false; $cek['message'] = "Wrong number of segments"; $this->my_usessionpublic->set_userdata('pesan', $cek['message']); echo json_encode($cek); redirect('index.php/user/ext_logout'); die; } } else { $cek['status'] = false; $cek['message'] = "Please try login again."; $this->my_usessionpublic->set_userdata('pesan', $cek['message']); echo json_encode($cek); redirect('index.php/user/ext_logout'); die; } $cek = check_auth($authorizationHeader, $login); if(isset($cek['status']) && $cek['status'] == true){ // continue; } else{ $this->my_usessionpublic->set_userdata('pesan', $cek['message']); echo json_encode($cek); redirect('index.php/user/ext_logout'); die; } #end check auth } 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,$jenis_kelas){ $KEDUA= $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_GetDpkAllProdi (?,?)",array($thnmasuk,$jenis_kelas)); $result = array(); if ($query->num_rows() > 0) { $result = $query->result(); } return $result; } function get_rows($thnmasuk,$jenis_kelas){ $data = $this->get_data($thnmasuk,$jenis_kelas); $rows = ""; $fakultas=''; $kdfakultas=''; $t_tagih = 0; $tot_tagih = 0; $t_bayar = 0; $tot_bayar = 0; $t_sisa = 0; $tot_sisa = 0; $t_diskon = 0; $tot_diskon = 0; $t_sukarela = 0; $tot_sukarela = 0; foreach($data as $item) { $t_tagih += $item->biaya; $tot_tagih = number_format($t_tagih , 2 , ',' , '.' ); $t_bayar += $item->jmlbayar; $tot_bayar = number_format($t_bayar , 2 , ',' , '.' ); $t_sisa += $item->sisa; $tot_sisa = number_format($t_sisa , 2 , ',' , '.' ); $t_diskon += $item->diskon; $tot_diskon = number_format($t_diskon , 2 , ',' , '.' ); $t_sukarela += $item->sukarela; $tot_sukarela = number_format($t_sukarela , 2 , ',' , '.' ); if($item->kdfakultas == $kdfakultas){ $rows .= "    ".$item->lnmprodi."    ".number_format($item->biaya , 2 , ',' , '.' )."    ".number_format($item->jmlbayar , 2 , ',' , '.' )."    ".number_format($item->persenbayar, 0 , ',' , '.' )." %    ".number_format($item->sisa , 2 , ',' , '.' )."    ".number_format($item->persensisa, 0 , ',' , '.' )." %    ".number_format($item->diskon , 2 , ',' , '.' )."    ".number_format($item->sukarela , 2 , ',' , '.' )." "; } else { $kdfakultas = $item->kdfakultas; $fakultas = $item->fakultas; $rows .= " $fakultas    ".$item->lnmprodi."    ".number_format($item->biaya , 2 , ',' , '.' )."    ".number_format($item->jmlbayar , 2 , ',' , '.' )."    ".number_format($item->persenbayar, 0 , ',' , '.' )." %    ".number_format($item->sisa , 2 , ',' , '.' )."    ".number_format($item->persensisa, 0 , ',' , '.' )." %    ".number_format($item->diskon , 2 , ',' , '.' )."    ".number_format($item->sukarela , 2 , ',' , '.' )." "; } } $rows .= " TOTAL (Rp.) : $tot_tagih $tot_bayar $tot_sisa $tot_diskon $tot_sukarela "; return $rows; } function get_dpk($thnmasuk,$jenis_kelas){ $row_tahun = $this->get_row_pars("tahun","tahun","tahun='$thnmasuk'"); $row_jnskelas = ($jenis_kelas == 4) ? 'SEMUA':$this->get_row_pars("klsmhs","concat(kdklsmhs, '-', nmklsmhs) AS nmjnskls","idklsmhs='$jenis_kelas'"); $tahun = $row_tahun->tahun; $jns_kelas = ($jenis_kelas == 4) ? 'SEMUA':$row_jnskelas->nmjnskls; $this->pdf_dpk->SetCreator(PDF_CREATOR); $datahead['code'] = 'LAP-DPK-HEAD'; $this->pdf_dpk->addHeaderParams($datahead); //$image_file = base_url().'resources/img/report.png'; // 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', '40', '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', 11); $this->pdf_dpk->SetCellPadding(0); // add a page $this->pdf_dpk->AddPage('L','F4'); $this->pdf_dpk->Write(0, 'LAPORAN KEUANGAN DPK PER FAKULTAS/ PROGRAM STUDI', '', 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 '.strtoupper($jns_kelas), '', 0, 'C', true, 0, false, false, 0); //$this->pdf_dpk->Cell(0,10,'',0,1,'L'); // untuk memberi space $this->pdf_dpk->SetFont('helvetica', 'B', 12); $rows_dpk = $this->get_rows($thnmasuk,$jenis_kelas); $tbl = <<
$rows_dpk
Fakultas / Program Studi Biaya Tagihan Bayar % Bayar Tunggakan % Tunggakan Diskon Sukarela

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