<?php
    require_once 'common/database.php';

    $id_akun = $_SESSION['id_akun'];
    $id_paket = $_GET['kode'];

    $query = "SELECT no_kursi, tiket.kode_paket,tiket.id_akun,tanggal
            ,nama_paket,deskripsi,harga,id_tiket,gambar FROM tiket INNER JOIN
            paket WHERE paket.id_paket = tiket.kode_paket AND 
            id_akun = '$id_akun' AND tiket.kode_paket = '$id_paket'";
    
    $sql = ExecuteQuery($query);
    $data = array();
    $row = mysqli_fetch_assoc($sql);

    $nama_paket = $row['nama_paket'];
    $tanggal = $row['tangal'];
    $id_akun = $row['id_akun'];
    $id_paket = $row['kode_paket'];
    $no_kursi = $row['no_kursi'];
    $gambar = $_row['gambar'];
    $harga = $_row['harga'];
    $data_gambar = "uploads/$gambar";

    require_once ("FPDF_assets/fpdf.php");
    $pdf = new FPDF();
    $pdf->AddPage();

    $pdf->SetFillColor(255,0,0);
    $pdf->SetTextColor(255);
    $pdf->SetFont('Arial','B',28);
    $pdf->Cell(10,20,$nama_paket,'0',1,'C',true);

    $pdf->SetDrawColor(0,0,0);
    $pdf->SetFont('Arial','','14');
    $pdf->SetTextColor(0);

    $pdf->SetFillColor(80,81,77);    //warna background
    $pdf->Cell(50,10 ,"Kode Paket ", '0', 0, 'L',true);
    $pdf->SetFillColor(136,249,255); 
    $pdf->Cell(100,10 ," : ".$id_paket, '0', 1, 'L',true);

    $pdf->SetFillColor(80,81,77);    //warna background
    $pdf->Cell(50,10 ,"Tanggal Paket ", '0', 0, 'L',true);
    $pdf->SetFillColor(136,249,255); 
    $pdf->Cell(100,10 ," : ".$tanggal, '0', 1, 'L',true);

    $pdf->SetFillColor(80,81,77);    //warna background
    $pdf->Cell(50,10 ,"Pemesan ", '0', 0, 'L',true);
    $pdf->SetFillColor(136,249,255); 
    $pdf->Cell(100,10 ," : ".$id_akun, '0', 1, 'L',true);

    $pdf->SetFillColor(80,81,77);    //warna background
    $pdf->Cell(50,10 ,"Harga ", '0', 0, 'L',true);
    $pdf->SetFillColor(136,249,255); 
    $pdf->Cell(100,10 ," : ".$harga, '0', 1, 'L',true);

   $pdf->Image($data_gambar,"115","38","40","40");

   $pdf->SetFillColor(0,0,0);
   $pdf->SetTextColor(255);
   $pdf->SetFont('Arial','B','28');

   $pdf->SetFillColor(136,200,123);
   $pdf->Cell(150,20,"No Kursi : ".$no_kursi,'0',1,'C',true);


   $pdf->Output();



?>