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_Adminhtml
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:
27: /**
28: * Totals item block
29: */
30: class Mage_Adminhtml_Block_Sales_Order_Totals_Item extends Mage_Adminhtml_Block_Sales_Order_Totals
31: {
32: /**
33: * Determine display parameters before rendering HTML
34: *
35: * @return Mage_Adminhtml_Block_Sales_Order_Totals_Item
36: */
37: protected function _beforeToHtml()
38: {
39: parent::_beforeToHtml();
40:
41: $this->setCanDisplayTotalPaid($this->getParentBlock()->getCanDisplayTotalPaid());
42: $this->setCanDisplayTotalRefunded($this->getParentBlock()->getCanDisplayTotalRefunded());
43: $this->setCanDisplayTotalDue($this->getParentBlock()->getCanDisplayTotalDue());
44:
45: return $this;
46: }
47:
48: /**
49: * Initialize totals object
50: *
51: * @return Mage_Adminhtml_Block_Sales_Order_Totals_Item
52: */
53: public function initTotals()
54: {
55: $total = new Varien_Object(array(
56: 'code' => $this->getNameInLayout(),
57: 'block_name'=> $this->getNameInLayout(),
58: 'area' => $this->getDisplayArea(),
59: 'strong' => $this->getStrong()
60: ));
61: if ($this->getBeforeCondition()) {
62: $this->getParentBlock()->addTotalBefore($total, $this->getBeforeCondition());
63: } else {
64: $this->getParentBlock()->addTotal($total, $this->getAfterCondition());
65: }
66: return $this;
67: }
68:
69: /**
70: * Price HTML getter
71: *
72: * @param float $baseAmount
73: * @param float $amount
74: * @return string
75: */
76: public function displayPrices($baseAmount, $amount)
77: {
78: return $this->helper('adminhtml/sales')->displayPrices($this->getOrder(), $baseAmount, $amount);
79: }
80:
81: /**
82: * Price attribute HTML getter
83: *
84: * @param string $code
85: * @param bool $strong
86: * @param string $separator
87: * @return string
88: */
89: public function displayPriceAttribute($code, $strong = false, $separator = '<br/>')
90: {
91: return $this->helper('adminhtml/sales')->displayPriceAttribute($this->getSource(), $code, $strong, $separator);
92: }
93:
94: /**
95: * Source order getter
96: *
97: * @return Mage_Sales_Model_Order
98: */
99: public function getSource()
100: {
101: return $this->getParentBlock()->getSource();
102: }
103: }
104: