SHOW:
|
|
- or go back to the newest paste.
| 1 | public function submit () | |
| 2 | {
| |
| 3 | if(isset($_POST['cetak'])) | |
| 4 | {
| |
| 5 | ||
| 6 | - | //do i wrong make variable data ? |
| 6 | + | |
| 7 | - | $data = $this->penjualan_model->cetak(); |
| 7 | + | $data['data'] = $this->penjualan_model->cetak(); |
| 8 | ||
| 9 | - | //is that correct put $data here ? |
| 9 | + | |
| 10 | ||
| 11 | $url = 'http://freehtmltopdf.com'; | |
| 12 | ||
| 13 | ||
| 14 | $apiConfigData = array('convert' => '',
| |
| 15 | 'html' => $PDFContent, | |
| 16 | 'baseurl' => base_url(), | |
| 17 | 'width' => '210mm', | |
| 18 | 'enablejs' => 0, | |
| 19 | 'orientation' => 'portrait'); | |
| 20 | ||
| 21 | ||
| 22 | //i'm still dont understand $data | |
| 23 | $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n",
| |
| 24 | 'method' => 'POST', | |
| 25 | 'content' => http_build_query($apiConfigData)),); | |
| 26 | ||
| 27 | $context = stream_context_create($options); | |
| 28 | ||
| 29 | $result = file_get_contents($url, false, $context); | |
| 30 | ||
| 31 | header('Content-type: application/pdf');
| |
| 32 | ||
| 33 | echo $result; | |
| 34 | ||
| 35 | ||
| 36 | } | |
| 37 | ||
| 38 | ||
| 39 | else if (isset($_POST['cari'])) | |
| 40 | {
| |
| 41 | $data['data'] = $this->penjualan_model->cetak(); | |
| 42 | - | else if (isset($_POST['cari'])) |
| 42 | + | $this->load->view('admin/laporan/cari_laporan', $data);
|
| 43 | ||
| 44 | - | $data['data'] = $this->penjualan_model->cetak(); |
| 44 | + | } |
| 45 | - | $this->load->view('admin/laporan/cari_laporan', $data);
|
| 45 | + | |
| 46 | - | |
| 46 | + | |
| 47 | - | } |
| 47 | + | |
| 48 | ||
| 49 | ||
| 50 | } |