in the config.xml file you need to add the below code in tag
<adminhtml>
<rewrite>
<sales_totals>Voronoy_ExtraFee_Block_Adminhtml_Sales_Totals</sales_totals>
<sales_order_totals>Voronoy_ExtraFee_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
<sales_order_invoice_totals>Voronoy_ExtraFee_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
</rewrite>
</adminhtml>
create new file Totals.php at Voronoy/ExtraFee/Block/Adminhtml/Sales folder
<?php
class Voronoy_ExtraFee_Block_Adminhtml_Sales_Totals extends Mage_Adminhtml_Block_Sales_Totals
{
protected function _initTotals()
{
parent::_initTotals();
$source = $this->getSource();
$totals = $this->_totals;
$total = array();
if (count($totals) > 0) {
foreach ($totals as $index => $val) {
if ($index == "grand_total") {
if (((float)$this->getSource()->getExtraFeeRuleAmount()) != 0) {
$label = $this->__('Extra Fee');
$total['extra_fee_rule_amount'] = new Varien_Object(array(
'code' => 'extra_fee_rule_amount',
'field' => 'extra_fee_rule_amount',
'value' => $source->getExtraFeeRuleAmount(),
'label' => $label
));
}
}
$total[$index] = $val;
}
$this->_totals = $total;
}
return $this;
}
}
create file Totals.php at Voronoy/ExtraFee/Block/Adminhtml/Sales/Order/
<?php
class Voronoy_ExtraFee_Block_Adminhtml_Sales_Order_Totals extends Voronoy_ExtraFee_Block_Adminhtml_Sales_Totals
{
protected function _initTotals()
{
parent::_initTotals();
$this->_totals['paid'] = new Varien_Object(array(
'code' => 'paid',
'strong' => true,
'value' => $this->getSource()->getTotalPaid(),
'base_value' => $this->getSource()->getBaseTotalPaid(),
'label' => $this->helper('sales')->__('Total Paid'),
'area' => 'footer'
));
$this->_totals['refunded'] = new Varien_Object(array(
'code' => 'refunded',
'strong' => true,
'value' => $this->getSource()->getTotalRefunded(),
'base_value' => $this->getSource()->getBaseTotalRefunded(),
'label' => $this->helper('sales')->__('Total Refunded'),
'area' => 'footer'
));
$this->_totals['due'] = new Varien_Object(array(
'code' => 'due',
'strong' => true,
'value' => $this->getSource()->getTotalDue(),
'base_value' => $this->getSource()->getBaseTotalDue(),
'label' => $this->helper('sales')->__('Total Due'),
'area' => 'footer'
));
return $this;
}
}
create file Totals at Voronoy/ExtraFee/Block/Adminhtml/Sales/Order/Invoice/ folder
<?php
class Voronoy_ExtraFee_Block_Adminhtml_Sales_Order_Invoice_Totals extends Voronoy_ExtraFee_Block_Adminhtml_Sales_Totals
{
protected $_invoice = null;
public function getSource()
{
return $this->getInvoice();
}
public function getInvoice()
{
if ($this->_invoice === null) {
if ($this->hasData('invoice')) {
$this->_invoice = $this->_getData('invoice');
} elseif (Mage::registry('current_invoice')) {
$this->_invoice = Mage::registry('current_invoice');
} elseif ($this->getParentBlock()->getInvoice()) {
$this->_invoice = $this->getParentBlock()->getInvoice();
}
}
return $this->_invoice;
}
protected function _initTotals()
{
parent::_initTotals();
$total = 0;
$this->_totals['grand_total'] = new Varien_Object(array(
'code' => 'grand_total',
'strong' => true,
'value' => ($this->getSource()->getGrandTotal() + $total),
'base_value' => ($this->getSource()->getBaseGrandTotal() + $total),
'label' => $this->helper('sales')->__('Grand Total'),
'area' => 'footer'
));
return $this;
}
}