<?php
include "fpdf.php";
include "koneksi.php";

$pdf = new FPDF('p','mm','A4');
$pdf->AddPage();



$pdf->SetFont('Arial','B',16);
$pdf->Cell(190,5,'PT.MULTI HIDRACHROME BALIKPAPAN',0,1,'C');
$pdf->SetFont('Arial','',10);
$pdf->Cell(190,4,'HYDRAULIC MANUFACTURE & HARDCHROME PLATING SERVICES',0,1,'C');
$pdf->Cell(190,5,'Telp. (0542) 771768, 771836, 747074, Fax. (0542) 743276',0,1,'C');
$pdf->Cell(190,5,'Website : www.ptmhb.com, Email : adm_marketing@mhb-hydraulic.com, accounting1@mhb-hydraulic.com',0,1,'C');
$pdf->Ln(3);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(190,5,'PURCHASE ORDER GABUNG',0,1,'C');
$pdf->Cell(190,5,'Document No. : MHB-FR-PRC-001-02',0,1,'C');
$timezone = time() + (60 * 60 * 1);
date_default_timezone_set('Asia/Jakarta');
$pdf->Cell(190,6,'Balikpapan,  '.date('d / M / yy / H:i:s a',$timezone),0,1,'C');
$pdf->Ln(5);

$idcuti = mysqli_real_escape_string($conn, $_GET["id"]);
$q = "SELECT * FROM data_purchasing_requisition WHERE gabung=".$idcuti;
$res = mysqli_query($conn, $q);
$row = mysqli_fetch_array($res);

$id_suplier = $row['id_suplier'];
$s = "SELECT * FROM data_suplier WHERE id=" .$row['id_suplier'];
$resi = mysqli_query($conn,$s);
$rowi = mysqli_fetch_array($resi);

$id_user = $_SESSION['UserID'];
$a = "SELECT * FROM user WHERE id=" .$id_user;
$resa = mysqli_query($conn,$a);
$rowa = mysqli_fetch_array($resa);

$pdf->SetFont('Arial','B',7);
$pdf->Cell(8,6,'No.',1,0,'C');
$pdf->Cell(35,6,'Kode Mobil',1,0,'C');
$pdf->Cell(37,6,'Merk Mobil',1,0,'C');
$pdf->Cell(35,6,'Type Mobil',1,0,'C');
$pdf->Cell(35,6,'Warna Pilihan',1,0,'C');
$pdf->Cell(40,6,'Harga Mobil',1,0,'C');
$pdf->Ln(2);
$no = 0;

$idcuti = "1419062021";
$sql ="select * from data_purchasing_requisition where gabung =".$idcuti;
$res = mysqli_query($conn, $sql);
while($data = mysqli_fetch_array($res))
{
	$no++;
	$pdf->Ln(4);
	$pdf->SetFont('Arial','',7);
	$pdf->Cell(8,4,$no.".",1,0,'C');
	$pdf->Cell(35,4,$data['pr_no'],1,0,'L');
	$pdf->Cell(37,4,$data['description'],1,0,'L');
	$pdf->Cell(35,4,$data['quantity'],1,0,'L');
	$pdf->Cell(35,4,$data['unit'],1,0,'L');
	$pdf->Cell(40,4,$data['pr_date'],1,0,'R');
	
}
$pdf->Output();
?>