Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Laporan extends CI_Controller {
- public function __construct()
- {
- parent::__construct();
- $this->load->model("penjualan_model");
- }
- public function index()
- {
- $this->load->view('admin/laporan/laporan');
- }
- }
- //for print
- public function submit ()
- {
- if(isset($_POST['cetak']))
- {
- $data['the_content']='mPDF and CodeIgniter are cool!';
- $data['data'] = $this->penjualan_model->cetak();
- $html=$this->load->view('admin/laporan/cetak_laporan', $data, true);
- $pdfFilePath = "Laporan Penjualan.pdf";
- $this->load->library('m_pdf');
- $pdf = $this->m_pdf->load();
- $pdf->WriteHTML($html);
- $pdf->Output();
- }
- else if (isset($_POST['cari']))
- {
- $data['data'] = $this->penjualan_model->cetak();
- $this->load->view('admin/laporan/cari_laporan', $data);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement