Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "../config.php";
- // pendefinisian folder font pada FPDF
- define('FPDF_FONTPATH', 'FPDF/font/');
- require('FPDF/fpdf.php');
- // seperti sebelunya, kita membuat class anakan dari class FPDF
- class PDF extends FPDF{
- function Header(){
- $this->Image('../FPDF/logi.jpg',5,1,2); // logo
- $this->SetTextColor(0,0,0); // warna tulisan
- $this->SetFont('Arial','B','30'); // font yang digunakan
- // membuat cell dg panjang 19 dan align center 'C'
- $this->Cell(30,1,'SANGGAR TARI TRIMUKTI PARE',0,0,'C');
- $this->Ln();
- $this->SetFont('Arial','B','15');
- $this->Cell(30,1.5,'Jalan Wilis No. 25 Pare Kediri No. Telp: 085 736 629 091',0,0,'C');
- $this->Ln();
- $this->Line(3,3.3,28,3.1);
- $this->SetLineWidth(0.1);
- $this->Line(3,3.4,28,3.2);
- $this->SetLineWidth(0);
- $this->Ln();
- $this->SetFont('Arial','B','12');
- $this->Cell(30,1,'Hasil Penilaian',0,0,'C');
- $this->Ln();
- $this->SetFont('Arial','B','10');
- $this->SetFillColor(192,192,192); // warna isi
- $this->SetTextColor(0,0,0); // warna teks untuk th
- $this->Cell(2);
- $this->Cell(4,1,'Alternatif','TB',0,'C',1); // cell dengan panjang 2
- $q = mysql_query( "SELECT k.*
- FROM detail_nilai d
- INNER JOIN kriteria k ON k.id_krit=d.id_krit
- GROUP BY k.kriteria
- ORDER BY id_krit");
- while ($row=mysql_fetch_array($q)){
- $this->Cell(4,1,$row['kriteria'],'TB',0,'C',1);
- }
- // panjang cell bisa disesuaikan
- $this->Ln();
- }
- function Footer(){
- $this->SetY(-2,5);
- $this->Cell(0,1,$this->PageNo(),0,0,'C');
- }
- }
- $server = "localhost";
- $user = "root";
- $pass = "";
- $data = "wpp";
- $net = new mysqli($server, $user, $pass, $data);
- if($net->connect_error){
- die("Koneksi gagal: ".$net->connect_error);
- }
- $q ="SELECT p.nama from master_nilai m
- INNER JOIN penari p ON p.id_penari=m.id_penari
- ORDER BY m.id_penari";
- $h = $net->query($q) or die($net->error);
- $i = 0;
- while($d=$h->fetch_array()){
- $cell[$i][0]=$d[0];
- $qu ="SELECT d.nilai_krit
- FROM detail_nilai d, master_nilai m, penari p
- WHERE d.id_nilai=m.id_nilai AND m.id_penari=p.id_penari AND p.nama='{$cell[$i][0]}'
- ORDER BY d.id_krit ";
- $ha = $net->query($qu) or die($net->error);
- $iq = 1;
- while($da=$ha->fetch_array()){
- $cell[$iq][1]=$da[1];
- $iq++;
- }
- $i++;
- }
- // orientasi Potrait
- // ukuran cm
- // kertas A4
- $pdf = new PDF('L','cm','A4');
- $pdf->Open();
- $pdf->AliasNbPages();
- $pdf->AddPage();
- $pdf->SetFont('Arial','','8');
- //perulangan untuk membuat tabel
- for($j=0;$j<$i;$j++){
- $pdf->Cell(2);
- $pdf->Cell(4,1,$cell[$j][0],'B',0,'L');
- for($ja=1;$ja<$iq;$ja++){
- $pdf->Cell(4,1,$cell[$ja][1],'B',0,'L');
- }
- $pdf->Ln();
- }
- $pdf->Output(); // ditampilkan
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement