1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Sales
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26: class Mage_Sales_Block_Order_Creditmemo_Totals extends Mage_Sales_Block_Order_Totals
27: {
28: protected $_creditmemo = null;
29:
30: public function getCreditmemo()
31: {
32: if ($this->_creditmemo === null) {
33: if ($this->hasData('creditmemo')) {
34: $this->_creditmemo = $this->_getData('creditmemo');
35: } elseif (Mage::registry('current_creditmemo')) {
36: $this->_creditmemo = Mage::registry('current_creditmemo');
37: } elseif ($this->getParentBlock()->getCreditmemo()) {
38: $this->_creditmemo = $this->getParentBlock()->getCreditmemo();
39: }
40: }
41: return $this->_creditmemo;
42: }
43:
44: public function setCreditmemo($creditmemo)
45: {
46: $this->_creditmemo = $creditmemo;
47: return $this;
48: }
49:
50: /**
51: * Get totals source object
52: *
53: * @return Mage_Sales_Model_Order
54: */
55: public function getSource()
56: {
57: return $this->getCreditmemo();
58: }
59:
60: /**
61: * Initialize order totals array
62: *
63: * @return Mage_Sales_Block_Order_Totals
64: */
65: protected function _initTotals()
66: {
67: parent::_initTotals();
68: $this->removeTotal('base_grandtotal');
69: if ((float) $this->getSource()->getAdjustmentPositive()) {
70: $total = new Varien_Object(array(
71: 'code' => 'adjustment_positive',
72: 'value' => $this->getSource()->getAdjustmentPositive(),
73: 'label' => $this->__('Adjustment Refund')
74: ));
75: $this->addTotal($total);
76: }
77: if ((float) $this->getSource()->getAdjustmentNegative()) {
78: $total = new Varien_Object(array(
79: 'code' => 'adjustment_negative',
80: 'value' => $this->getSource()->getAdjustmentNegative(),
81: 'label' => $this->__('Adjustment Fee')
82: ));
83: $this->addTotal($total);
84: }
85: /**
86: <?php if ($this->getCanDisplayTotalPaid()): ?>
87: <tr>
88: <td colspan="6" class="a-right"><strong><?php echo $this->__('Total Paid') ?></strong></td>
89: <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalPaid()) ?></strong></td>
90: </tr>
91: <?php endif; ?>
92: <?php if ($this->getCanDisplayTotalRefunded()): ?>
93: <tr>
94: <td colspan="6" class="a-right"><strong><?php echo $this->__('Total Refunded') ?></strong></td>
95: <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalRefunded()) ?></strong></td>
96: </tr>
97: <?php endif; ?>
98: <?php if ($this->getCanDisplayTotalDue()): ?>
99: <tr>
100: <td colspan="6" class="a-right"><strong><?php echo $this->__('Total Due') ?></strong></td>
101: <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalDue()) ?></strong></td>
102: </tr>
103: <?php endif; ?>
104: */
105: return $this;
106: }
107:
108:
109: }
110: