Skip to main content
1 of 5

please follow this change _prepareCollection() function with this

protected function _prepareCollection() { $collection = Mage::getResourceModel($this->_getCollectionClass()); $collection->getSelect()->join(array('invoice' => 'sales_flat_invoice'), 'invoice.entity_id = main_table.entity_id', null) ->columns('(invoice.grand_total - invoice.tax_amount) AS grand_excl_tax');

     $this->setCollection($collection);
     return parent::_prepareCollection();
     
}

and add Column in _prepareColumns() function

$this->addColumn('grand_excl_tax', array( 'header' => Mage::helper('customer')->__('GrandTotal(excl. tax)'), 'index' => 'grand_excl_tax', 'filter_condition_callback' => array($this, '_applyMyFilter'), 'type' => 'currency', 'align' => 'right', 'currency' => 'order_currency_code', ));

and add this _applyMyFilter function for filter_condition_callback protected function _applyMyFilter(Varien_Data_Collection_Db $collection, Mage_Adminhtml_Block_Widget_Grid_Column $column) {

$select = $collection->getSelect();
$field = $column->getIndex();
$value = $column->getFilter()->getValue();
$select->where("invoice.grand_total - invoice.tax_amount>?", $value['from']);
$select->where("invoice.grand_total - invoice.tax_amount<?", $value['to']);

}