A client noticed that the Admin Dashboard calculations in her system aren’t matching up with the Order report, in that what’s being called ‘Revenue’ is actually displaying profit as demonstrated in the attached shots.
What I want to do is modify the Dashboard page to add a 5th element which would be the actual Revenue and not Profit.
I’ve gotten as far adding the element to the page.
To do this I copied Totals.php from /app/code/core/Mage/Adminhtml/Block/Dashboard/ to /app/code/local/Mage/Adminhtml/Block/Dashboard/. This is the code that I modified:
$totals = $collection->getFirstItem();
$this->addTotal($this->__('Revenue'), $totals->getProfit());
$this->addTotal($this->__('Profit'), $totals->getRevenue());
$this->addTotal($this->__('Tax'), $totals->getTax());
$this->addTotal($this->__('Shipping'), $totals->getShipping());
$this->addTotal($this->__('Quantity'), $totals->getQuantity()*1, true);
I just can’t seem to find the actual variable that I need to call. Does anyone have any idea how I can locate it or what it might be? I've tried Sales, SalesTotal, Invoiced and they all return zero.
It’s the value that’s being displayed as Sales Total in the 1st image.
Thanks.
EDIT
The variable that I'm looking for isn't loading in this file. I've hunted down Grid.php in /app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales/ which is what's drawing the table in the 1st image.
I've tried inserting
Mage::log($totals->debug());
in various places but it causes an error in each instance.
Here's a snippet of code from Grid.php, either of these values would work for me..
$this->addColumn('total_income_amount', array(
'header' => Mage::helper('sales')->__('Sales Total'),
'type' => 'currency',
'currency_code' => $currencyCode,
'index' => 'total_income_amount',
'total' => 'sum',
'sortable' => false
));
$this->addColumn('total_revenue_amount', array(
'header' => Mage::helper('sales')->__('Revenue'),
'type' => 'currency',
'currency_code' => $currencyCode,
'index' => 'total_revenue_amount',
'total' => 'sum',
'sortable' => false,
'visibility_filter' => array('show_actual_columns')
));
magento
tag since more people are likely to see that. – clockworkgeek