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_Invoiced_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_invoice')
47: ? 'sales/report_invoiced_collection_invoiced'
48: : 'sales/report_invoiced_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 Orders'),
66: 'index' => 'orders_count',
67: 'type' => 'number',
68: 'total' => 'sum',
69: 'sortable' => false
70: ));
71:
72: $this->addColumn('orders_invoiced', array(
73: 'header' => Mage::helper('sales')->__('Number of Invoiced Orders'),
74: 'index' => 'orders_invoiced',
75: 'type' => 'number',
76: 'total' => 'sum',
77: 'sortable' => false
78: ));
79:
80: if ($this->getFilterData()->getStoreIds()) {
81: $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
82: }
83: $currencyCode = $this->getCurrentCurrencyCode();
84: $rate = $this->getRate($currencyCode);
85:
86: $this->addColumn('invoiced', array(
87: 'header' => Mage::helper('sales')->__('Total Invoiced'),
88: 'type' => 'currency',
89: 'currency_code' => $currencyCode,
90: 'index' => 'invoiced',
91: 'total' => 'sum',
92: 'sortable' => false,
93: 'rate' => $rate,
94: ));
95:
96: $this->addColumn('invoiced_captured', array(
97: 'header' => Mage::helper('sales')->__('Total Invoiced Paid'),
98: 'type' => 'currency',
99: 'currency_code' => $currencyCode,
100: 'index' => 'invoiced_captured',
101: 'total' => 'sum',
102: 'sortable' => false,
103: 'rate' => $rate,
104: ));
105:
106: $this->addColumn('invoiced_not_captured', array(
107: 'header' => Mage::helper('sales')->__('Total Invoiced not Paid'),
108: 'type' => 'currency',
109: 'currency_code' => $currencyCode,
110: 'index' => 'invoiced_not_captured',
111: 'total' => 'sum',
112: 'sortable' => false,
113: 'rate' => $rate,
114: ));
115:
116: $this->addExportType('*/*/exportInvoicedCsv', Mage::helper('adminhtml')->__('CSV'));
117: $this->addExportType('*/*/exportInvoicedExcel', Mage::helper('adminhtml')->__('Excel XML'));
118:
119: return parent::_prepareColumns();
120: }
121: }
122: