function laporan_pdf($id_po) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); $data['data_pdf'] = $this->mdl_purchase_order->report($id_po); $konten = $this->load->view('purchase_order/po_report', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output("po_" . date('d-m-y') . "_" . $id_po . ".pdf"); }
function laporan_pdf($id_transfer) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('L', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); //filter //get filter //$fil['kd_prodi'] = $kd_prodi; //$data['nama'] = ''; //$data['namaUniv'] = 'STMIK BANDUNG'; //$data['alamatUniv'] = 'Jl.Phh.Mustofa No. 39. Grand Surapati Core (SUCORE) Blok M No.19, Telp.022 - 7207777'; //$data['kotaUniv'] = 'Bandung, Jawa Barat'; // ambil data dari tabel $data['data_pdf'] = $this->mdl_transfer->get_pdf($id_transfer); /* if (count($da['row'])==0){ echo "Data Tidak Tersedia"; return; } */ $konten = $this->load->view('transfer/transfer_laporan', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output("transfer_" . date('d-m-y') . "_" . $id_transfer . ".pdf"); }
public function voucher($numFile = false) { if (!$numFile) { $this->redireccionar('booking'); } //Session::acceso('Usuario'); $numFile = base64_decode($numFile); $numFile = $numFile * 1; $ruta_img = 'views/layout/' . DEFAULT_LAYOUT . '/img/'; $ruta_img2 = 'public/img/voucher/'; ob_start(); require_once ROOT . 'views' . DS . 'system' . DS . 'pdf' . DS . 'vouchea.php'; $content = ob_get_clean(); $this->getLibrary('html2pdf.class'); try { $html2pdf = new HTML2PDF('P', 'A4', 'es', false, CHARSET); //$html2pdf->setModeDebug(); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('Voucher_N_' . $numFile . '.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; } }
function laporan_pdf($kode) { $data['kd_mahasiswa'] = $kode; $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('L', 'Letter', 'fr'); $html2pdf->setDefaultFont('Arial'); //filter #get filter /* $fil['kd_fakultas'] = $kd_fakultas; $fil['kd_prodi'] = $kd_prodi; $fil['tahun'] = $tahun; $fil['nim'] = $nim; */ //$data['nama'] = 'indriyanto'; $data['namaUniv'] = 'UNIVERSITAS SUBANG'; $data['alamatUniv'] = 'Jln. Perkutut Kotaraja, Telp.(0967)581562'; $data['kotaUniv'] = 'Subang, Jawa Barat'; // ambil data dari tabel $data['data_pdf'] = $this->mdl_ijazah->get_pdf($kode); /* if (count($da['row'])==0){ echo "Data Tidak Tersedia"; return; } */ $konten = $this->load->view('ta/ijazah_format', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output('exemple00.pdf'); }
function laporan_pdf($kd_fakultas, $kd_prodi, $tahun, $nim) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); //filter #get filter $fil['kd_fakultas'] = $kd_fakultas; $fil['kd_prodi'] = $kd_prodi; $fil['tahun'] = $tahun; $fil['nim'] = $nim; //$data['nama'] = ''; $data['namaUniv'] = 'STMIK BANDUNG'; $data['alamatUniv'] = 'Jl.Phh.Mustofa No. 39. Grand Surapati Core (SUCORE) Blok M No.19, Telp.022 - 7207777'; $data['kotaUniv'] = 'Bandung, Jawa Barat'; // ambil data dari tabel $data['data_pdf'] = $this->mdl_khs->get_pdf($fil, $nama_dosen); /* if (count($da['row'])==0){ echo "Data Tidak Tersedia"; return; } */ $konten = $this->load->view('perkuliahan/khs_laporan', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output('khs.pdf'); }
public function generatePdf(PdfEvent $event) { $html2pdf = new \HTML2PDF($event->getOrientation(), $event->getFormat(), $event->getLang(), $event->getUnicode(), $event->getEncoding(), $event->getMarges()); $html2pdf->setDefaultFont($event->getFontName()); $html2pdf->pdf->SetDisplayMode('real'); $html2pdf->writeHTML($event->getContent()); $event->setPdf($html2pdf->output(null, 'S')); }
public function convertHtmlToFormat($orientation = 'P') { require_once 'html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF($orientation, 'A4', 'fr'); $html2pdf->setDefaultFont('times'); $html2pdf->WriteHTML($this->docTemplate->render()); $this->doc = $html2pdf->Output(NULL, 'S'); }
function laporan_pdf($date_1, $date_2) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); $data['data_pdf'] = $this->mdl_report_delivery->report_delivery_pdf($date_1, $date_2); $konten = $this->load->view('report_delivery/delivery_report', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output("Report_delivery_" . $date_1 . " To " . $date_2 . ".pdf"); }
/** * Creates a new HTML2PDF object. * Can be overridden to create renderers with non-default options. */ protected static function create_new_pdf_writer($orientation = self::ORIENTATION_PORTRAIT, $paper_size = self::PAPER_LETTER, $language = self::LANGUAGE_ENGLISH) { //create a new HTML2PDF object $pdf = new HTML2PDF($orientation, $paper_size, $language, false, 'ISO-8859-1'); //true, 'UTF-8'); //$pdf = new HTML2PDF($orientation, $paper_size, $language, true, 'UTF-8'); //set the font $pdf->setDefaultFont('Times'); return $pdf; }
/** * @return self */ public function convert($filePathIn, $filePathOut, $formats = ['html', 'pdf']) { $output = ['html' => '', 'pdf' => '']; $replace = ['content' => '', 'js' => '', 'css' => '']; try { $tpl = TemplatesRegistry::get($this->usedTemplate); foreach (['js', 'css'] as $type) { foreach ($tpl[$type] as $file) { if (!is_readable($file)) { throw new \Exception("Cannot load file {$file}."); } $file = file_get_contents($file); $replace[$type] .= $file . "\n"; } } if (file_exists("{$filePathOut}.html")) { unlink("{$filePathOut}.html"); } $replace['content'] = $this->mdParser->parse(file_get_contents($filePathIn)); $output['html'] = $this->latte->renderToString($tpl['layout'], $replace); $this->fs->write("{$filePathOut}.html", $output['html']); if (in_array('pdf', $formats)) { try { $html2pdf = new \HTML2PDF('P', 'A4', 'cs'); $html2pdf->setDefaultFont('dejavusans'); //$html2pdf->addFont('dejavusans'); $html2pdf->pdf->SetDisplayMode('real'); $output['html'] = str_replace('\\xe28087', "  ", $output['html']); $html2pdf->writeHTML($output['html']); $pdf = $html2pdf->Output("{$filePathOut}.pdf", 'S'); $this->fs->write("{$filePathOut}.pdf", $pdf); } catch (Html2PdfException $e) { $formatter = new ExceptionFormatter($e); echo "PDF: " . $formatter->getHtmlMessage(); } } if (!in_array('html', $formats)) { //unlink("{$filePathOut}.html"); } } catch (\InvalidArgumentException $e) { echo $e->getMessage(), "\n"; } return $this; }
function laporan_pdf($PMBPeriodID) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('L', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); //filter #get filter $fil['PMBPeriodID'] = $PMBPeriodID; //$data['nama'] = ''; $data['namaUniv'] = 'STMIK BANDUNG'; $data['alamatUniv'] = 'Jl.Phh.Mustofa No. 39. Grand Surapati Core (SUCORE) Blok M No.19, Telp.022 - 7207777'; $data['kotaUniv'] = 'Bandung, Jawa Barat'; // ambil data dari tabel $data['data_pdf'] = $this->mdl_lap_peserta->get_pdf($fil); /* if (count($da['row'])==0){ echo "Data Tidak Tersedia"; return; } */ $konten = $this->load->view('pmb/peserta_laporan', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output('peserta_pmb.pdf'); }
public function cetak() { $date = new DateTime('now', new DateTimeZone('Asia/Jakarta')); $today = $date->format('d-m-Y'); $this->load->model('crud_model'); $data['data'] = $this->crud_model->reportUsers(); ob_start(); $content = $this->load->view('reportUser', $data); $content = ob_get_clean(); $filename = "Lap_user" . $today . ".pdf"; //nama file pdf $this->load->library('html2pdf'); try { $html2pdf = new HTML2PDF('P', 'A4', 'en', false, 'ISO-8859-15', array(20, 10, 10, 10)); //$html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output($filename); } catch (HTML2PDF_exception $e) { echo $e; exit; } }
public function createPdf() { $salesPersonId = JFactory::getSession()->get('salesPersonId'); //$filter = JRequest::getVar('filter', array('name' => "", 'code' => "", 'merchant_id' => "", 'fromdate' => "", 'todate' => "")); //$filter = JRequest::getVar('filter',array(),'post','array'); $currency_prefix = JModel::getInstance('setting', 'enmasseModel')->getCurrencyPrefix(); $dealList = JModel::getInstance('deal', 'enmasseModel')->searchBySaleReports($salesPersonId, JRequest::getVar('name'), JRequest::getVar('merchant_id'), JRequest::getVar('fromdate'), JRequest::getVar('todate'), JRequest::getVar('code')); if (empty($dealList)) { return null; } $result = '<table style="border:1px dotted #D5D5D5; border-collapse: collapse;"><tr valign="middle"><th style="border:1px dotted #D5D5D5;" align="center" width="50">' . JText::_("No") . '</th><th style="border:1px dotted #D5D5D5;" width="150">' . JText::_("Deal Code") . '</th><th style="border:1px dotted #D5D5D5;" width="150">' . JText::_("Deal Name") . '</th><th style="border:1px dotted #D5D5D5;" width="100">' . JText::_("Merchant") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Qty Sold") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Unit Price") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Total Sales") . '</th></tr>'; $i = 0; foreach ($dealList as $row) { $i++; $merchant_name = JModel::getInstance('merchant', 'enmasseModel')->retrieveName($row->merchant_id); $total_sales = $row->price * $row->cur_sold_qty; $result .= '<tr> <td style="border:1px dotted #D5D5D5;" align="center">' . $i . '</td> <td style="border:1px dotted #D5D5D5;">' . $row->deal_code . '</td> <td style="border:1px dotted #D5D5D5;">' . $row->name . '</td> <td style="border:1px dotted #D5D5D5;">' . $merchant_name . '</td> <td style="border:1px dotted #D5D5D5;" align="center">' . $row->cur_sold_qty . '</td> <td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $row->price . '</td> <td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $total_sales . '</td></tr>'; $total_amount += $total_sales; } $result .= '<tr><td style="border:1px dotted #D5D5D5;" colspan="6" style="text-align:right" >Total Amount: </td> <td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $total_amount . '</td></tr></table>'; //todo require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_enmasse' . DS . 'helpers' . DS . 'html2pdf' . DS . 'html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($result); $outFileName = 'report-' . DatetimeWrapper::getDateOfNow() . '.pdf'; $html2pdf->Output($outFileName, 'I'); die; }
/** * HTML2PDF Library - example * * HTML => PDF convertor * distributed under the LGPL License * * @package Html2pdf * @author Laurent MINGUET <*****@*****.**> * @copyright 2016 Laurent MINGUET * * isset($_GET['vuehtml']) is not mandatory * it allow to display the result in the HTML format */ date_default_timezone_set('America/Caracas'); // get the HTML ob_start(); include 'formato.php'; $content = ob_get_clean(); // convert in PDF require_once '../html2pdf/vendor/autoload.php'; try { $html2pdf = new HTML2PDF('P', 'A4', 'fr'); // $html2pdf->setModeDebug(); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('ficha_tecnica.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; }
function krs_format($kode) { $data['id_krs'] = $kode; $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); //$data['nama'] = ''; $data['namaUniv'] = 'STMIK BANDUNG'; $data['alamatUniv'] = 'Jl.Phh.Mustofa No. 39. Grand Surapati Core (SUCORE) Blok M No.19, Telp.022 - 7207777'; $data['kotaUniv'] = 'Bandung, Jawa Barat'; // ambil data dari tabel // ambil data dari tabel $data['data_pdf'] = $this->mdl_krs->get_krs($kode); $konten = $this->load->view('registrasi/krs_format', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output('exemple00.pdf'); }
<?php } else { ?> <tr> <td width="728" height="78" style="border: 1px 1px 1px 1px solid;"> </td> </tr> <?php } ?> </table> <br/> </div> <page_footer> <div style="text-align: center;font-size: 9pt;"> TEL: (305) 637-2767 * FAX (305) 549-3984 * PO BOX 420216, MIAMI FL 33242 * www.e-fap.com </div> </page_footer> </page> <?php } } $content = ob_get_clean(); require_once '../includes/html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'letter', 'en'); $html2pdf->pdf->SetDisplayMode('real'); $html2pdf->setDefaultFont("Times"); $html2pdf->WriteHTML($content); $html2pdf->Output('invoicing.pdf');
/** * * Create bill with PDF format, return file location. * @param integer $nOrderId order id that need to print bill. * @param string $dest whether save to the file or echo direct to web browser (for preview). * @return string name of created file with absolute path. */ public static function createPDF($nOrderId, $dest = 'F') { $oOrder = JModel::getInstance('order', 'enmasseModel')->getById($nOrderId); if (empty($oOrder)) { return null; } $buyer = json_decode($oOrder->buyer_detail); $arOrderItem = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($nOrderId); $sOderDetail = '<table border="1"><tr valign="middle"><th align="center" style="width:30px;">' . JText::_("BILL_TEMPLATE_ORDER_DETAIL_NO") . '</th><th style="width:60px;">' . JText::_("BILL_TEMPLATE_ORDER_DETAIL_QUANTITY") . '</th><th style="width:50px;">' . JText::_("BILL_TEMPLATE_ORDER_DETAIL_DEAL_ID") . '</th><th align="center" style="width:320px; ">' . JText::_("BILL_TEMPLATE_ORDER_DETAIL_DEAL_DESC") . '</th><th style="width:50px;">' . JText::_("BILL_TEMPLATE_ORDER_DETAIL_UNIT_PRICE") . '</th><th style="width:50px;">' . JText::_("BILL_TEMPLATE_ORDER_DETAIL_TAX") . '</th><th style="width:80px;">' . JText::_("BILL_TEMPLATE_ORDER_DETAIL_TOTAL") . '</th></tr>'; $oPayGty = JModel::getInstance('payGty', 'enmasseModel')->getById($oOrder->pay_gty_id); if (empty($oPayGty)) { $oPayGty = new JObject(); $oPayGty->name = ""; } $count = 1; foreach ($arOrderItem as $oItem) { $sOderDetail .= '<tr valign="middle"><td >' . $count++ . '</td><td >' . $oItem->qty . '</td><td >' . $oItem->pdt_id . '</td><td style="width:300px;text-align: left">' . $oItem->description . '</td><td >' . $oItem->unit_price . '</td><td >' . '</td><td >' . $oItem->total_price . '</td></tr>'; } $sOderDetail .= '<tr><td colspan="7" style="text-align:right" >Total Amount: ' . $oOrder->total_buyer_paid . '</td></tr></table>'; $db = JFactory::getDbo(); $query = "SELECT *\n\t\t\t\t\t\tFROM #__enmasse_bill_template\n\t\t\t\t\t\tWHERE slug_name = " . $db->quote(self::$BUYER_RECEIPT_TMPL_NAME); $db->setQuery($query); $oBillTmpl = $db->loadObject(); $sTmpl = $oBillTmpl->content; $arParam = array(); $arParam['[BUYER_NAME]'] = $buyer->name; $arParam['[BUYER_EMAIL]'] = $buyer->email; $arParam['[BILL_NUMBER]'] = EnmasseHelper::displayOrderDisplayId($oOrder->id); $arParam['[BILL_DATE]'] = DatetimeWrapper::getDatetimeOfNow(); $arParam['[PAYMENT_METHOD]'] = $oPayGty->name; $arParam['[BILL_DETAIL]'] = $sOderDetail; $arParam['[BILL_DESCRIPTION]'] = $oOrder->description; //ADD style for table $sTmpl = '<style>p{margin: 8px 0px }table {border-collapse:collapse;} td, th{text-align: center} th{height: 40px}</style>' . $sTmpl; $arSearch = array_keys($arParam); $sTmpl = str_replace($arSearch, $arParam, $sTmpl); //----------------------------- //process for image tag because there have the difference source path between //html2pdf and richtext editor(using for edit bill template),image tag //was wrong source path and it cause html2pdf error $sPattern = '/(<img\\s+src=")(.*)(")/i'; if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") { $sReplace = '$1' . JPATH_SITE . DS . '\\$2$3'; } else { $sReplace = '$1' . JPATH_SITE . DS . '$2$3'; } $sTmpl = preg_replace($sPattern, $sReplace, $sTmpl); require_once dirname(__FILE__) . '/html2pdf/html2pdf.class.php'; try { $sOutFileName = "bill_preview.pdf"; if ($dest == 'F') { $sOutFileName = JPATH_ADMINISTRATOR . DS . "components" . DS . "com_enmasse" . DS . "bills" . DS . EnmasseHelper::displayOrderDisplayId($oOrder->id) . ".pdf"; if (file_exists($sOutFileName)) { unlink($sOutFileName); } } $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($sTmpl); $html2pdf->Output($sOutFileName, $dest); } catch (HTML2PDF_exception $e) { return; } return $sOutFileName; }
function kartu_format($kode) { $data['kd_mahasiswa'] = $kode; $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('L', 'A5', 'fr'); $html2pdf->setDefaultFont('Arial'); //$data['nama'] = 'indriyanto'; $data['namaUniv'] = 'UNIVERSITAS SUBANG'; $data['alamatUniv'] = 'Jln. Perkutut Kotaraja, Telp.(0967)581562'; $data['kotaUniv'] = 'Subang, Jawa Barat'; // ambil data dari tabel $data['data_pdf'] = $this->mdl_pendaftaran->get_kartu($kode); $konten = $this->load->view('pmb/kartu_format', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output('exemple00.pdf'); }
$jour_annee_fin = date('z', mktime(0, 0, 0, $mois_fin, $jour_fin, $annee_fin)); } else { $annee_fin = date("Y"); $mois_fin = date("m"); $jour_fin = date("d"); $semaine_fin = date("W"); $jour_annee_fin = date("z"); } /* Assignation des données */ $smarty->assign(array('tpl_dir' => $smarty->template_dir . 'invoice/', 'infos_facture' => $infos, 'total_facture' => $invoice->getTotal($id_facture), 'infos_societe' => $societe, 'logo' => 'logo.png')); /* Affichage des templates */ $smarty->display('invoice/css/style.tpl'); // On récupère le contenu de la page en sortie $content_html = ob_get_clean(); /* On génère le PDF */ require dirname(__FILE__) . '/html2pdf/html2pdf.class.php'; try { $marges = array(2, 2, 2, 2); $html2pdf = new HTML2PDF('P', $format, 'fr', false, 'ISO-8859-1', $marges); $html2pdf->setDefaultFont('times'); $html2pdf->pdf->SetAuthor("VTAgenda"); $html2pdf->writeHTML($content_html); //nom du fichier $jour = date('d'); $mois = date('m'); $annee = date('y'); $nom_fichier .= $jour . "_" . $mois . "_" . $annee . ".pdf"; $html2pdf->Output($nom_fichier); } catch (HTML2PDF_exception $catch) { die('Impossible de générer la facture demandée'); }
require_once "{$srcdir}/formdata.inc.php"; require_once dirname(__FILE__) . "/../../../custom/code_types.inc.php"; require_once $GLOBALS['srcdir'] . '/ESign/Api.php'; require_once $GLOBALS["include_root"] . "/orders/single_order_results.inc.php"; if ($GLOBALS['gbl_portal_cms_enable']) { require_once $GLOBALS["include_root"] . "/cmsportal/portal.inc.php"; } // For those who care that this is the patient report. $GLOBALS['PATIENT_REPORT_ACTIVE'] = true; $PDF_OUTPUT = empty($_POST['pdf']) ? 0 : intval($_POST['pdf']); if ($PDF_OUTPUT) { require_once "{$srcdir}/html2pdf/vendor/autoload.php"; $pdf = new HTML2PDF($GLOBALS['pdf_layout'], $GLOBALS['pdf_size'], $GLOBALS['pdf_language'], true, 'UTF-8', array($GLOBALS['pdf_left_margin'], $GLOBALS['pdf_top_margin'], $GLOBALS['pdf_right_margin'], $GLOBALS['pdf_bottom_margin']), $_SESSION['language_direction'] == 'rtl' ? true : false); //set 'dejavusans' for now. which is supported by a lot of languages - http://dejavu-fonts.org/wiki/Main_Page //TODO: can have this selected as setting in globals after we have more experience with this to fully support internationalization. $pdf->setDefaultFont('dejavusans'); ob_start(); } // get various authorization levels $auth_notes_a = acl_check('encounters', 'notes_a'); $auth_notes = acl_check('encounters', 'notes'); $auth_coding_a = acl_check('encounters', 'coding_a'); $auth_coding = acl_check('encounters', 'coding'); $auth_relaxed = acl_check('encounters', 'relaxed'); $auth_med = acl_check('patients', 'med'); $auth_demo = acl_check('patients', 'demo'); $esignApi = new Api(); $printable = empty($_GET['printable']) ? false : true; if ($PDF_OUTPUT) { $printable = true; }
function lap_periode_jurnal() { $page = $this->uri->segment(3); $limit = 50; if (!$page) { $offset = 0; } else { $offset = $page; } $status = $this->input->post('status'); $bln = $this->input->post('bln'); $thn = $this->input->post('thn'); //JIKA TOMBOL CETAK YANG DI TEKAN if (isset($_POST['btncetak'])) { //menampilkan semua data periode tanpa status bayar if ($status == 'expense') { $data = array('title' => 'laporan jurnal', 'status' => 'PENGELUARAN', 'kodejurnal' => $this->model_app->kode(), 'kodetrans' => $this->model_app->kodejurnal(), 'data' => $this->model_app->getdata('akun', "where id_sub_parent='0'"), 'b_survey' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1023' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_operasional' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1022' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_lain' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1031' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_atk' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1032' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_listrik' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1033' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_telkom' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1034' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_trust' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1037' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_dapur' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1035' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_gaji' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1021' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_pajak' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1036' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal")); ob_start(); $content = $this->load->view('jurnal/v_cetak_keluar', $data); $content = ob_get_clean(); } elseif ($status == 'income') { $data = array('title' => 'laporan jurnal', 'status' => 'PEMASUKAN', 'kodejurnal' => $this->model_app->kode(), 'kodetrans' => $this->model_app->kodejurnal(), 'data' => $this->model_app->getdata('akun', "where id_sub_parent='0'"), 'p_operasional' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1024' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_survey' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1025' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_klaim' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1026' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_lain' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1027' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_modal' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1028' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal")); ob_start(); $content = $this->load->view('jurnal/v_cetak_masuk', $data); $content = ob_get_clean(); } $this->load->library('html2pdf'); try { $html2pdf = new HTML2PDF('P', 'A4', 'en', false, 'ISO-8859-15', array(10, 10, 0, 0)); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->setDefaultFont('Arial', '9'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('Laporan Jurnal.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; } //---------JIKA TOMBOL CARI YANG DITEKAN------------------ } else { //--view expense if ($status == 'expense') { $data = array('title' => 'laporan jurnal', 'status' => 'PENGELUARAN', 'kodejurnal' => $this->model_app->kode(), 'kodetrans' => $this->model_app->kodejurnal(), 'data' => $this->model_app->getdata('akun', "where id_sub_parent='0'"), 'b_survey' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1023' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_operasional' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1022' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_lain' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1031' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_atk' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1032' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_listrik' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1033' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_telkom' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1034' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_trust' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1037' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_dapur' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1035' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_gaji' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1021' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'b_pajak' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1036' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'view' => 'jurnal/v_laporan_keluar'); $this->load->view('home', $data); } elseif ($status == 'income') { $data = array('title' => 'laporan jurnal', 'status' => 'PEMASUKAN', 'kodejurnal' => $this->model_app->kode(), 'kodetrans' => $this->model_app->kodejurnal(), 'data' => $this->model_app->getdata('akun', "where id_sub_parent='0'"), 'p_operasional' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1024' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_survey' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1025' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_klaim' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1026' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_lain' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1027' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'p_modal' => $this->model_app->getdata('jurnal a', "right join detail_jurnal b on a.id_jurnal=b.id_jurnal WHERE a.id_parent='1028' AND LEFT(a.tgl_jurnal,4)='{$thn}' AND MID(a.tgl_jurnal,6,2)='{$bln}' group by a.id_jurnal"), 'view' => 'jurnal/v_laporan_masuk'); $this->load->view('home', $data); } } }
$text = str_replace("\$tax_amount", "\$aos_quotes_tax_amount", $text); $text = str_replace("\$shipping_amount", "\$aos_quotes_shipping_amount", $text); $text = str_replace("\$total_amount", "\$aos_quotes_total_amount", $text); //Converting Text $parts = explode('$aos_products_quotes_name', $text); $text = $parts[0]; $parts = explode('$aos_products_quotes_product_total_price', $parts[1]); $linePart = '$aos_products_quotes_name' . $parts[0] . '$aos_products_quotes_product_total_price'; //Converting Line Items $obb = array(); $sep = ''; $tdTemp = explode('<tr>', $text); foreach ($lineItems as $id => $productId) { $obb['AOS_Products_Quotes'] = $id; $obb['AOS_Products'] = $productId; $text .= $sep . TemplateParser::parse_template($linePart, $obb); $sep = '</td></tr><tr>' . $tdTemp[count($tdTemp) - 1]; } $text .= $parts[1]; $converted = TemplateParser::parse_template($text, $object_arr); $printable = str_replace("\$", "", $converted); $file_name = "Quote_" . str_replace(" ", "_", $quote->name) . ".pdf"; ob_clean(); try { $pdf = new HTML2PDF(); $pdf->setDefaultFont('Arial'); $pdf->writeHTML($printable, isset($_GET['vuehtml'])); $pdf->Output($file_name, "D"); } catch (HTML2PDF_exception $e) { echo $e; }
<?php /** * HTML2PDF Librairy - example * support Chinese language * * HTML => PDF convertor * distributed under the LGPL License * * @author ChaiChunyan <*****@*****.**> * * * isset($_GET['vuehtml']) is not mandatory * it allow to display the result in the HTML format */ // get the HTML ob_start(); include dirname(__FILE__) . '/res/exemple_zh_cn.php'; $content = ob_get_clean(); // convert to PDF require_once dirname(__FILE__) . '/../html2pdf.class.php'; try { $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->setDefaultFont('javiergb'); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('exemple_zh_cn.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; }
/** * */ public function GetChecklist() { if (!$this->opt_order->getPrimaryKey()) { $this->Edit(); return; } require_once __CA_LIB_DIR__ . "/core/Print/html2pdf/html2pdf.class.php"; $this->view->setVar('items', $this->opt_order->getItems()); try { $vs_content = $this->render('loan_pdf_checklist_html.php'); $vo_html2pdf = new HTML2PDF('L', 'letter', 'en'); $vo_html2pdf->setDefaultFont("dejavusans"); $vo_html2pdf->setTestIsImage(false); $vo_html2pdf->WriteHTML($vs_content); header("Content-Disposition: attachment; filename=loan_checklist.pdf"); header("Content-type: application/pdf"); $vo_html2pdf->Output('loan_checklist.pdf'); $vb_printed_properly = true; } catch (Exception $e) { $vb_printed_properly = false; $this->postError(3100, _t("Could not generate PDF"), "OrderEditorController->GetCheckList()"); } }
/** * création d'un sous HTML2PDF pour la gestion des tableaux imbriqués * * @param HTML2PDF futur sous HTML2PDF passé en référence pour création * @param integer marge eventuelle de l'objet si simulation d'un TD * @return null */ function createSubHTML(&$sub_html, $cellmargin = 0) { // calcul de la largueur if ($this->style->value['width']) { $marge = $cellmargin * 2; $marge += $this->style->value['padding']['l'] + $this->style->value['padding']['r']; $marge += $this->style->value['border']['l']['width'] + $this->style->value['border']['r']['width']; $marge = $this->pdf->getW() - $this->style->value['width'] + $marge; } else { $marge = $this->margeLeft + $this->margeRight; } //clonage $sub_html = new HTML2PDF($this->sens, $this->format, $this->langue, array($this->defaultLeft, $this->defaultTop, $this->defaultRight, $this->defaultBottom)); $sub_html->setIsSubPart(); $sub_html->setEncoding($this->encoding); $sub_html->setTestTdInOnePage($this->testTDin1page); $sub_html->setTestIsImage($this->testIsImage); $sub_html->setTestIsDeprecated($this->testIsDeprecated); $sub_html->setDefaultFont($this->defaultFont); $sub_html->style->css = $this->style->css; $sub_html->style->css_keys = $this->style->css_keys; $sub_html->pdf->cloneFontFrom($this->pdf); $sub_html->style->table = $this->style->table; $sub_html->style->value = $this->style->value; $sub_html->style->setOnlyLeft(); $sub_html->setNewPage($this->format, $this->sens); $sub_html->initSubHtml($marge, $this->page, $this->defLIST); // initialisation des positions et autre $sub_html->maxX = 0; $sub_html->maxY = 0; $sub_html->maxH = 0; $sub_html->pdf->setXY(0, 0); }
function convert2pdf($content, $file_name) { if ($file_name == '') { $file_name = date('y_m_d_h_m_s') . '.pdf'; } require_once dirname(__FILE__) . '/html2pdf.class.php'; // get the HTML //ob_start(); //include(dirname(__FILE__).'/about_1.php'); //$content = ob_get_clean(); try { // init HTML2PDF $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); $html2pdf->setDefaultFont('dejavusans'); //add this line // display the full page $html2pdf->pdf->SetDisplayMode('fullpage'); // convert $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); // add the automatic index //$html2pdf->createIndex('Sommaire', 30, 12, false, true, 2); // send the PDF $html2pdf->Output($file_name); } catch (HTML2PDF_exception $e) { echo $e; exit; } }
public function return_PDF($papers) { /* * подключает класс формирования PDF * и создаёт PDF-документ */ // Имя файла $filename = iconv('windows-1251', 'utf-8', 'Переоформление_заявок_на_информационные ресурсы_' . implode(array($this->input->post('name_f'), $this->input->post('name_i'), $this->input->post('name_o')), "_") . '.pdf'); // Заголовки и закрытие документа (для прохождения валидности) $head = $this->load->view("bids/2pdf/chainhead", array(), true); $aft = $this->load->view("bids/2pdf/chainaft", array(), true); // Формируем строковый выхлоп. $outfile = $head . implode($papers, "") . $aft; // сброс буферов ob_start(); $content = ob_get_clean(); // Подключение класса. Внимательно проследить за путями! require_once '/var/www/html/users-r4/2pdf/html2pdf.class.php'; // Передаём параметры парсеру try { $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->setTestTdInOnePage(false); $html2pdf->setDefaultFont('Times'); $html2pdf->writeHTML($outfile, isset($_GET['vuehtml'])); $html2pdf->Output($filename); } catch (HTML2PDF_exception $e) { echo $e; exit; } }
public static function pdf() { $filter = JRequest::getVar('filter', array('name' => "", 'code' => "", 'merchant_id' => "", 'fromdate' => "", 'todate' => "")); $dealList = JModel::getInstance('salereports', 'enmasseModel')->search($filter['code'], $filter['name'], $filter['saleperson_id'], $filter['merchant_id'], $filter['fromdate'], $filter['todate']); $currency = JModel::getInstance('setting', 'enmasseModel')->getCurrencyPrefix(); if (empty($dealList)) { $msg = JText::_("NO_SALE_REPORT"); JFactory::getApplication()->redirect("index.php?option=com_enmasse&controller=saleReports", $msg, 'notice'); return false; } $result = '<table style="border:1px dotted #D5D5D5; border-collapse: collapse;"><tr valign="middle"><th style="border:1px dotted #D5D5D5;" align="center" width="30">' . JText::_("No") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Deal Code") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Deal Name") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="60">' . JText::_("Merchant") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="60">' . JText::_("Qty Sold") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Unit Price") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Total Sales") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Commission Percentage") . '</th><th style="border:1px dotted #D5D5D5;" align="left" width="150">' . JText::_("Total Commission Amount") . '</th></tr>'; $i = 0; $total_commission_amount = 0; foreach ($dealList as $row) { $i++; $merchant_name = JModel::getInstance('merchant', 'enmasseModel')->retrieveName($row->merchant_id); $total_sales = $row->price * $row->cur_sold_qty; $total_amount = $total_sales * $row->commission_percent / 100; $result .= '<tr> <td style="border:1px dotted #D5D5D5;" align="center">' . $i . '</td> <td style="border:1px dotted #D5D5D5;">' . $row->deal_code . '</td> <td style="border:1px dotted #D5D5D5;">' . $row->name . '</td> <td style="border:1px dotted #D5D5D5;">' . $merchant_name . '</td> <td style="border:1px dotted #D5D5D5;" align="center">' . $row->cur_sold_qty . '</td> <td style="border:1px dotted #D5D5D5;" align="center">' . $currency . $row->price . '</td> <td style="border:1px dotted #D5D5D5;" align="center">' . $currency . $total_sales . '</td> <td style="border:1px dotted #D5D5D5;" align="center">' . $row->commission_percent . ' % </td> <td style="border:1px dotted #D5D5D5;" align="center">' . $currency . $total_amount . '</td></tr>'; $total_commission_amount += $total_amount; } $result .= '<tr><td style="border-right:1px dotted #D5D5D5; text-align:right" colspan="8" >Total: </td> <td style="border:1px dotted #D5D5D5;" align="center" align="center">' . $currency . $total_commission_amount . '</td></tr></table>'; //todo require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_enmasse' . DS . 'helpers' . DS . 'html2pdf' . DS . 'html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($result); $outFileName = 'report-' . DatetimeWrapper::getDateOfNow() . '.pdf'; $html2pdf->Output($outFileName, 'I'); header("Content-type:application/pdf"); // It will be called downloaded.pdf header("Content-Disposition:attachment;filename=downloaded.pdf"); die; }
private function renderExportar(){ $table = '<table border="1" width="100%" class="table table-striped table-bordered table-hover">'; $table .= $this->createHead('E'); $table .= $this->createRowsExportar(); $table .= '</table>'; /* crear excel */ if ($this->_excel) { $nuevoarchivo = fopen($this->_rutaDocs . 'tmpExcel.xls', "w+"); fwrite($nuevoarchivo, $table); fclose($nuevoarchivo); } /* crear pdf */ if ($this->_pdf) { require_once '../lib/html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($table); $html2pdf->Output($this->_rutaDocs . 'tmpPDF.pdf','F'); // require_once '../lib/mpdf/mpdf.php'; // // $mpdf=new mPDF(); // $mpdf->WriteHTML($table); // // $mpdf->Output($this->_rutaDocs . 'tmpPDF.pdf','F'); } }
function laporan_pdf_kode($kode_barang) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('L', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); $data['data_pdf'] = $this->mdl_report_buy->report_buy_pdf_kode($kode_barang); $konten = $this->load->view('report_buy/buy_report_kode', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output("Report_buy" . $kode_barang . ".pdf"); }