ceklog();
$this->load->library('pdf_tgk');
$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_row_pars($table,$fields,$condition){
return $this->rhlib->get_row_pars($table,$fields,$condition);
}
function get_data($jenis_kelas){
$KEDUA= $this->load->database('second', TRUE);
$query = $KEDUA->query("CALL sp_getTunggakanAllProdi (?)",array($jenis_kelas));
$result = array();
if ($query->num_rows() > 0) {
$result = $query->result();
}
return $result;
}
function get_rows($jenis_kelas){
$data = $this->get_data($jenis_kelas);
$rows = "";
$fakultas='';
$kdfakultas='';
foreach($data as $item)
{
if($item->kdfakultas == $kdfakultas){
$rows .= "
".$item->lnmprodi." |
".number_format($item->biaya , 2 , ',' , '.' )." |
".number_format($item->jmlbayar , 2 , ',' , '.' )." |
".number_format($item->persenbayar , 2 , ',' , '.' )." |
".number_format($item->sisa , 2 , ',' , '.' )." |
".number_format($item->persensisa , 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 , 2 , ',' , '.' )." |
".number_format($item->sisa , 2 , ',' , '.' )." |
".number_format($item->persensisa , 2 , ',' , '.' )." |
";
}
}
return $rows;
}
function get_tgk($jenis_kelas){
$row_jnskelas = $this->get_row_pars("jkls","nmjnskls","idjnskls='$jenis_kelas'");
$jns_kelas = $row_jnskelas->nmjnskls;
$this->pdf_tgk->SetCreator(PDF_CREATOR);
//$image_file = base_url().'resources/img/report.png';
// set default header data
$this->pdf_tgk->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING);
$this->pdf_tgk->setPrintHeader(true);
$this->pdf_tgk->setPrintFooter(false);
// set header and footer fonts
$this->pdf_tgk->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10));
$this->pdf_tgk->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$this->pdf_tgk->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$this->pdf_tgk->SetMargins('20', '40', '20');
$this->pdf_tgk->SetHeaderMargin('10');
$this->pdf_tgk->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$this->pdf_tgk->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$this->pdf_tgk->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
// ---------------------------------------------------------
// set font
$this->pdf_tgk->SetFont('helvetica', 'B', 14);
$this->pdf_tgk->SetCellPadding(0);
// add a page
$this->pdf_tgk->AddPage('L','F4');
$this->pdf_tgk->Write(0, 'LAPORAN TUNGGAKAN MAHASISWA', '', 0, 'C', true, 0, false, false, 0);
$this->pdf_tgk->Write(0, 'KELAS '.strtoupper($jns_kelas), '', 0, 'C', true, 0, false, false, 0);
//$this->pdf_tgk->Cell(0,0,'',0,1,'L'); // untuk memberi space
$this->pdf_tgk->SetFont('helvetica', 'B', 12);
$rows_tgk = $this->get_rows($jenis_kelas);
$tbl = <<
Fakultas / Program Studi |
Total Tagihan |
Total Bayar |
% Tot Bayar |
Tunggakan |
% Tunggakan |
$rows_tgk
EOD;
$this->pdf_tgk->writeHTML($tbl,true,false,false,false);
$this->pdf_tgk->Output('rpt_tunggakan_mahasiswa.pdf', 'I');
}
}
?>