1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Sales_Model_Order_Pdf_Items_Creditmemo_Default extends Mage_Sales_Model_Order_Pdf_Items_Abstract
35: {
36: 37: 38:
39: public function draw()
40: {
41: $order = $this->getOrder();
42: $item = $this->getItem();
43: $pdf = $this->getPdf();
44: $page = $this->getPage();
45: $lines = array();
46:
47:
48: $lines[0] = array(array(
49: 'text' => Mage::helper('core/string')->str_split($item->getName(), 35, true, true),
50: 'feed' => 35,
51: ));
52:
53:
54: $lines[0][] = array(
55: 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 17),
56: 'feed' => 255,
57: 'align' => 'right'
58: );
59:
60:
61: $lines[0][] = array(
62: 'text' => $order->formatPriceTxt($item->getRowTotal()),
63: 'feed' => 330,
64: 'font' => 'bold',
65: 'align' => 'right',
66: );
67:
68:
69: $lines[0][] = array(
70: 'text' => $order->formatPriceTxt(-$item->getDiscountAmount()),
71: 'feed' => 380,
72: 'font' => 'bold',
73: 'align' => 'right'
74: );
75:
76:
77: $lines[0][] = array(
78: 'text' => $item->getQty() * 1,
79: 'feed' => 445,
80: 'font' => 'bold',
81: 'align' => 'right',
82: );
83:
84:
85: $lines[0][] = array(
86: 'text' => $order->formatPriceTxt($item->getTaxAmount()),
87: 'feed' => 495,
88: 'font' => 'bold',
89: 'align' => 'right'
90: );
91:
92:
93: $subtotal = $item->getRowTotal() + $item->getTaxAmount() + $item->getHiddenTaxAmount()
94: - $item->getDiscountAmount();
95: $lines[0][] = array(
96: 'text' => $order->formatPriceTxt($subtotal),
97: 'feed' => 565,
98: 'font' => 'bold',
99: 'align' => 'right'
100: );
101:
102:
103: $options = $this->getItemOptions();
104: if ($options) {
105: foreach ($options as $option) {
106:
107: $lines[][] = array(
108: 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, true, true),
109: 'font' => 'italic',
110: 'feed' => 35
111: );
112:
113:
114: $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
115: $lines[][] = array(
116: 'text' => Mage::helper('core/string')->str_split($_printValue, 30, true, true),
117: 'feed' => 40
118: );
119: }
120: }
121:
122: $lineBlock = array(
123: 'lines' => $lines,
124: 'height' => 20
125: );
126:
127: $page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
128: $this->setPage($page);
129: }
130: }
131: