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_data($semester,$jns_kelas,$kdprodi,$persen1,$kondisi1,$persen2,$kondisi2){
$persen1 = (isset($persen1)) ? intval($persen1):null;
$persen2 = (isset($persen2)) ? intval($persen2):null;
$KEDUA= $this->load->database('second', TRUE);
$query = $KEDUA->query("CALL sp_getDppDet (?,?,?,?,?,?,?)",array($kdprodi,$jns_kelas,$semester,$persen1,$kondisi1,$persen2,$kondisi2));
$result = array();
if ($query->num_rows() > 0) {
$result = $query->result();
}
return $result;
}
function get_rows_detdpp($semester,$jns_kelas,$kdprodi,$persen1,$kondisi1,$persen2,$kondisi2){
// data table
$data = $this->get_data($semester,$jns_kelas,$kdprodi,$persen1,$kondisi1,$persen2,$kondisi2);
$count = 0;
$count1 = 0;
$no = 1;
$total = 0;
$t_mhs = 0;
$t_blm = 0;
$t_tagih = 0;
$tot_tagih = 0;
$t_bayar = 0;
$tot_bayar = 0;
$t_sisa = 0;
$tot_sisa = 0;
$t_diskon = 0;
$tot_diskon = 0;
$rows = "";
foreach($data as $item)
{
$stlunas = $item->stlunas;
$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 , ',' , '.' );
if ($stlunas == 'Lunas'){
$count = 1;
$t_mhs += $count;
}
if ($stlunas == 'Belum Lunas'){
$count1 = 1;
$t_blm += $count1;
}
$rows .= "
".$no.". |
".$item->nim." |
".$item->nmmhs." |
".$item->thnmasuk." |
".$item->stawlmhs." |
".$item->stmahasiswa." |
".$item->nmcutidet." |
".$item->nmklsmhs." |
".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 , ',' , '.' )." % |
".$item->stlunas." |
".number_format($item->diskon , 2 , ',' , '.' )." |
";
$no++;
}
$rows .= "
TOTAL LUNAS : $t_mhs org |
TOTAL BELUM LUNAS : $t_blm org |
|
TOTAL (Rp.) : |
$tot_tagih |
$tot_bayar |
|
$tot_sisa |
|
|
$tot_diskon |
";
return $rows;
}
function get_det_dpp($semester,$jns_kelas,$kdprodi,$persen1,$kondisi1,$persen2,$kondisi2,$opt){
$thnakademikpar = substr($semestershow,0,4);
$semesterpar = substr($semestershow,5,15);
$row_semester = $this->get_row_pars("v_tahunakademik","kdthnakademik,nmthnakademik","kdstsemester='$semester'");
$row_jnskelas = ($jns_kelas == 4) ? 'SEMUA':$this->get_row_pars("klsmhs","concat(kdklsmhs, '-', nmklsmhs) AS nmjnskls","idklsmhs='$jns_kelas'");
$row_prodi = $this->get_row_pars("prodi","nmprodi","kdprodi='$kdprodi'");
$tahun = $row_semester->nmthnakademik;
$kelas = ($jns_kelas == 4) ? 'SEMUA':$row_jnskelas->nmjnskls;
$prodi = $row_prodi->nmprodi;
//descrip kondisi1
if ($kondisi1==1) {
$kondisi1 = '=';
} else if ($kondisi1==2) {
$kondisi1 = '<>';
} else if ($kondisi1==3) {
$kondisi1 = '>';
} else if ($kondisi1==4) {
$kondisi1 = '>=';
} else if ($kondisi1==5) {
$kondisi1 = '<';
} else if ($kondisi1==6) {
$kondisi1 = '<=';
}
//descrip kondisi2
if ($kondisi2==1) {
$kondisi2 = '=';
} else if ($kondisi2==2) {
$kondisi2 = '<>';
} else if ($kondisi2==3) {
$kondisi2 = '>';
} else if ($kondisi2==4) {
$kondisi2 = '>=';
} else if ($kondisi2==5) {
$kondisi2 = '<';
} else if ($kondisi2==6) {
$kondisi2 = '<=';
}
$optfull = $kondisi1.' '.$persen1.'% '.$opt.' '.$kondisi2.' '.$persen2.'%';
$optpart = $kondisi1.' '.$persen1.'%';
$opt = (!$kondisi2) ? $optpart:$optfull;
$this->pdf_dpp->SetCreator(PDF_CREATOR);
$datahead['code'] = 'LAP-DPP-DETAIL';
$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', '34', '20');
$this->pdf_dpp->SetHeaderMargin('10');
$this->pdf_dpp->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$this->pdf_dpp->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// 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', 8);
$this->pdf_dpp->SetCellPadding(0);
// add a page
$this->pdf_dpp->AddPage('L','F4');
$this->pdf_dpp->Write(0, 'LAPORAN DETAIL KEUANGAN DPP', '', 0, 'C', true, 0, false, false, 0);
$this->pdf_dpp->Write(0, 'TAHUN AKADEMIK '.$semestershow, '', 0, 'C', true, 0, false, false, 0);
$this->pdf_dpp->Write(0, 'JENIS KELAS '.strtoupper($kelas), '', 0, 'C', true, 0, false, false, 0);
$this->pdf_dpp->Write(0, 'PROGRAM STUDI '.$prodi, '', 0, 'C', true, 0, false, false, 0);
$this->pdf_dpp->Write(0, 'TAHAPAN % BAYAR '.$opt, '', 0, 'C', true, 0, false, false, 0);
//$this->pdf_dpp->Cell(0,12,'',0,1,'L'); // untuk memberi space
$this->pdf_dpp->SetFont('helvetica', 'B', 9);
$rows_get_dpp = $this->get_rows_detdpp($semester,$jns_kelas,$kdprodi,$persen1,$kondisi1,$persen2,$kondisi2);
$tbl = <<
NO. |
NPM |
Nama Mahasiswa |
Tahun Masuk |
Status Masuk |
Status Mahasiswa |
Catatan Mahasiswa |
Kelas |
Biaya Tagihan |
Bayar |
% Bayar |
Tunggakan |
% Tunggakan |
Status Bayar |
Diskon |
$rows_get_dpp
EOD;
$this->pdf_dpp->writeHTML($tbl,true,false,false,false);
$this->pdf_dpp->Output('rpt_det_dpp.pdf', 'I');
}
}
?>