<?php
include "../../../koneksi.php";
require('../fpdf17/fpdf.php');
/**
 Judul  : Laporan PDF (portait):
 Level  : Menengah
 Author : Hakko Bio Richard
 Blog   : www.hakkoblogs.com
 Web    : www.niqoweb.com
 Email  : hakkobiorichard@ygmail.com
 
 Untuk tutorial yang lainnya silahkan berkunjung ke www.hakkoblogs.com
 
 Butuh jasa pembuatan website, aplikasi, pembuatan program TA dan Skripsi.? Hubungi NiqoWeb ==>> 085694984803
 
 **/
//Menampilkan data dari tabel di database

$result=mysql_query("SELECT * FROM Kriteria") or die(mysql_error());

//Inisiasi untuk membuat header kolom
$no="";
$colomid_kriteria = "";
$colomnama_kriteria = "";
$colombobot = "";
$colomtype = "";
$i=1;
//For each row, add the field to the corresponding column
while($row = mysql_fetch_array($result))
{
	$id_kriteria = $row["id_kriteria"];
    $nama_kriteria = $row["nama_kriteria"];
    $bobot = $row["bobot"];
    $type = $row["type"];

	$no = $no.$i."\n";
	$colomid_kriteria = $colomid_kriteria.$id_kriteria."\n";
    $colomnama_kriteria = $colomnama_kriteria.$nama_kriteria."\n";
    $colombobot = $colombobot.$bobot."\n";
    $colomtype = $colomtype.$type."\n";

//Create a new PDF file
$pdf = new FPDF('P','mm',array(210,297)); //L For Landscape / P For Portrait
$pdf->AddPage();

//Menambahkan Gambar
$pdf->Image('logo.png',7,7,-175);

$pdf->SetFont('Arial','B',13);
$pdf->Cell(80);
$pdf->Cell(30,10,'BUMIPUTRA',0,0,'C');
$pdf->Ln();
$pdf->Cell(80);
$pdf->Cell(30,10,'PT ASURANSI UMUM BUMIPUTERAMUDA 1967 ',0,0,'C');
$pdf->Ln();
$pdf->SetFont('Arial','',10);
$pdf->Cell(20);
$pdf->Cell(115,15,'Adapun kriteria yang digunakan dalam penilaian peserta asuransi rumahkoe di PT. Asuransi Umum ',0,0,'L');
$pdf->Ln();
$pdf->Cell(20);
$pdf->Cell(115,0,' Bumiputera Muda 1967 cabang Gorontalo dapat dilihat pada tabel berikut :',0,0,'L');
$pdf->Ln();
$i=$i+1;
}
//Fields Name position
$Y_Fields_Name_position = 50;

//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(110,180,230);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',10);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(30);
$pdf->Cell(25,8,'No',1,0,'C',1);
$pdf->SetX(55);
$pdf->Cell(25,8,'ID Kriteria',1,0,'C',1);
$pdf->SetX(80);
$pdf->Cell(40,8,'Nama Kriteria',1,0,'C',1);
$pdf->SetX(120);
$pdf->Cell(25,8,'Bobot',1,0,'C',1);
$pdf->SetX(145);
$pdf->Cell(25,8,'Type',1,0,'C',1);
$pdf->SetX(150);
$pdf->Ln();

//Table position, under Fields Name
$Y_Table_Position =58;

//Now show the columns
$pdf->SetFont('Arial','',10);

$pdf->SetY($Y_Table_Position);
$pdf->SetX(30);
$pdf->MultiCell(25,6,$no,1,'C');

$pdf->SetY($Y_Table_Position);
$pdf->SetX(55);
$pdf->MultiCell(25,6,$colomid_kriteria,1,'C');

$pdf->SetY($Y_Table_Position);
$pdf->SetX(80);
$pdf->MultiCell(40,6,$colomnama_kriteria,1,'L');

$pdf->SetY($Y_Table_Position);
$pdf->SetX(120);
$pdf->MultiCell(25,6,$colombobot,1,'C');

$pdf->SetY($Y_Table_Position);
$pdf->SetX(145);
$pdf->MultiCell(25,6,$colomtype,1,'C');

$pdf->Output();
?>
