Advertisement
mharshelinaw

data0

Jan 19th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.90 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. session_start();
  4. define('PASSED', true);
  5. require_once '../konfigurasi.php';
  6. require_once '../koneksi.php';
  7. require_once '../fungsi.php';
  8. auth(3, $config['admin_akses']);
  9. require_once './header.php';
  10. require_once './navigasi.php';
  11.  
  12. //memulai menggunakan mpdf
  13. // Tentukan path yang tepat ke mPDF
  14. $nama_dokumen='laporanpdf'; //Beri nama file PDF hasil.
  15. define('_MPDF_PATH','mpdf60/'); // Tentukan folder dimana anda menyimpan folder mpdf
  16. include(_MPDF_PATH . "mpdf.php"); // Arahkan ke file mpdf.php didalam folder mpdf
  17. $mpdf=new mPDF('utf-8','A4', 20, 'Digital Sans'); // Membuat file mpdf baru
  18.  
  19. //Memulai proses untuk menyimpan variabel php dan html
  20. ob_start();
  21.  
  22. ?>
  23. <!DOCTYPE html>
  24. <html lang="en">
  25. <head>
  26.     <meta charset="UTF-8">
  27.     <title>Laporan Pemesanan</title>
  28.     <link rel="stylesheet" href="../css/style.css">
  29. </head>
  30. <body>
  31.             <h1 align="center">Percetakan Elpueblo</h1>
  32.              <h2 align="center">Jl Selokan Mataram Jogja</h1>
  33.             <h3  align="left">Laporan Pemesanan</h3>
  34.            
  35.             <?php if (empty($hasil)) : ?>
  36.             Tidak ada data.
  37.             <?php else : ?>
  38.  
  39.             <table class="data" width="99%">
  40.                 <tr>
  41.                    <!--<th>No</th>!-->
  42.                         <th>ID User</th>
  43.                         <th>Kode Pesanan</th>
  44.                         <th>Id Transaksi</th>
  45.                         <th>Nama</th>
  46.                         <th>Bank Tujuan</th>
  47.                         <th>Rekening Asal</th>
  48.                         <th>Gambar</th>
  49.                         <th>Jumlah</th>
  50.                         <th>Waktu</th>
  51.                 </tr>
  52.  
  53.                 <?php foreach ($data_kembali as $kembali) : ?>
  54.                 <tr>
  55.                    <!--<td><?php echo $no ++;?></td>!-->
  56.                     <td><?php echo $data['id_user'];?></td>
  57.                     <td><?php echo $data['kode_pesanan'];?></td>
  58.                     <td><?php echo $data['id_transaksi'];?></td>
  59.                     <td><?php echo $data['nama'];?></td>
  60.                     <td><?php echo $data['bank_tujuan'];?></td>
  61.                     <td><?php echo $data['rekening_asal'];?></td>
  62.                     <td>&nbsp;&nbsp;<a href="../gambar/<?php echo $data ['gambar']; ?>"><img src="../gambar/<?php echo $data ['gambar']; ?>" height="50" width="50" /></a></td>
  63.                     <td><?php echo $data['jumlah'];?></td>
  64.                     <td><?php echo $data['waktu'];?></td>
  65.                 </tr>
  66.  
  67.                 </tr>
  68.                 <?php endforeach ?>
  69.  
  70. </table>
  71.             <?php endif ?><br>
  72.             <?= 'Tanggal:'. date('d M Y'); ?>
  73. </body>
  74. </html>
  75. <?php
  76. //penulisan output selesai, sekarang menutup mpdf dan generate kedalam format pdf
  77.  
  78. $html = ob_get_contents(); //Proses untuk mengambil hasil dari OB..
  79. ob_end_clean();
  80. //Disini dimulai proses convert UTF-8, kalau ingin ISO-8859-1 cukup dengan mengganti $mpdf->WriteHTML($html);
  81. $mpdf->SetDisplayMode('fullpage');
  82. $mpdf->list_indent_first_level = 0;
  83. $stylesheet = file_get_contents('mpdf60/mpdfstyletables.css');
  84. $mpdf->WriteHTML($stylesheet,1);
  85. $mpdf->WriteHTML(utf8_encode($html));
  86. $mpdf->Output($nama_dokumen.".pdf" ,'I');
  87. exit;
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement