Public Member Functions | |
draw () |
Definition at line 35 of file Default.php.
draw | ( | ) |
Draw item line
Reimplemented from Mage_Sales_Model_Order_Pdf_Items_Abstract.
Reimplemented in Mage_Sales_Model_Order_Pdf_Items_Creditmemo_Grouped.
Definition at line 37 of file Default.php.
00038 { 00039 $order = $this->getOrder(); 00040 $item = $this->getItem(); 00041 $pdf = $this->getPdf(); 00042 $page = $this->getPage(); 00043 $shift = array(0, 10, 0); 00044 $leftBound = 35; 00045 $rightBound = 565; 00046 00047 // draw name 00048 // $this->_setFontRegular(); 00049 $x = $leftBound; 00050 // draw Product name 00051 $lines[0] = array(array( 00052 'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true), 00053 'feed' => $x, 00054 )); 00055 // foreach (Mage::helper('core/string')->str_split($item->getName(), $x, true, true) as $key => $part) { 00056 // $page->drawText($part, $x, $pdf->y - $shift[0], 'UTF-8'); 00057 // $shift[0] += 10; 00058 // } 00059 00060 // draw options 00061 if ($options = $this->getItemOptions()) { 00062 foreach ($options as $option) { 00063 // draw options label 00064 // draw options label 00065 $lines[][] = array( 00066 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true), 00067 'font' => 'italic', 00068 'feed' => $x 00069 ); 00070 // 00071 // $this->_setFontItalic(); 00072 // foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), $x, false, true) as $_option) { 00073 // $page->drawText($_option, $x, $pdf->y - $shift[0], 'UTF-8'); 00074 // $shift[0] += 10; 00075 // } 00076 // draw options value 00077 00078 // $this->_setFontRegular(); 00079 $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']); 00080 $lines[][] = array( 00081 'text' => Mage::helper('core/string')->str_split($_printValue, 55, true, true), 00082 'feed' => $x + 5 00083 ); 00084 // foreach (Mage::helper('core/string')->str_split($_printValue, $x, true, true) as $_value) { 00085 // $page->drawText($_value, $x + 5, $pdf->y - $shift[0], 'UTF-8'); 00086 // $shift[0] += 10; 00087 // } 00088 } 00089 } 00090 00091 $x += 220; 00092 00093 // draw SKU 00094 $lines[0][] = array( 00095 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25), 00096 'feed' => $x 00097 ); 00098 // foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) { 00099 // $page->drawText($part, $x, $pdf->y - $shift[2], 'UTF-8'); 00100 // $shift[2] += 10; 00101 // } 00102 $x += 100; 00103 00104 // draw Total (ex) 00105 $lines[0][] = array( 00106 'text' => $order->formatPriceTxt($item->getRowTotal()), 00107 'feed' => $x, 00108 'font' => 'bold', 00109 'align' => 'right', 00110 'width' => 50, 00111 ); 00112 $x += 50; 00113 00114 // draw Discount 00115 $lines[0][] = array( 00116 'text' => $order->formatPriceTxt(-$item->getDiscountAmount()), 00117 'feed' => $x, 00118 'font' => 'bold', 00119 'align' => 'right', 00120 'width' => 50, 00121 ); 00122 $x += 50; 00123 00124 // draw QTY 00125 $lines[0][] = array( 00126 'text' => $item->getQty()*1, 00127 'feed' => $x, 00128 'font' => 'bold', 00129 'align' => 'center', 00130 'width' => 30, 00131 ); 00132 $x += 30; 00133 00134 // draw Tax 00135 $lines[0][] = array( 00136 'text' => $order->formatPriceTxt($item->getTaxAmount()), 00137 'feed' => $x, 00138 'font' => 'bold', 00139 'align' => 'right', 00140 'width' => 45, 00141 ); 00142 $x += 45; 00143 00144 // draw Subtotal 00145 $lines[0][] = array( 00146 'text' => $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount()), 00147 'feed' => $rightBound, 00148 'font' => 'bold', 00149 'align' => 'right' 00150 ); 00151 00152 // $font = $this->_setFontBold(); 00153 00154 // draw Total(ex) 00155 // $text = $order->formatPriceTxt($item->getRowTotal()); 00156 // $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8'); 00157 // $x += 50; 00158 // 00159 // // draw Discount 00160 // $text = $order->formatPriceTxt(-$item->getDiscountAmount()); 00161 // $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8'); 00162 // $x += 50; 00163 // 00164 // // draw QTY 00165 // $text = $item->getQty() * 1; 00166 // $page->drawText($text, $pdf->getAlignCenter($text, $x, 30, $font, 7), $pdf->y, 'UTF-8'); 00167 // $x += 30; 00168 // 00169 // // draw Tax 00170 // $text = $order->formatPriceTxt($item->getTaxAmount()); 00171 // $page->drawText($text, $pdf->getAlignRight($text, $x, 45, $font, 7, 10), $pdf->y, 'UTF-8'); 00172 // $x += 45; 00173 // 00174 // // draw Total(inc) 00175 // $text = $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount()); 00176 // $page->drawText($text, $pdf->getAlignRight($text, $x, $rightBound - $x, $font, 7, 0), $pdf->y, 'UTF-8'); 00177 // 00178 // $pdf->y -= max($shift) + 10; 00179 $lineBlock = array( 00180 'lines' => $lines, 00181 'height' => 10 00182 ); 00183 00184 $page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true)); 00185 $this->setPage($page); 00186 }