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_Shipping_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: $this->setCountSubTotals(true);
43: }
44:
45: public function getResourceCollectionName()
46: {
47: return ($this->getFilterData()->getData('report_type') == 'created_at_shipment')
48: ? 'sales/report_shipping_collection_shipment'
49: : 'sales/report_shipping_collection_order';
50: }
51:
52: protected function _prepareColumns()
53: {
54: $this->addColumn('period', array(
55: 'header' => Mage::helper('sales')->__('Period'),
56: 'index' => 'period',
57: 'width' => 100,
58: 'sortable' => false,
59: 'period_type' => $this->getPeriodType(),
60: 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date',
61: 'totals_label' => Mage::helper('sales')->__('Total'),
62: 'subtotals_label' => Mage::helper('sales')->__('Subtotal'),
63: 'html_decorators' => array('nobr'),
64: ));
65:
66: $this->addColumn('shipping_description', array(
67: 'header' => Mage::helper('sales')->__('Carrier/Method'),
68: 'index' => 'shipping_description',
69: 'sortable' => false
70: ));
71:
72: $this->addColumn('orders_count', array(
73: 'header' => Mage::helper('sales')->__('Number of Orders'),
74: 'index' => 'orders_count',
75: 'total' => 'sum',
76: 'type' => 'number',
77: 'width' => 100,
78: 'sortable' => false
79: ));
80:
81: if ($this->getFilterData()->getStoreIds()) {
82: $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
83: }
84:
85: $currencyCode = $this->getCurrentCurrencyCode();
86: $rate = $this->getRate($currencyCode);
87:
88: $this->addColumn('total_shipping', array(
89: 'header' => Mage::helper('sales')->__('Total Sales Shipping'),
90: 'type' => 'currency',
91: 'currency_code' => $currencyCode,
92: 'index' => 'total_shipping',
93: 'total' => 'sum',
94: 'sortable' => false,
95: 'rate' => $rate,
96: ));
97:
98: $this->addColumn('total_shipping_actual', array(
99: 'header' => Mage::helper('sales')->__('Total Shipping'),
100: 'type' => 'currency',
101: 'currency_code' => $currencyCode,
102: 'index' => 'total_shipping_actual',
103: 'total' => 'sum',
104: 'sortable' => false,
105: 'rate' => $rate,
106: ));
107:
108: $this->addExportType('*/*/exportShippingCsv', Mage::helper('adminhtml')->__('CSV'));
109: $this->addExportType('*/*/exportShippingExcel', Mage::helper('adminhtml')->__('Excel XML'));
110:
111: return parent::_prepareColumns();
112: }
113: }
114:
115:
116:
117: