$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //$pdf->setPrintHeader(false); //$pdf->setPrintFooter(false); $pdf->setAutoPageBreak(false, 0); //$pdf->SetFooterMargin(18); // trim 360 x 576 from 369 x 594 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setJPEGQuality(150); $tagvs = array('h2' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h3' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'p' => array(0 => array('h' => 3, 'n' => 2), 1 => array('h' => 1, 'n' => 1))); $pdf->setHtmlVSpace($tagvs); // add a page $pdf->AddPage(); $pdf->SetFont('helvetica', '', 10); // Image ($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()) // $pdf->Image('images/logo.png', 0, 0, 0, 0, '', '', 'T', false, 150, 'C'); //$pdf->SetY(80); $html = '<h1>Booking Form</h1><h2>Booking ID : J' . $JobRef . '-' . $BookingID . '</h2><br><br>'; $html = $html . '<h3>Location Details</h3>'; $html = $html . '<table>'; $html = $html . '<tr>'; $html = $html . '<td>'; $html = $html . 'Location Ref : ' . $LocationID . '<br>'; $html = $html . 'Location Address : ';
public function actionCetaklaporan($tgl_awal, $tgl_akhir, $toko, $status) { $criteria = new CDbCriteria(); if (!empty($tgl_awal) && empty($tgl_akhir)) { $criteria->condition = "TGL_PENGADAAN>='{$tgl_awal}'"; } else { if (empty($tgl_awal) && !empty($tgl_akhir)) { $criteria->condition = "TGL_PENGADAAN<='{$tgl_akhir}'"; } else { if (!empty($tgl_awal) && !empty($tgl_akhir)) { $criteria->condition = "TGL_PENGADAAN>='{$tgl_awal}' and TGL_PENGADAAN<='{$tgl_akhir}'"; } } } $criteria->compare('NAMA_TOKO', $toko, true); $criteria->compare('STATUS', $status); $model = Pengadaan::model()->findAll($criteria); $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); spl_autoload_register(array('YiiBase', 'autoload')); $pdf->SetCreator(PDF_CREATOR); $pdf->SetTitle("Laporan Rekap Pengadaan"); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetFont('helvetica', '', 8); $pdf->SetTextColor(80, 80, 80); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->AddPage(); $pdf->setJPEGQuality(75); $html = <<<EOD \t\t<h1 align="center">LAPORAN PENGADAAN</h1> \t\t<table align="left" border="1" cellpadding="2" cellspacing="0" vertical-align="middle"> \t\t\t<tbody> \t\t\t\t<tr> \t\t\t\t\t<td width="40" align="center">NO</td> \t\t\t\t\t<td width="75" align="center">Nomor PO</td> \t\t\t\t\t<td width="65" align="center">Tanggal Pengadaan</td> \t\t\t\t\t<td width="175" align="center">Permintaan</td> \t\t\t\t\t<td width="75" align="center">Nama Toko</td> \t\t\t\t\t<td width="75" align="center">Harga Total</td> \t\t\t\t\t<td width="125" align="center">Status</td> \t\t\t\t</tr> EOD; $no_urut = 0; foreach ($model as $mod) { $no_urut++; $tgl_peng = ""; if ($mod->TGL_PENGADAAN != "0000-00-00") { $tgl_peng = date("d-M-y", strtotime($mod->TGL_PENGADAAN)); } else { $tgl_peng = '-'; } $html .= <<<EOD \t\t\t\t<tr> \t\t\t\t\t<td width="40" align="center">{$no_urut}</td> \t\t\t\t\t<td width="75" align="center">{$mod->NO_PO}</td> \t\t\t\t\t<td width="65" align="center">{$tgl_peng}</td> \t\t\t\t\t<td width="175" align="center">{$mod->PERMINTAAN}</td> \t\t\t\t\t<td width="75" align="center">{$mod->NAMA_TOKO}</td> \t\t\t\t\t<td width="75" align="center">{$mod->HARGA_TOTAL}</td> \t\t\t\t\t<td width="125" align="center">{$mod->STATUS}</td> \t\t\t\t</tr> EOD; } $html .= <<<EOD \t\t\t</tbody> \t\t</table> EOD; $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); $filename = Yii::getPathOfAlias('webroot') . '/laporan/pengadaan/rekap pengadaan tanggal ' . date('d-M-y') . '.pdf'; $pdf->Output($filename, 'F'); //Yii::app()->end(); $this->redirect(Yii::app()->request->baseUrl . '/laporan/pengadaan/rekap pengadaan tanggal ' . date('d-M-y') . '.pdf'); }
$doc->SetHeaderMargin(PDF_MARGIN_HEADER); $doc->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $doc->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set auto page breaks $doc->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $doc->setImageScale(PDF_IMAGE_SCALE_RATIO); // add a page $doc->AddPage(); // set JPEG quality $doc->setJPEGQuality(75); $doc->writeHTMLCell($w = 0, $h = 0, $x = '10', $y = '30',$headers, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $doc->writeHTMLCell($w = 0, $h = 0, $x = '80', $y = '40',$time, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $doc->writeHTMLCell($w = 0, $h = 0, $x = '10', $y = '50',$table , $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); //if($fname==''){ //$doc->Output(); $doc->Output($filename, 'I'); //exit; //}else{ // $doc->Output($filename,'F'); //} }
public function actionCetaklaporan($nopol, $tgl_awal, $tgl_akhir, $jenis) { $criteria = new CDbCriteria(); if (!empty($tgl_awal) && empty($tgl_akhir)) { $criteria->condition = "TGL_PERBAIKAN>='{$tgl_awal}'"; } else { if (empty($tgl_awal) && !empty($tgl_akhir)) { $criteria->condition = "TGL_PERBAIKAN<='{$tgl_akhir}'"; } else { if (!empty($tgl_awal) && !empty($tgl_akhir)) { $criteria->condition = "TGL_PERBAIKAN>='{$tgl_awal}' and TGL_PERBAIKAN<='{$tgl_akhir}'"; } } } $criteria->with = array('iDKENDARAAN'); $criteria->compare('iDKENDARAAN.NOPOL', $nopol, true); $criteria->compare('JENIS_PERBAIKAN', $jenis); $model = Perbaikan::model()->findAll($criteria); $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); spl_autoload_register(array('YiiBase', 'autoload')); $pdf->SetCreator(PDF_CREATOR); $pdf->SetTitle("Laporan Rekap Perbaikan"); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetFont('helvetica', '', 8); $pdf->SetTextColor(80, 80, 80); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->AddPage(); $pdf->setJPEGQuality(75); $html = <<<EOD \t\t<h1 align="center">LAPORAN PERBAIKAN</h1> \t\t<table align="left" border="1" cellpadding="2" cellspacing="0"> \t\t\t<tbody> \t\t\t\t<tr> \t\t\t\t\t<td width="40" align="center">NO</td> \t\t\t\t\t<td width="75" align="center">Nopol Kendaraan</td> \t\t\t\t\t<td width="65" align="center">Tanggal Perbaikan</td> \t\t\t\t\t<td width="150" align="center">Kerusakan</td> \t\t\t\t\t<td width="75" align="center">Estimasi Waktu Perbaikan (hari)</td> \t\t\t\t\t<td width="75" align="center">Jenis Perbaikan</td> \t\t\t\t\t<td width="75" align="center">Status</td> \t\t\t\t\t<td width="75" align="center">PJ Mekanik</td> \t\t\t\t</tr> EOD; $no_urut = 0; foreach ($model as $mod) { $no_urut++; $nopol = $mod->iDKENDARAAN->NOPOL; $jenis_perbaikan = ""; if ($mod->JENIS_PERBAIKAN == 0) { $jenis_perbaikan = "Perbaikan"; } else { if ($mod->JENIS_PERBAIKAN == 1) { $jenis_perbaikan = "Penggantian"; } else { if ($mod->JENIS_PERBAIKAN == 2) { $jenis_perbaikan = "Perbaikan dan Penggantian"; } } } $tgl_perb = ""; if ($mod->TGL_PERBAIKAN != "0000-00-00") { $tgl_perb = date("d-M-y", strtotime($mod->TGL_PERBAIKAN)); } else { $tgl_perb = '-'; } $html .= <<<EOD \t\t\t\t<tr> \t\t\t\t\t<td width="40" align="center">{$no_urut}</td> \t\t\t\t\t<td width="75" align="center">{$nopol}</td> \t\t\t\t\t<td width="65" align="center">{$tgl_perb}</td> \t\t\t\t\t<td width="150" align="center">{$mod->KERUSAKAN}</td> \t\t\t\t\t<td width="75" align="center">{$mod->ESTIMASI_WAKTU_PERBAIKAN}</td> \t\t\t\t\t<td width="75" align="center">{$jenis_perbaikan}</td> \t\t\t\t\t<td width="75" align="center">{$mod->STATUS}</td> \t\t\t\t\t<td width="75" align="center">{$mod->PJ_MEKANIK}</td> \t\t\t\t</tr> EOD; } $html .= <<<EOD \t\t\t</tbody> \t\t</table> EOD; $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); $filename = Yii::getPathOfAlias('webroot') . '/laporan/perbaikan/rekap perbaikan tanggal ' . date('d-M-y') . '.pdf'; $pdf->Output($filename, 'F'); //Yii::app()->end(); $this->redirect(Yii::app()->request->baseUrl . '/laporan/perbaikan/rekap perbaikan tanggal ' . date('d-M-y') . '.pdf'); }
public function actionCetaklaporan($penerbit, $nopol, $tgl_awal, $tgl_akhir) { $criteria = new CDbCriteria(); if (!empty($tgl_awal) && empty($tgl_akhir)) { $criteria->condition = "TGL_PERJALANAN>='{$tgl_awal}'"; } else { if (empty($tgl_awal) && !empty($tgl_akhir)) { $criteria->condition = "TGL_PERJALANAN<='{$tgl_akhir}'"; } else { if (!empty($tgl_awal) && !empty($tgl_akhir)) { $criteria->condition = "TGL_PERJALANAN>='{$tgl_awal}' and TGL_PERJALANAN<='{$tgl_akhir}'"; } } } $criteria->compare('ID_PENERBIT', $penerbit, true); $criteria->compare('ID_KENDARAAN', $nopol); $model = Perjalanan::model()->findAll($criteria); $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); spl_autoload_register(array('YiiBase', 'autoload')); $pdf->SetCreator(PDF_CREATOR); $pdf->SetTitle("Laporan Rekap Perjalanan"); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetFont('helvetica', '', 8); $pdf->SetTextColor(80, 80, 80); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->AddPage(); $pdf->setJPEGQuality(75); $html = <<<EOD \t\t<h1 align="center">LAPORAN PERJALANAN</h1> \t\t<table align="left" border="1" cellpadding="2" cellspacing="0"> \t\t\t<tbody> \t\t\t\t<tr> \t\t\t\t\t<td width="25" align="center">NO</td> \t\t\t\t\t<td width="75" align="center">Nama Penerbit</td> \t\t\t\t\t<td width="65" align="center">Nopol Kendaraan</td> \t\t\t\t\t<td width="55" align="center">Tanggal Perjalanan</td> \t\t\t\t\t<td width="60" align="center">Nomor Surat PO</td> \t\t\t\t\t<td width="75" align="center">Jenis Perintah</td> \t\t\t\t\t<td width="40" align="center">Ritase</td> \t\t\t\t\t<td width="40" align="center">Titipan Awal</td> \t\t\t\t\t<td width="40" align="center">Lebih</td> \t\t\t\t\t<td width="40" align="center">Kurang</td> \t\t\t\t\t<td width="40" align="center">Akhir</td> \t\t\t\t\t<td width="65" align="center">Status</td> \t\t\t\t</tr> EOD; $no_urut = 0; foreach ($model as $mod) { $no_urut++; $penerbit = $mod->iDPENERBIT->NAMA_PENERBIT; $nopol = $mod->iDKENDARAAN->NOPOL; $tgl_perj = ""; if ($mod->TGL_PERJALANAN != "0000-00-00") { $tgl_perj = date("d-M-y", strtotime($mod->TGL_PERJALANAN)); } else { $tgl_perj = '-'; } $html .= <<<EOD \t\t\t\t<tr> \t\t\t\t\t<td width="25" align="center">{$no_urut}</td> \t\t\t\t\t<td width="75" align="center">{$penerbit}</td> \t\t\t\t\t<td width="65" align="center">{$nopol}</td> \t\t\t\t\t<td width="55" align="center">{$tgl_perj}</td> \t\t\t\t\t<td width="60" align="center">{$mod->NO_SURAT_PO}</td> \t\t\t\t\t<td width="75" align="center">{$mod->JENIS_PERINTAH}</td> \t\t\t\t\t<td width="40" align="center">{$mod->RITASE}</td> \t\t\t\t\t<td width="40" align="center">{$mod->TITIPAN_AWAL}</td> \t\t\t\t\t<td width="40" align="center">{$mod->LEBIH}</td> \t\t\t\t\t<td width="40" align="center">{$mod->KURANG}</td> \t\t\t\t\t<td width="40" align="center">{$mod->AKHIR}</td> \t\t\t\t\t<td width="65" align="center">{$mod->STATUS}</td> \t\t\t\t</tr> EOD; } $html .= <<<EOD \t\t\t</tbody> \t\t</table> EOD; $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); $filename = Yii::getPathOfAlias('webroot') . '/laporan/PO/rekap perjalanan tanggal ' . date('d-M-y') . '.pdf'; $pdf->Output($filename, 'F'); //Yii::app()->end(); $this->redirect(Yii::app()->request->baseUrl . '/laporan/PO/rekap perjalanan tanggal ' . date('d-M-y') . '.pdf'); }
// set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font $pdf->SetFont('dejavusans', '', 10); // add a page $pdf->AddPage(); // set JPEG quality $pdf->setJPEGQuality(75); /* NOTE: * ********************************************************* * You can load external XHTML using : * * $html = file_get_contents('/path/to/your/file.html'); * * External CSS files will be automatically loaded. * Sometimes you need to fix the path of the external CSS. * ********************************************************* */ // define some HTML content with style $html = $_POST['cc']; //if($_SESSION['user_type']!=2) //$pdf->Image('/tmp/'.$id.'.jpg', '15', '70', 100, 60, '', '', '', false, 400, '', false, false, 0, false, false, false); //else