00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract
00036 {
00037 public function draw()
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
00046 $this->_setFontRegular();
00047
00048 $page->drawText($item->getQty()*1, 435, $pdf->y, 'UTF-8');
00049
00050
00051 foreach (Mage::helper('core/string')->str_split($item->getName(), 60, true, true) as $key => $part) {
00052 $page->drawText($part, 35, $pdf->y-$shift[0], 'UTF-8');
00053 $shift[0] += 10;
00054 }
00055
00056 $options = $this->getItemOptions();
00057 if (isset($options)) {
00058 foreach ($options as $option) {
00059
00060 $this->_setFontItalic();
00061 foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true) as $_option) {
00062 $page->drawText($_option, 35, $pdf->y-$shift[0], 'UTF-8');
00063 $shift[0] += 10;
00064 }
00065
00066 $this->_setFontRegular();
00067 if ($option['value']) {
00068 $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
00069 $values = explode(', ', $_printValue);
00070 foreach ($values as $value) {
00071 foreach (Mage::helper('core/string')->str_split($value, 60,true,true) as $_value) {
00072 $page->drawText($_value, 40, $pdf->y-$shift[0], 'UTF-8');
00073 $shift[0] += 10;
00074 }
00075 }
00076 }
00077 }
00078 }
00079
00080 foreach ($this->_parseDescription() as $description){
00081 $page->drawText(strip_tags($description), 65, $pdf->y-$shift[1], 'UTF-8');
00082 $shift[1] += 10;
00083 }
00084
00085
00086 foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) {
00087 if ($key > 0) {
00088 $shift[2] += 10;
00089 }
00090 $page->drawText($part, 240, $pdf->y-$shift[2], 'UTF-8');
00091 }
00092
00093 $font = $this->_setFontBold();
00094
00095 $row_total = $order->formatPriceTxt($item->getRowTotal());
00096 $page->drawText($row_total, 565-$pdf->widthForStringUsingFontSize($row_total, $font, 7), $pdf->y, 'UTF-8');
00097
00098 $price = $order->formatPriceTxt($item->getPrice());
00099 $page->drawText($price, 395-$pdf->widthForStringUsingFontSize($price, $font, 7), $pdf->y, 'UTF-8');
00100
00101 $tax = $order->formatPriceTxt($item->getTaxAmount());
00102 $page->drawText($tax, 495-$pdf->widthForStringUsingFontSize($tax, $font, 7), $pdf->y, 'UTF-8');
00103
00104
00105 $this->_setFontItalic();
00106 $pdf->y -= 10;
00107 $x = $leftBound;
00108 $_purchasedItems = $this->getLinks()->getPurchasedItems();
00109 $page->drawText($this->getLinksTitle(), $x, $pdf->y, 'UTF-8');
00110
00111
00112 $this->_setFontRegular();
00113 foreach ($_purchasedItems as $_link) {
00114 $pdf->y -= 10;
00115
00116 $text = $_link->getLinkTitle();
00117 $page->drawText($text, $x+10, $pdf->y, 'UTF-8');
00118 }
00119 $pdf->y -= 15;
00120 }
00121 }