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: class Mage_Adminhtml_Block_Sales_Totals extends Mage_Sales_Block_Order_Totals
28: {
29: 30: 31: 32: 33: 34:
35: public function formatValue($total)
36: {
37: if (!$total->getIsFormated()) {
38: return $this->helper('adminhtml/sales')->displayPrices(
39: $this->getOrder(),
40: $total->getBaseValue(),
41: $total->getValue()
42: );
43: }
44: return $total->getValue();
45: }
46:
47: 48: 49: 50: 51:
52: protected function _initTotals()
53: {
54: $this->_totals = array();
55: $this->_totals['subtotal'] = new Varien_Object(array(
56: 'code' => 'subtotal',
57: 'value' => $this->getSource()->getSubtotal(),
58: 'base_value'=> $this->getSource()->getBaseSubtotal(),
59: 'label' => $this->helper('sales')->__('Subtotal')
60: ));
61:
62: 63: 64:
65: if (!$this->getSource()->getIsVirtual() && ((float) $this->getSource()->getShippingAmount() || $this->getSource()->getShippingDescription()))
66: {
67: $this->_totals['shipping'] = new Varien_Object(array(
68: 'code' => 'shipping',
69: 'value' => $this->getSource()->getShippingAmount(),
70: 'base_value'=> $this->getSource()->getBaseShippingAmount(),
71: 'label' => $this->helper('sales')->__('Shipping & Handling')
72: ));
73: }
74:
75: 76: 77:
78: if (((float)$this->getSource()->getDiscountAmount()) != 0) {
79: if ($this->getSource()->getDiscountDescription()) {
80: $discountLabel = $this->helper('sales')->__('Discount (%s)', $this->getSource()->getDiscountDescription());
81: } else {
82: $discountLabel = $this->helper('sales')->__('Discount');
83: }
84: $this->_totals['discount'] = new Varien_Object(array(
85: 'code' => 'discount',
86: 'value' => $this->getSource()->getDiscountAmount(),
87: 'base_value'=> $this->getSource()->getBaseDiscountAmount(),
88: 'label' => $discountLabel
89: ));
90: }
91:
92: $this->_totals['grand_total'] = new Varien_Object(array(
93: 'code' => 'grand_total',
94: 'strong' => true,
95: 'value' => $this->getSource()->getGrandTotal(),
96: 'base_value'=> $this->getSource()->getBaseGrandTotal(),
97: 'label' => $this->helper('sales')->__('Grand Total'),
98: 'area' => 'footer'
99: ));
100:
101: return $this;
102: }
103: }
104: