<tr> <td style="font-size:8px">FACTURA Nº</td> <td align="left" style="font-size:10px">: ' . $nfac . '</td> </tr> <tr> <td style="font-size:8px">AUTORIZACIÓN Nº</td> <td align="left" style="font-size:10px">: ' . $nauto . '</td> </tr> <tr><td></td></tr> <tr> <td align = "center" colspan="2">' . $sfc . '</td> </tr> </table> '; //imprime el contenido de la variable html $pdf->writeHTMLCell($w = 0, $h = 0, $x = '140', $y = '17', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'left', $autopadding = true); //dibuja un rectangulo $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); $pdf->RoundedRect(138, 15, 61, 18, 2, '1111', null); $imgdata = base64_decode($invoice->logo); $pdf->Image('@' . $imgdata, '19', '10', 80, 24, '', '', 'T', false, 300, '', false, false, 0, false, false, false); ///title $anchoDivFac = 480; if ($invoice->type_third == 0) { $factura = "FACTURA"; $tercero = ""; } else { $factura = "FACTURA POR TERCEROS"; $tercero = $matriz->name; $anchoDivFac = 520; }
$pdf->SetFont('times', 'B', 11); $nit = 7024739019; $nfac = 01; $nauto = 1234567890123; $sfc = 01; // add a page $pdf->AddPage(); //cuadro roy $html = ' <p style="line-height: 175% "> NIT : ' . $nit . ' <br> AUTORIZACIÓN Nº : ' . $nfac . ' <br> FACTURA Nº : ' . $nauto . ' <br> SFC : ' . $sfc . ' <br> </p> '; $pdf->writeHTMLCell($w = 0, $h = 0, $x = '130', $y = '5', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'left', $autopadding = true); // Rounded rectangle $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); $pdf->RoundedRect(126, 5, 75, 28, 2, '1111', null); ///title roy $pdf->SetFont('times', 'B', 18); $html2 = '<h1>FACTURA</h1>'; $pdf->writeHTMLCell($w = 0, $h = 0, $x = '145', $y = '50', $html2, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'left', $autopadding = true); //nombre de la empresa roy $pdf->SetFont('times', 'B', 12, false); $datos = ' <p style="line-height: 150% "> LA CASCADA S.A. </p>'; $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '35', $datos, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'left', $autopadding = true); //original scf-1 roy
$pdf->SetTextColor(190); $pdf->SetY(5); $pdf->Write(10, 'Facture ' . $id_ventes . ' ', '', 0, 'R', true); /*écriture "ACQUITTEE" if ($donnees['paiement']==1){ $pdf->SetFont('times', '', 49); $pdf->SetY(10); $pdf->SetTextColor(250,0,0); $pdf->Write(10, 'ACQUITTE','',0, 'R',true); } */ $pdf->SetFont('times', '', 9); $pdf->SetY(30); $pdf->SetTextColor(0); // set columns width $first_column_width = 100; $second_column_width = 60; // get current vertical position $current_y_position = $pdf->getY(); //trois colonnes $pdf->writeHTMLCell($first_column_width, '', '', $current_y_position, $txt_nous, 1, 0, 0, true); $pdf->writeHTMLCell($second_column_width, '', 133, '', $txt_eux, 1, 0, 0, true); $pdf->writeHTMLCell($second_column_width, '', 133, 60, $txt_divers, 1, 1, 0, 'C', true); $pdf->writeHTML($txt1); // --------------------------------------------------------- //Close and output PDF document //$pdf->Output('C:\wamp\www\valocal\valocal\admin-sec\pdf\factures\facture_'.$id_ventes.'.pdf', 'F'); //F for saving output to file $pdf->Output('/home/clients/fdd1a6019f1e8376cbae15369dc54de1/web/applis/admin-sec/pdf/recus/recu_' . $id_ventes . '.pdf', 'F'); //F for saving output to file $pdf->Output('Facture-VALOCAL-' . $id_ventes . '.pdf', 'I'); }
public function actionCreateAccount() { $params = self::accountCond(); $select1 = "OrderSN as No,CreateTime,Payment,BuyerID,RealPrice as Price,BuyerName"; $select2 = "ReturnNO as No,CreateTime,PayMethod as Payment,ServiceID as BuyerID,Price"; if ($params['type'] == 1) { $seaCon1 = "select {$select1} from pap_order t where t.Status=9"; $seaCon1 .= " and SellerID = {$params['OrganID']} and IsDelete = 0"; $seaCon1 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}"; $seaCon1 .= " order by CreateTime DESC"; $data1 = Yii::app()->papdb->createCommand($seaCon1)->queryAll(); $count1 = Yii::app()->papdb->createCommand(str_replace($select1, 'sum(RealPrice)', $seaCon1))->queryScalar(); } else { if ($params['type'] == 2) { $seaCon2 = "select {$select2} from pap_return_order t where t.Status in(4,14)"; $seaCon2 .= " and DealerID = {$params['OrganID']}"; $seaCon2 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}"; $seaCon2 .= " order by CreateTime DESC"; $data2 = Yii::app()->papdb->createCommand($seaCon2)->queryAll(); $count2 = Yii::app()->papdb->createCommand(str_replace($select2, 'sum(Price)', $seaCon2))->queryScalar(); } else { $seaCon1 = "select {$select1} from pap_order t where t.Status=9"; $seaCon1 .= " and SellerID = {$params['OrganID']} and IsDelete = 0"; $seaCon1 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}"; $seaCon1 .= " order by CreateTime DESC"; $data1 = Yii::app()->papdb->createCommand($seaCon1)->queryAll(); $count1 = Yii::app()->papdb->createCommand(str_replace($select1, 'sum(RealPrice)', $seaCon1))->queryScalar(); $seaCon2 = "select {$select2} from pap_return_order t where t.Status in(4,14)"; $seaCon2 .= " and DealerID = {$params['OrganID']}"; $seaCon2 .= " and t.CreateTime>={$params['starttime']} and t.CreateTime<{$params['endtime']}"; $seaCon2 .= " order by CreateTime DESC"; $data2 = Yii::app()->papdb->createCommand($seaCon2)->queryAll(); $count2 = Yii::app()->papdb->createCommand(str_replace($select2, 'sum(Price)', $seaCon2))->queryScalar(); } } $count1 = $count1 ? $count1 : 0; $count2 = $count2 ? $count2 : 0; $gain = $count1 - $count2; $day = date('t', $params['starttime']); $organ = Organ::model()->findByPk($params['OrganID'], array('select' => 'OrganName'))->attributes; $html = '<div style="height:24px; line-height:24px; background-color:#1f76c8"> <div style="margin:0 auto; text-align:center"> <span style="font-family:微软雅黑; font-size:24px; color:#fff; word-spacing:8px; letter-spacing: 1.5px;">' . $params['uyear'] . '年' . $params['umonth'] . '月对账单</span> </div> </div> <div style="font-size:16px; color:#343434; line-height:16px"> <p style="margin:0px; ">亲爱的' . $organ['OrganName'] . ',您好!</p> <p style="margin:0px; ">感谢您使用由你配平台,以下是您' . $params['umonth'] . '月的平台交易明细:</p> </div> <div style="height:20px; line-height:18px; border-bottom:2px solid #c9c7c7; border-top:2px solid #c9c7c7; background-color:#f2f2f2; padding:0 30px"> <div style="font-size:16px; font-weight:bold; color:#565656; line-height:18px;float:left"> 本月净收益: <span style="color:#1f76c8">' . $gain . '</span> 元 </div> <div style="font-size:16px; line-height:18px;float:right"> <p style="margin:0px; line-height:15px"> 本月总收入: <span style="color:#1f76c8;font-size:14px">' . $count1 . '</span>元 本月总支出: <span style="color:#1f76c8;font-size:14px">' . $count2 . '</span>元</p> <p style="margin:0px; line-height:15px"> 账单周期:' . $params['uyear'] . '年' . $params['umonth'] . '月01日—' . $params['uyear'] . '年' . $params['umonth'] . '月' . $day . '日 </p> </div> </div>'; Yii::import('application.extensions.tcpdf.*'); // create new PDF document $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // 设置文档信息 $pdf->SetCreator('--'); $pdf->SetAuthor('北京嘉配科技有限公司'); $pdf->SetTitle('由你配 - 对账单'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, PHP'); // 设置页眉和页脚信恿 $pdf->SetHeaderData('', 30, '', '', array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128)); // 设置页眉和页脚字使 $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // 设置默认等宽字体 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // 设置间距 $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); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // 设置字体 $pdf->SetFont('stsongstdlight', '', 14, true); // 添加页面 $pdf->AddPage(); // Image example with resizing $pdf->Image(F::themeUrl() . '/images/jpd/logo_account.jpg', 20, 28, 30, 18, 'JPG', '', '', true, 150, '', false, false, 0, false, false, false); // 设置字体阴影 //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); // 输出HTML内容 $pdf->writeHTML($html, true, false, true, false, ''); if (!empty($data1)) { $html = '<p style="color:#1f76c8">订单明细:</p>'; $pdf->writeHTML($html, true, false, true, false, ''); // 表格标题 $header = array('时间', '交易类型', '修理厂名称', '订单编号', '收入(元)'); // data loading $data = array(); foreach ($data1 as $key => $val) { $data[$key][0] = date('Y-m-d', $val['CreateTime']); $data[$key][1] = $val['Payment'] == 2 ? '物流代收款' : '支付宝担保'; if (!$val['BuyerName']) { $val['BuyerName'] = Organ::model()->findByPk($val['BuyerID'], array('select' => 'OrganName'))->attributes['OrganName']; } $data[$key][2] = $val['BuyerName']; $data[$key][3] = $val['No']; $data[$key][4] = $val['Price']; } // 输出表格 $pdf->ColoredTable($header, $data); //换行 $pdf->Ln(); } if (!empty($data2)) { $html = '<p style="color:#1f76c8;">退货明细:</p>'; $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); // 表格标题 $header = array('时间', '退款方式', '修理厂名称', '退货单号', '支出(元)'); // 导入数据 $data = array(); foreach ($data2 as $key => $val) { $data[$key][0] = date('Y-m-d', $val['CreateTime']); $data[$key][1] = $val['Payment'] == 1 ? '物流代收款' : '支付宝担保'; $data[$key][2] = Organ::model()->findByPk($val['BuyerID'], array('select' => 'OrganName'))->attributes['OrganName']; $data[$key][3] = $val['No']; $data[$key][4] = $val['Price']; } // 输出表格 $pdf->ColoredTable($header, $data); } $pdf->Output('Account.pdf', 'I'); }
$this->Ln(); $this->Cell(190, 5, '', 'B', 0, 'C'); $this->Ln(); $this->Ln(); } // Page footer public function Footer() { if ($this->PageNo() > 1) { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('DejaVu Sans ', 'I', 8); //Text color in gray $this->SetTextColor(128); //Page number $this->Cell(0, 10, 'Stranica ' . $this->PageNo(), 0, 0, 'C'); } } } // Prva stranica $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->AddFont("DejaVuSans", "", "DejaVuSans.php"); $pdf->AddFont("DejaVuSans", "", "DejaVuSans-Bold.php"); $pdf->SetFont('DejaVuSans', '', 4); $pdf->AddPage(); $sadrzaj_bafera_za_pdf = str_replace("\t", " ", $sadrzaj_bafera_za_pdf); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $sadrzaj_bafera_za_pdf, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'center', $autopadding = true); ob_end_clean(); $pdf->Output('Raspored.pdf', 'I'); }
$nit = $invoice->account_nit; $nfac = $invoice->invoice_number; $nauto = $invoice->number_autho; $sfc = $invoice->sfc; // add a page $pdf->AddPage('P', 'LETTER'); $logoEmpresa = base64_decode($invoice->logo); $pdf->Image('@' . $logoEmpresa, '14', '10', 50, 20, '', '', 'T', false, 300, '', false, false, 0, false, false, false); ///title $titleFactura = '<table> <tr> <td align="rigth"><font color="#333333">NOTA DE ENTREGA</font></td> </tr> </table>'; $pdf->SetFont('helvetica', 'B', 27); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '10', $titleFactura, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'left', $autopadding = true); $pdf->SetFont('helvetica', 'B', 11); //nombre de la empresa $business = $invoice->account_name; $unipersonal = $invoice->account_uniper; $pdf->SetFont('helvetica', 'B', 12, false); $NombreEmpresa = ' <p style="line-height: 150%"> <font color="#333333"> ' . $business . ' </font> </p>'; $pdf->writeHTMLCell($w = 0, $h = 0, $x = '10', $y = '31', $NombreEmpresa, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'left', $autopadding = true); $pdf->SetFont('helvetica', 'B', 8, false); //datos de la empresa $casa = $matriz->name;
$pdf->setLanguageArray($l); // --------------------------------------------------------- $pdf->setFontSubsetting(true); $pdf->SetFont('arial', '', 10, '', true); $pdf->setRTL(false); // add a page $pdf->AddPage(); // set text shadow effect $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal')); //$text = "Filter: " . "Date From: " . $param[filter][dateFrom] . "; Date To: " . $param[filter][dateTo] . "; Approver: " . $param[filter][approver] . // "; Area: " . $param[filter][area] . "; Block: " . $param[filter][block] . "; Street: " . $param[filter][street] . "; PACI Number: " . $param[filter][paciNumber]; //$df = $param[filter][dateFrom]; $text = <<<EOD Filter: <br/> Date From: {$param[filter][dateFrom]}; Date To: {$param[filter][dateTo]} <br/> Approver: {$param[filter][approver]} <br/> Area: {$param[filter][area]}; Block: {$param[filter][block]}; Street: {$param[filter][street]}; PACI Number: {$param[filter][paciNumber]} EOD; // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $text, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $pdf->setRTL(true); $header = array(array(14, 20, 12, 30, 15, 18, 18, 18, 18), array('رقم الملف', 'المنطقة', 'القطعة', 'رقم القسيمة حسب الوثيقة', 'المشرف الكهربائي', 'تاريخ استلام المعاملة', 'تاريخ تحويل المعاملة لقسم التكييف', 'الرقم الموحد للمبنى', 'اسم الموظف مدخل البيانات')); foreach ($res as $r2) { $data[] = array($r2[doc]->docFileNumber, $r2[doc]->docArea, $r2[doc]->docBlock, $r2[doc]->docStreet, $r2[doc]->docBuilding, '', $r2[doc]->docHistory[0]->docDate, $r2[doc]->docPACINumber, $r2[doc]->docHistory[0]->docApprover); } //throw new Exception (print_r($data)); $pdf->PrintTable($header, $data); // --------------------------------------------------------- //Close and output PDF document $file_name = "temp/" . uniqid() . ".pdf"; $pdf->Output($file_name, 'F');
} $html .= '<tr>'; $html .= '<td align="center"><strong>' . $say . '</strong></td>'; $html .= '<td colspan="6" align="center"><strong>TOPLAM</strong></td>'; $html .= '<td align="center"><strong>' . number_format($TopSinav, 2, ',', '.') . '-TL</strong></td>'; $html .= '<td align="center"><strong>' . number_format($FonBürüt, 2, ',', '.') . '-TL</strong></td>'; // $html .= '<td align="center"><strong>'.number_format($FonNet,2,',','.').'-TL</strong></td>'; $html .= '<td align="center"><strong>' . number_format($TopBelgeMasraf, 2, ',', '.') . '-TL</strong></td>'; $html .= '<td colspan="2"></td>'; $html .= '</tr>'; $html .= '</tbody> </table> '; // $pdf->Cell(30, 0, 'Top-Center', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'C'); // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, 'L', true); $pdf->SetFont('DejaVuSans', '', 12, '', true); $temmuzYazi = '1-' . $temSay . ' sıra no arasındaki adayların MYK belge ücretleri kendileri tarafından yatırıldığından, toplam MYK belge ücreti olan <strong>' . number_format($temmuzOncesi, 2, ',', '.') . ' TL</strong> geri ödenmek üzere adayların hesaplarına yatırılacak ve bu adaylar için 50.00 TL ilave ücret iadesi yapılacaktır.'; $pdf->writeHTMLCell(0, 0, '', '', $temmuzYazi, 0, 1, 0, true, 'L', true); // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output('#4447_Ek_3_Yaranlanıcı Listesi.pdf'); exit; function UcretDuzenle($ucret) { return str_replace(',', '.', $ucret); } function DamgasizHesapla($alinacak) { $dat = $alinacak - $alinacak * 0.00759; $dat = floor($dat * 100) / 100;
$FonBürüt += $alinacak; $FonNet += round($alinacak - $alinacak * 0.00759, 2); $html .= '<td width="5%" align="center">' . number_format(round($alinacak - $alinacak * 0.00759, 2), 2, ',', '.') . '</td>'; $html .= '<td width="5%" align="center">' . number_format(50, 2, ',', '.') . '</td>'; // $html .= '<td width="12%">'.$row['IBAN'].'</td>'; $html .= '<td width="13%" align="center">TR888888888889999999999999999999</td>'; // $html .= '<td width="7%">'.$row['TELEFON'].'</td>'; $html .= '<td width="6%" align="center">+905438888888</td>'; $html .= '</tr>'; $belgeUcret += 50; } } $html .= '<tr>'; $html .= '<td align="center"><strong>' . $say . '</strong></td>'; $html .= '<td colspan="6" align="center"><strong>TOPLAM</strong></td>'; $html .= '<td align="center"><strong>' . number_format($TopSinav, 2, ',', '.') . '-TL</strong></td>'; $html .= '<td align="center"><strong>' . number_format($FonBürüt, 2, ',', '.') . '-TL</strong></td>'; $html .= '<td align="center"><strong>' . number_format($FonNet, 2, ',', '.') . '-TL</strong></td>'; $html .= '<td align="center"><strong>' . number_format($belgeUcret, 2, ',', '.') . '-TL</strong></td>'; $html .= '<td colspan="2"></td>'; $html .= '</tr>'; $html .= '</tbody> </table> '; // $pdf->Cell(30, 0, 'Top-Center', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'C'); // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, 'L', true); // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output($this->tesvikId . '#Tesvik İstek Raporu.pdf'); exit;
</table> EOD; $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->Addpage("P"); // $pdf->writeHTMLCell($w=0, $h=200, $x='', $y='', $contenido2, $border='L', $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); $pdf->writeHTML($contenido2, true, false, false, false, ''); $pdf->setCellHeightRatio(5); $contenido3 = <<<EOD <style> .head{background-color: #aaa7a7; text-align:center;} .titulo{font-weight: bold; font-size: 12px;} .subtitulo{font-weight: bold;} .conBorde{border: black solid 1; border-collapse:collapse; } </style> <table border="1" cellpadding="10" style="border-collapse:collapse;" width="100%"> <tr class="head subtitulo" style="line-height: 100%;"><td width="20%">TITULAR DE LA UNIDAD<BR>EJECUTORA</td><td width="80%">DIRECCIÓN GENERAL DE INVERSIÓN<BR>(RECIBE ORIGINAL Y COPIA)</td></tr> <tr class="subtitulo"><td></td><td></td></tr> </table> EOD; $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = 250, $contenido3, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); } ob_end_clean(); //echo"<pre>"; //print_r($_POST); //echo"</pre>"; $pdf->Output('Ap' . $CveAps . '.pdf', 'I'); // <tr><td class="conBorde" border="1" colspan="2" style="text-align:center">' . $concepto . '</td><td class="conBorde" border="1" colspan="3" style="text-align:center">$'.$_SESSION['montoAutorizado'].'</td></tr> ?>
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'); //} }
function creatNewPdf() { $agru = func_get_arg(0); $logo = $agru['logo']; $link = $agru['link']; $target = $agru['target']; $logoExtention = $agru['logo_extention']; $date = $agru['date']; $title = $agru['title']; $disc = $agru['description']; $image = $agru['image']; $content = $agru['content']; $copyright = $agru['copyright']; $fileName = $agru['file_name']; $pdfCreator = $agru['pdf_creator']; $pdfAuthor = $agru['pdf_author']; $pdfTitle = $agru['pdf_title']; $pdfSubject = $agru['pdf_subject']; $pdfKeywords = $agru['pdf_keywords']; // create new PDF document $pdf = new MYPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->setTempRTL('R'); $pdf->image_file = $logo; $pdf->href = $target; $pdf->link = $link; $pdf->copyright = $copyright; $this->extention = $logoExtention; # must included in each decument[Must Include] // appear in document properties $pdf->SetCreator($pdfCreator); $pdf->SetAuthor($pdfAuthor); $pdf->SetTitle($pdfTitle); $pdf->SetSubject($pdfSubject); $pdf->SetKeywords($pdfKeywords); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, ' ', ' ', array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128)); // 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)); // end of header # set default monospaced font[Must Include] $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); # set margins[Must Include] $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); // header & footer margin $pdf->SetHeaderMargin(50); $pdf->SetFooterMargin(20); $pdf->SetAutoPageBreak(TRUE, 30); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); //$pdf->SetFont('almohanad', '', 13); $pdf->setRTL(true); // cehck here if ar or en $pdf->startPageGroup(); $pdf->AddPage(); $lg = array(); $lg['a_meta_charset'] = 'UTF-8'; $lg['a_meta_dir'] = 'rtl'; $pdf->setLanguageArray($lg); $pdf->SetFont('almohanad', '', 13); $pdf->setRTL(true); // cehck here if ar or en $html = ' <div > <br/> <span id="date"style="color:#008080" > ' . $date . ' </span> <h3 id="title" style="color:#191970"> ' . $title . ' </h3> <h5 id="description" style="color:#6A5ACD"> ' . $disc . ' </h5> <img src="' . $image . '" alt="' . $title . '" /> <div style="align:justify"> ' . $content . ' </div> </div> '; // $pdf->writeHTML($html, true, false, false, true, ""); $pdf->writeHTMLCell($w = 170, $h = 0, $x = 0, $y = 0, $html, $border = 0, $ln = 0, $fill = false, $reseth = true, $align = "R"); $pdf->setRTL(true); #excute the file $pdf->Output(PDF_FILES . $fileName . '.pdf', '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 cetak($idquotationsales = null, $idrefstore = null) { if ($idquotationsales == null) { exit('Data Tidak Tersedia'); } $data = $this->orm->quotationsales->where('idquotationsales', $idquotationsales)->fetch(); if (count($this->orm->quotationsales->where('idquotationsales', $idquotationsales)) == 0) { echo "<h3>Data Tidak Tersedia</h3>"; exit; } //check from web if ($idrefstore == null) { $email = $_SESSION['user']['email']; $idrefstore = $_SESSION['user']['idrefstore']; } else { //from mobile $email = $this->input->post('email'); } ini_set('memory_limit', '512M'); $this->load->library('TCPDF'); // create new PDF document $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A4', true, 'UTF-8', false); // set document information $pdf->SetCreator(WEB_TITLE); $pdf->SetAuthor($email); $pdf->SetTitle("Quotation - " . $data['nomor']); $pdf->SetSubject($data['nomor']); $pdf->nomor = $data['nomor']; $pdf->tanggal = $data['tanggal']; $pdf->namaPelanggan = $data->pelanggan['namapelanggan']; $pdf->dibuat_oleh = $data['dibuat_oleh']; $pdf->oleh = $email; $pdf->store = $this->orm->refstore->where('idrefstore', $idrefstore)->fetch(); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(5, 63, 5); $pdf->SetHeaderMargin(14); $pdf->SetFooterMargin(80); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, 80); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, 80); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // --------------------------------------------------------- // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font // dejavusans is a UTF-8 Unicode font, if you only need to // print standard ASCII chars, you can use core fonts like // helvetica or times to reduce file size. // use the font $pdf->SetFont('times', '', 10, '', false); // Add a page // This method has several options, check the source code documentation for more information. $resolution = array(310, 210); $pdf->AddPage('L', $resolution); // Set some content to print $html = ' <style> body { letter-spacing:5px; } </style> <style type="text/css"> .rotate-text { /* Safari */ -webkit-transform: rotate(-90deg); /* Firefox */ -moz-transform: rotate(-90deg); /* IE */ -ms-transform: rotate(-90deg); /* Opera */ -o-transform: rotate(-90deg); /* Internet Explorer */ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); } .border-table{ border:0.5px solid #000; } table { padding-top:2px; } </style> <body> <table border="1"> <tr><th style="text-align: center;" width="60"> No </th><th width="180" style="text-align: center;"> Nama Barang </th><th style="text-align: center;" width="100"> Jumlah Barang </th><th style="text-align: center;" width="300"> Harga Satuan </th><td style="text-align: center; "width="300"> Keterangan </td></tr> '; $no = 1; foreach ($this->orm->quotationsalesdetail->where('idquotationsales', $idquotationsales) as $row) { $html .= "<tr><td>" . $no . "</td><td>" . $row->refbarang['namabarang'] . "</td><td style=\"text-align: right;\">" . $row['jumlahbarang'] . "</td><td style=\"text-align: right;\">" . number_format($row['hargasatuan'], 0, ',', '.') . "</td><td>" . $row['keterangan'] . "</td></tr>"; $no++; } $html .= '</table> </body>'; //print_r($html); exit; // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); //$pdf->writeHTML($html, true, 0, true, true); // --------------------------------------------------------- // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output("Quotation - " . $data['nomor'], 'I'); //============================================================+ // END OF FILE //============================================================+ }
$nit = $invoice->account_nit; $nfac = $invoice->invoice_number; $nauto = $invoice->number_autho; $sfc = $invoice->sfc; // add a page $pdf->AddPage(); //contenido del recuadro $html = '<p style="line-height: 175%"> NIT : ' . $nit . ' <br> AUTORIZACIÓN Nº : ' . $nauto . ' <br> FACTURA Nº : ' . $nfac . ' <br> SFC : ' . $sfc . ' <br> </p>'; //$html = $nauto; //imprime el contenido de la variable html $pdf->writeHTMLCell($w = 0, $h = 0, $x = '125', $y = '5', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'left', $autopadding = true); //dibuja un rectangulo $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); $pdf->RoundedRect(126, 5, 75, 28, 2, '1111', null); $imgdata = base64_decode($invoice->logo); $pdf->Image('@' . $imgdata, '14', '18', 30, 30, '', '', 'T', false, 300, '', false, false, 0, false, false, false); ///title if ($invoice->type_third == 0) { $factura = "FACTURA"; $tercero = ""; } else { $factura = "FACTURA POR TERCEROS"; $tercero = $invoice->branch; } $titleFactura = '<table> <tr>
function checkStoreInvoice($orderDetails = 0) { JRequest::setVar('task', 'checkStoreInvoice'); $force = true; // @ini_set( 'max_execution_time', 5 ); $path = VmConfig::get('forSale_path', 0); if ($path === 0) { vmError('No path set to store invoices'); return false; } else { $path .= 'invoices' . DS; if (!file_exists($path)) { vmError('Path wrong to store invoices, folder invoices does not exist ' . $path); return false; } else { if (!is_writable($path)) { vmError('Cannot store pdf, directory not writeable ' . $path); return false; } } } $orderModel = VmModel::getModel('orders'); $invoiceNumberDate = array(); if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) { return 0; } if (!empty($invoiceNumberDate[0])) { $invoiceNumber = $invoiceNumberDate[0]; } else { $invoiceNumber = FALSE; } if (!$invoiceNumber or empty($invoiceNumber)) { vmError('Cant create pdf, createInvoiceNumber failed'); return 0; } if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) { return 0; } $path .= 'vminvoice_' . $invoiceNumber . '.pdf'; if (file_exists($path) and !$force) { return $path; } // $app = JFactory::getApplication('site'); //We come from the be, so we need to load the FE langauge $jlang = JFactory::getLanguage(); $jlang->load('com_virtuemart', JPATH_SITE, 'en-GB', true); $jlang->load('com_virtuemart', JPATH_SITE, $jlang->getDefault(), true); $jlang->load('com_virtuemart', JPATH_SITE, null, true); $this->addViewPath(JPATH_VM_SITE . DS . 'views'); $format = 'html'; $viewName = 'invoice'; $view = $this->getView($viewName, $format); $view->addTemplatePath(JPATH_VM_SITE . DS . 'views' . DS . 'invoice' . DS . 'tmpl'); $view->invoiceNumber = $invoiceNumberDate[0]; $view->invoiceDate = $invoiceNumberDate[1]; $view->orderDetails = $orderDetails; $view->uselayout = 'invoice'; ob_start(); $view->display(); $html = ob_get_contents(); ob_end_clean(); // create new PDF document $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator('Invoice by VirtueMart 2, used library tcpdf'); $pdf->SetAuthor($view->vendor->vendor_name); $pdf->SetTitle(JText::_('COM_VIRTUEMART_INVOICE_TITLE')); $pdf->SetSubject(JText::sprintf('COM_VIRTUEMART_INVOICE_SUBJ', $view->vendor->vendor_store_name)); $pdf->SetKeywords('Invoice by VirtueMart 2'); //virtuemart.cloudaccess.net/index.php?option=com_virtuemart&view=invoice&layout=details&virtuemart_order_id=18&order_number=6e074d9b&order_pass=p_9cb9e2&task=checkStoreInvoice if (empty($view->vendor->images[0])) { vmError('Vendor image given path empty '); } else { if (empty($view->vendor->images[0]->file_url_folder) or empty($view->vendor->images[0]->file_name) or empty($view->vendor->images[0]->file_extension)) { vmError('Vendor image given image is not complete ' . $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension); vmdebug('Vendor image given image is not complete, the given media', $view->vendor->images[0]); } else { if (!empty($view->vendor->images[0]->file_extension) and strtolower($view->vendor->images[0]->file_extension) == 'png') { vmError('Warning extension of the image is a png, tpcdf has problems with that in the header, choose a jpg or gif'); } else { $imagePath = DS . str_replace('/', DS, $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension); if (!file_exists(JPATH_ROOT . $imagePath)) { vmError('Vendor image missing ' . $imagePath); } else { $pdf->SetHeaderData($imagePath, 60, $view->vendor->vendor_store_name, $view->vendorAddress); } } } } // set header and footer fonts $pdf->setHeaderFont(array('helvetica', '', 8)); $pdf->setFooterFont(array('helvetica', '', 10)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //TODO include the right file (in libraries/tcpdf/config/lang set some language-dependent strings $l = ''; $pdf->setLanguageArray($l); // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font // dejavusans is a UTF-8 Unicode font, if you only need to // print standard ASCII chars, you can use core fonts like // helvetica or times to reduce file size. $pdf->SetFont('helvetica', '', 8, '', true); // Add a page // This method has several options, check the source code documentation for more information. $pdf->AddPage(); // Set some content to print // $html = // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output($path, 'F'); return $path; }
//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') // $pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 0, 1, 'C', 0, '', 1); // set cell padding $pdf->setCellPaddings(1, 1, 1, 1); // set cell margins $pdf->setCellMargins(1, 1, 1, 1); // İlk Sayfa Logo ve Yazı // Set some content to print $logo = <<<EOD <img src="images/MYKlogo.jpg"/> EOD; $ilkSayfaUst = <<<EOD <h4>BELGELENDİRME KURULUŞLARI İÇİN DENETİM FORMU</h4> EOD; // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) $pdf->writeHTMLCell(55, 30, '', '', $logo, 0, 0, 0, true, 'L', true); $pdf->writeHTMLCell(0, 30, '', '', $ilkSayfaUst, 0, 1, 0, true, 'C', true); $pdf->SetFont('DejaVuSans', '', 11, '', true); $pdf->writeHTMLCell(0, 10, '', '', '<strong>Dosya No:</strong> YB-' . $seciliDenetim['YB_KODU'], 0, 1, 0, true, 'L', true); // 1. Kısım // $pdf->writeHTMLCell(0, 10, '', '', '<strong>1) Belgelendirme Kuruluşunun Adı-Tanımı</strong>', 0, 1, 0, true, 'L', true); $BirinciKisim = ' <p><strong>1) Belgelendirme Kuruluşunun Adı-Tanımı</strong></p> <table width="100%" border="1" style="padding:10px"> <tbody> <tr nobr="true"> <td width="35%"><strong>Adı:</strong></td> <td width="65%">' . $kurulus['KURULUS_ADI'] . '</td> </tr> <tr nobr="true"> <td width="35%"><strong>Adres:</strong></td>
$pdf->setLanguageArray($l); $pdf->SetFont('times', '', 10, '', true); $pdf->AddPage(); $spacing = -0.01; $stretching = 75; $pdf->setFontStretching($stretching); $pdf->setFontSpacing($spacing); $titling = <<<EOD <strong> <font style="font-size:11">Pharmacy Sys</font> </strong> <br> <strong>Official Receipt</strong><br> Student Center Ground Floor,<br> P.O. Box Private Bag Kabarak, Kenya <br> Tel: +254 702 937 925 <br> E-mail: pharmacysys@yahoo.com <br>----------------------------------------- EOD; $header = array('Drug', 'Price.', 'Qtty', 'Cost(Kshs.)'); $ddt = <<<EOD {$time} EOD; $html = <<<EOD <br>----------------------------------------- EOD; $data = $pdf->LoadData('receipts/docs/' . $recNo . '.txt'); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $titling, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $ddt, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $pdf->ColoredTable($header, $data); $pdf->SetY(-10); $pdf->Cell(0, 0, 'You were served by: ' . strtoupper($user), 0, false, 'L', 0, '', 0, false, 'T', 'M'); $pdf->Output('receipts/printouts/' . $details1['customer_name'] . '-receipt.pdf', 'F'); unlink('receipts/docs/' . $recNo . '.txt'); unset($_SESSION['custId'], $_SESSION['custName'], $_SESSION['age'], $_SESSION['sex'], $_SESSION['postal_address'], $_SESSION['phone']); header('Location: payment.php'); exit;
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'); }