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_Creditmemo 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
00044
00045
00046
00047
00048
00049
00050
00051 $shift = array(0, 10, 0);
00052 $leftBound = 35;
00053 $rightBound = 565;
00054
00055
00056 $this->_setFontRegular();
00057 $x = $leftBound;
00058 foreach (Mage::helper('core/string')->str_split($item->getName(), $x, true, true) as $key => $part) {
00059 $page->drawText($part, $x, $pdf->y - $shift[0], 'UTF-8');
00060 $shift[0] += 10;
00061 }
00062
00063 $options = $this->getItemOptions();
00064 if (isset($options)) {
00065 foreach ($options as $option) {
00066
00067 $this->_setFontItalic();
00068 foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), $x, false, true) as $_option) {
00069 $page->drawText($_option, $x, $pdf->y - $shift[0], 'UTF-8');
00070 $shift[0] += 10;
00071 }
00072
00073 $this->_setFontRegular();
00074 $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
00075 foreach (Mage::helper('core/string')->str_split($_printValue, $x, true, true) as $_value) {
00076 $page->drawText($_value, $x + 5, $pdf->y - $shift[0], 'UTF-8');
00077 $shift[0] += 10;
00078 }
00079 }
00080 }
00081
00082 foreach ($this->_parseDescription() as $description){
00083 $page->drawText(strip_tags($description), $x + 5, $pdf->y - $shift[1], 'UTF-8');
00084 $shift[1] += 10;
00085 }
00086 $x += 220;
00087
00088
00089 foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) {
00090 $page->drawText($part, $x, $pdf->y - $shift[2], 'UTF-8');
00091 $shift[2] += 10;
00092 }
00093 $x += 100;
00094
00095 $font = $this->_setFontBold();
00096
00097
00098 $text = $order->formatPriceTxt($item->getRowTotal());
00099 $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8');
00100 $x += 50;
00101
00102
00103 $text = $order->formatPriceTxt(-$item->getDiscountAmount());
00104 $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8');
00105 $x += 50;
00106
00107
00108 $text = $item->getQty() * 1;
00109 $page->drawText($text, $pdf->getAlignCenter($text, $x, 30, $font, 7), $pdf->y, 'UTF-8');
00110 $x += 30;
00111
00112
00113 $text = $order->formatPriceTxt($item->getTaxAmount());
00114 $page->drawText($text, $pdf->getAlignRight($text, $x, 45, $font, 7, 10), $pdf->y, 'UTF-8');
00115 $x += 45;
00116
00117
00118 $text = $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount());
00119 $page->drawText($text, $pdf->getAlignRight($text, $x, $rightBound - $x, $font, 7, 0), $pdf->y, 'UTF-8');
00120
00121
00122 $this->_setFontItalic();
00123 $pdf->y -= 10;
00124 $x = $leftBound;
00125 $_purchasedItems = $this->getLinks()->getPurchasedItems();
00126 $page->drawText($this->getLinksTitle(), $x, $pdf->y, 'UTF-8');
00127
00128
00129 $this->_setFontRegular();
00130 foreach ($_purchasedItems as $_link) {
00131 $pdf->y -= 10;
00132
00133 $text = $_link->getLinkTitle();
00134 $page->drawText($text, $x+10, $pdf->y, 'UTF-8');
00135 }
00136 $pdf->y -= 15;
00137 }
00138 }