Advertisement
freddy0512

controller

Apr 10th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class Laporan extends CI_Controller {
  4.  
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. $this->load->model("penjualan_model");
  9.  
  10. }
  11.  
  12. public function index()
  13. {
  14. $this->load->view('admin/laporan/laporan');
  15. }
  16.  
  17.  
  18. }
  19.  
  20.  
  21. //for print
  22. public function submit ()
  23. {
  24. if(isset($_POST['cetak']))
  25. {
  26.  
  27. $data['the_content']='mPDF and CodeIgniter are cool!';
  28. $data['data'] = $this->penjualan_model->cetak();
  29. $html=$this->load->view('admin/laporan/cetak_laporan', $data, true);
  30. $pdfFilePath = "Laporan Penjualan.pdf";
  31. $this->load->library('m_pdf');
  32. $pdf = $this->m_pdf->load();
  33.  
  34. $pdf->WriteHTML($html);
  35.  
  36. $pdf->Output();
  37.  
  38. }
  39. else if (isset($_POST['cari']))
  40. {
  41. $data['data'] = $this->penjualan_model->cetak();
  42. $this->load->view('admin/laporan/cari_laporan', $data);
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement