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: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Report_Sales_Refunded_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
35: {
36: protected $_columnGroupBy = 'period';
37:
38: public function __construct()
39: {
40: parent::__construct();
41: $this->setCountTotals(true);
42: }
43:
44: public function getResourceCollectionName()
45: {
46: return ($this->getFilterData()->getData('report_type') == 'created_at_refunded')
47: ? 'sales/report_refunded_collection_refunded'
48: : 'sales/report_refunded_collection_order';
49: }
50:
51: protected function _prepareColumns()
52: {
53: $this->addColumn('period', array(
54: 'header' => Mage::helper('sales')->__('Period'),
55: 'index' => 'period',
56: 'width' => 100,
57: 'sortable' => false,
58: 'period_type' => $this->getPeriodType(),
59: 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date',
60: 'totals_label' => Mage::helper('sales')->__('Total'),
61: 'html_decorators' => array('nobr'),
62: ));
63:
64: $this->addColumn('orders_count', array(
65: 'header' => Mage::helper('sales')->__('Number of Refunded Orders'),
66: 'index' => 'orders_count',
67: 'type' => 'number',
68: 'total' => 'sum',
69: 'sortable' => false
70: ));
71:
72: if ($this->getFilterData()->getStoreIds()) {
73: $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
74: }
75: $currencyCode = $this->getCurrentCurrencyCode();
76: $rate = $this->getRate($currencyCode);
77:
78: $this->addColumn('refunded', array(
79: 'header' => Mage::helper('sales')->__('Total Refunded'),
80: 'type' => 'currency',
81: 'currency_code' => $currencyCode,
82: 'index' => 'refunded',
83: 'total' => 'sum',
84: 'sortable' => false,
85: 'rate' => $rate,
86: ));
87:
88: $this->addColumn('online_refunded', array(
89: 'header' => Mage::helper('sales')->__('Online Refunded'),
90: 'type' => 'currency',
91: 'currency_code' => $currencyCode,
92: 'index' => 'online_refunded',
93: 'total' => 'sum',
94: 'sortable' => false,
95: 'rate' => $rate,
96: ));
97:
98: $this->addColumn('offline_refunded', array(
99: 'header' => Mage::helper('sales')->__('Offline Refunded'),
100: 'type' => 'currency',
101: 'currency_code' => $currencyCode,
102: 'index' => 'offline_refunded',
103: 'total' => 'sum',
104: 'sortable' => false,
105: 'rate' => $rate,
106: ));
107:
108: $this->addExportType('*/*/exportRefundedCsv', Mage::helper('adminhtml')->__('CSV'));
109: $this->addExportType('*/*/exportRefundedExcel', Mage::helper('adminhtml')->__('Excel XML'));
110:
111: return parent::_prepareColumns();
112: }
113: }
114: