[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 ************************************************************************************/ 10 include_once 'vtlib/Vtiger/PDF/inventory/HeaderViewer.php'; 11 12 class SalesOrderPDFHeaderViewer extends Vtiger_PDF_InventoryHeaderViewer { 13 14 function display($parent) { 15 $pdf = $parent->getPDF(); 16 $headerFrame = $parent->getHeaderFrame(); 17 if($this->model) { 18 $headerColumnWidth = $headerFrame->w/3.0; 19 20 $modelColumns = $this->model->get('columns'); 21 22 // Column 1 23 $offsetX = 5; 24 25 $modelColumnLeft = $modelColumns[0]; 26 27 list($imageWidth, $imageHeight, $imageType, $imageAttr) = getimagesize($modelColumnLeft['logo']); 28 //division because of mm to px conversion 29 $w = $imageWidth/3; 30 if($w > 60) { 31 $w=60; 32 } 33 $h = $imageHeight/3; 34 if($h > 30) { 35 $h = 30; 36 } 37 $pdf->Image($modelColumnLeft['logo'], $headerFrame->x, $headerFrame->y, $w, $h); 38 $imageHeightInMM = 30; 39 40 $pdf->SetFont('freeserif', 'B'); 41 $contentHeight = $pdf->GetStringHeight( $modelColumnLeft['summary'], $headerColumnWidth); 42 $pdf->MultiCell($headerColumnWidth, $contentHeight, $modelColumnLeft['summary'], 0, 'L', 0, 1, 43 $headerFrame->x, $headerFrame->y+$imageHeightInMM+2); 44 45 $pdf->SetFont('freeserif', ''); 46 $contentHeight = $pdf->GetStringHeight( $modelColumnLeft['content'], $headerColumnWidth); 47 $pdf->MultiCell($headerColumnWidth, $contentHeight, $modelColumnLeft['content'], 0, 'L', 0, 1, 48 $headerFrame->x, $pdf->GetY()); 49 50 if(!empty($modelColumnLeft['fieldvalue'])) { 51 $pdf->SetFont('freeserif', 'B'); 52 $pdf->SetFillColor(205,201,201); 53 $height = $pdf->GetStringHeight($modelColumnLeft['fieldlabel'], $headerColumnWidth); 54 $pdf->MultiCell($headerColumnWidth, 7, $modelColumnLeft['fieldlabel'], 1, 'C', 1, 1, $headerFrame->x, $pdf->GetY()+2); 55 56 $pdf->SetFont('freeserif', ''); 57 $height = $pdf->GetStringHeight($modelColumnLeft['fieldvalue'], $headerColumnWidth); 58 $pdf->MultiCell($headerColumnWidth, 7, $modelColumnLeft['fieldvalue'], 1, 'C', 0, 1, $headerFrame->x, $pdf->GetY()); 59 } 60 61 // Column 2 62 $offsetX = 5; 63 $pdf->SetY($headerFrame->y); 64 65 $modelColumnCenter = $modelColumns[1]; 66 67 $offsetY = 8; 68 foreach($modelColumnCenter as $label => $value) { 69 70 if(!empty($value)) { 71 $pdf->SetFont('freeserif', 'B'); 72 $pdf->SetFillColor(205,201,201); 73 $pdf->MultiCell($headerColumnWidth-$offsetX, 7, $label, 1, 'C', 1, 1, $headerFrame->x+$headerColumnWidth+$offsetX, $pdf->GetY()+$offsetY); 74 75 $pdf->SetFont('freeserif', ''); 76 $pdf->MultiCell($headerColumnWidth-$offsetX, 7, $value, 1, 'C', 0, 1, $headerFrame->x+$headerColumnWidth+$offsetX, $pdf->GetY()); 77 $offsetY = 2; 78 } 79 } 80 81 // Column 3 82 $offsetX = 10; 83 84 $modelColumnRight = $modelColumns[2]; 85 86 $contentWidth = $pdf->GetStringWidth($this->model->get('title')); 87 $contentHeight = $pdf->GetStringHeight($this->model->get('title'), $contentWidth); 88 89 $roundedRectX = $headerFrame->w+$headerFrame->x-$contentWidth*2.0; 90 $roundedRectW = $contentWidth*2.0; 91 92 $pdf->RoundedRect($roundedRectX, 10, $roundedRectW, 10, 3, '1111', 'DF', array(), array(205,201,201)); 93 94 $contentX = $roundedRectX + (($roundedRectW - $contentWidth)/2.0); 95 $pdf->SetFont('freeserif', 'B'); 96 $pdf->MultiCell($contentWidth*2.0, $contentHeight, $this->model->get('title'), 0, 'R', 0, 1, $contentX-$contentWidth, 97 $headerFrame->y+2); 98 99 $offsetY = 6; 100 101 foreach($modelColumnRight as $label => $value) { 102 if(is_array($value)) { 103 $pdf->SetFont('freeserif', ''); 104 foreach($value as $l => $v) { 105 $pdf->MultiCell($headerColumnWidth-$offsetX, 7, sprintf('%s: %s', $l, $v), 1, 'C', 0, 1, 106 $headerFrame->x+$headerColumnWidth*2.0+$offsetX, $pdf->GetY()+$offsetY); 107 $offsetY = 0; 108 } 109 } else { 110 $offsetY = 1; 111 112 $pdf->SetFont('freeserif', 'B'); 113 $pdf->SetFillColor(205,201,201); 114 $pdf->MultiCell($headerColumnWidth-$offsetX, 7, $label, 1, 'L', 1, 1, $headerFrame->x+$headerColumnWidth*2.0+$offsetX, 115 $pdf->GetY()+$offsetY); 116 117 $pdf->SetFont('freeserif', ''); 118 $pdf->MultiCell($headerColumnWidth-$offsetX, 7, $value, 1, 'L', 0, 1, $headerFrame->x+$headerColumnWidth*2.0+$offsetX, 119 $pdf->GetY()); 120 } 121 } 122 $pdf->setFont('freeserif', ''); 123 124 // Add the border cell at the end 125 // This is required to reset Y position for next write 126 $pdf->MultiCell($headerFrame->w, $headerFrame->h-$headerFrame->y, "", 0, 'L', 0, 1, $headerFrame->x, $headerFrame->y); 127 } 128 } 129 } 130 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |