Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- session_start();
- define('PASSED', true);
- require_once '../konfigurasi.php';
- require_once '../koneksi.php';
- require_once '../fungsi.php';
- auth(3, $config['admin_akses']);
- require_once './header.php';
- require_once './navigasi.php';
- //memulai menggunakan mpdf
- // Tentukan path yang tepat ke mPDF
- $nama_dokumen='laporanpdf'; //Beri nama file PDF hasil.
- define('_MPDF_PATH','mpdf60/'); // Tentukan folder dimana anda menyimpan folder mpdf
- include(_MPDF_PATH . "mpdf.php"); // Arahkan ke file mpdf.php didalam folder mpdf
- $mpdf=new mPDF('utf-8','A4', 20, 'Digital Sans'); // Membuat file mpdf baru
- //Memulai proses untuk menyimpan variabel php dan html
- ob_start();
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Laporan Pemesanan</title>
- <link rel="stylesheet" href="../css/style.css">
- </head>
- <body>
- <h1 align="center">Percetakan Elpueblo</h1>
- <h2 align="center">Jl Selokan Mataram Jogja</h1>
- <h3 align="left">Laporan Pemesanan</h3>
- <?php if (empty($hasil)) : ?>
- Tidak ada data.
- <?php else : ?>
- <table class="data" width="99%">
- <tr>
- <!--<th>No</th>!-->
- <th>ID User</th>
- <th>Kode Pesanan</th>
- <th>Id Transaksi</th>
- <th>Nama</th>
- <th>Bank Tujuan</th>
- <th>Rekening Asal</th>
- <th>Gambar</th>
- <th>Jumlah</th>
- <th>Waktu</th>
- </tr>
- <?php foreach ($data_kembali as $kembali) : ?>
- <tr>
- <!--<td><?php echo $no ++;?></td>!-->
- <td><?php echo $data['id_user'];?></td>
- <td><?php echo $data['kode_pesanan'];?></td>
- <td><?php echo $data['id_transaksi'];?></td>
- <td><?php echo $data['nama'];?></td>
- <td><?php echo $data['bank_tujuan'];?></td>
- <td><?php echo $data['rekening_asal'];?></td>
- <td> <a href="../gambar/<?php echo $data ['gambar']; ?>"><img src="../gambar/<?php echo $data ['gambar']; ?>" height="50" width="50" /></a></td>
- <td><?php echo $data['jumlah'];?></td>
- <td><?php echo $data['waktu'];?></td>
- </tr>
- </tr>
- <?php endforeach ?>
- </table>
- <?php endif ?><br>
- <?= 'Tanggal:'. date('d M Y'); ?>
- </body>
- </html>
- <?php
- //penulisan output selesai, sekarang menutup mpdf dan generate kedalam format pdf
- $html = ob_get_contents(); //Proses untuk mengambil hasil dari OB..
- ob_end_clean();
- //Disini dimulai proses convert UTF-8, kalau ingin ISO-8859-1 cukup dengan mengganti $mpdf->WriteHTML($html);
- $mpdf->SetDisplayMode('fullpage');
- $mpdf->list_indent_first_level = 0;
- $stylesheet = file_get_contents('mpdf60/mpdfstyletables.css');
- $mpdf->WriteHTML($stylesheet,1);
- $mpdf->WriteHTML(utf8_encode($html));
- $mpdf->Output($nama_dokumen.".pdf" ,'I');
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement