Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function submit ()
- {
- if(isset($_POST['cetak']))
- {
- //data should be here then we dont need data anymore
- $data['data'] = $this->penjualan_model->cetak();
- $PDFContent=$this->load->view('admin/laporan/cetak_laporan', $data, true);
- $url = 'http://freehtmltopdf.com';
- $data = array('convert' => '',
- 'html' => $PDFContent,
- 'baseurl' => base_url(),
- 'width' => '210mm',
- 'enablejs' => 0,
- 'orientation' => 'portrait');
- $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n",
- 'method' => 'POST',
- 'content' => http_build_query($data)),);
- $context = stream_context_create($options);
- $result = file_get_contents($url, false, $context);
- header('Content-type: application/pdf');
- echo $result;
- }
- 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