Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function submit ()
- {
- //process cetak laporan
- if(isset($_POST['cetak']))
- {
- if ($this->session->userdata('username')=="") {
- redirect('auth');
- }
- $data['data'] = $this->penjualan_model->cetak();
- $PDFContent=$this->load->view('admin/laporan/cetak_laporan', $data, true);
- $url = 'http://freehtmltopdf.com';
- $apiConfigData = array('convert' => '',
- 'html' => $PDFContent,
- 'baseurl' => base_url(),
- 'width' => '210mm',
- 'enablejs' => 0,
- 'orientation' => 'portrait');
- //i'm still dont understand $data
- $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n",
- 'method' => 'POST',
- 'content' => http_build_query($apiConfigData)),);
- $context = stream_context_create($options);
- $result = file_get_contents($url, false, $context);
- header('Content-type: application/pdf');
- echo $result;
- }
- //process cari laporan
- else if (isset($_POST['cari']))
- {
- if ($this->session->userdata('username')=="") {
- redirect('auth');
- }
- $data['user'] = $this->user_model->getaktif();
- $data['data'] = $this->penjualan_model->cetak();
- $data['username'] = $this->session->userdata('username');
- $this->load->view('admin/laporan/cari_laporan', $data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement