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:
35: class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Creditmemo
36: extends Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract
37: {
38: 39: 40: 41:
42: public function draw()
43: {
44: $order = $this->getOrder();
45: $item = $this->getItem();
46: $pdf = $this->getPdf();
47: $page = $this->getPage();
48: $lines = array();
49:
50:
51: $lines[0] = array(array(
52: 'text' => Mage::helper('core/string')->str_split($item->getName(), 35, true, true),
53: 'feed' => 35,
54: ));
55:
56:
57: $lines[0][] = array(
58: 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 17),
59: 'feed' => 255,
60: 'align' => 'right'
61: );
62:
63:
64: $lines[0][] = array(
65: 'text' => $order->formatPriceTxt($item->getRowTotal()),
66: 'feed' => 330,
67: 'font' => 'bold',
68: 'align' => 'right',
69: );
70:
71:
72: $lines[0][] = array(
73: 'text' => $order->formatPriceTxt(-$item->getDiscountAmount()),
74: 'feed' => 380,
75: 'font' => 'bold',
76: 'align' => 'right'
77: );
78:
79:
80: $lines[0][] = array(
81: 'text' => $item->getQty() * 1,
82: 'feed' => 445,
83: 'font' => 'bold',
84: 'align' => 'right',
85: );
86:
87:
88: $lines[0][] = array(
89: 'text' => $order->formatPriceTxt($item->getTaxAmount()),
90: 'feed' => 495,
91: 'font' => 'bold',
92: 'align' => 'right'
93: );
94:
95:
96: $subtotal = $item->getRowTotal() + $item->getTaxAmount() + $item->getHiddenTaxAmount()
97: - $item->getDiscountAmount();
98: $lines[0][] = array(
99: 'text' => $order->formatPriceTxt($subtotal),
100: 'feed' => 565,
101: 'font' => 'bold',
102: 'align' => 'right'
103: );
104:
105:
106: $options = $this->getItemOptions();
107: if ($options) {
108: foreach ($options as $option) {
109:
110: $lines[][] = array(
111: 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, true, true),
112: 'font' => 'italic',
113: 'feed' => 35
114: );
115:
116:
117: $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
118: $lines[][] = array(
119: 'text' => Mage::helper('core/string')->str_split($_printValue, 30, true, true),
120: 'feed' => 40
121: );
122: }
123: }
124:
125:
126: $_purchasedItems = $this->getLinks()->getPurchasedItems();
127:
128:
129: $lines[][] = array(
130: 'text' => Mage::helper('core/string')->str_split($this->getLinksTitle(), 70, true, true),
131: 'font' => 'italic',
132: 'feed' => 35
133: );
134:
135:
136: foreach ($_purchasedItems as $_link) {
137: $lines[][] = array(
138: 'text' => Mage::helper('core/string')->str_split($_link->getLinkTitle(), 50, true, true),
139: 'feed' => 40
140: );
141: }
142:
143: $lineBlock = array(
144: 'lines' => $lines,
145: 'height' => 20
146: );
147:
148: $page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
149: $this->setPage($page);
150: }
151: }
152: