<?php
include "../config/connect.php";
    $ambil = $koneksi->query("SELECT NamaVoucher,Harga,Voucher,Waktu FROM genvoucher 
      INNER JOIN paketvoucher ON genvoucher.IdVoucher=paketvoucher.IdVoucher 
      WHERE Voucher = '$_GET[vcr2]'");
      $data = $ambil->fetch_assoc();
    $paket = $data['NamaVoucher'];
    $harga = $data['Harga'];
    $voucher = $data['Voucher'];
    $create = $data['Waktu'];

require('../fpdf186/fpdf.php');

$pdf = new FPDF('P','mm',array(58,80));
$pdf->AddPage();
$pdf->SetY(2);
$pdf->SetMargins('2','2','2');
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,0,'.','0','1');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(0,6,'VOUCHER HOTSPOT','0','1','C');
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,5,'-------------------------------','0','1');
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,5,'Paket           : '.$paket,'0','1');
$pdf->Cell(0,5,'Harga           : Rp. '.number_format($harga),'0','1');
$pdf->SetFont('Arial','',10);
$pdf->Cell(0,5,'Kode Voucher','0','1','C');
$pdf->SetFont('Arial','',12);
$pdf->Cell(0,6,$voucher,'0','1','C');
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,5,'-------------------------------','0','1');
$pdf->Cell(0,5,'Print at.   '.date('Y-m-d H:i:s'),'0','1');
$pdf->Cell(0,5,'Create at.  '.$data['Waktu'],'0','1');
$pdf->Output('','VCR-'.$voucher,false);

// // Header content type
// header('Content-type: application/pdf');
// header('Content-Disposition: inline; filename="VCR-'.$voucher.'.pdf"');
?>