00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Report_Customer_Orders_Grid extends Mage_Adminhtml_Block_Report_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('gridOrdersCustomer');
00041 }
00042
00043 protected function _prepareCollection()
00044 {
00045 parent::_prepareCollection();
00046 $this->getCollection()->initReport('reports/customer_orders_collection');
00047 }
00048
00049 protected function _prepareColumns()
00050 {
00051 $this->addColumn('name', array(
00052 'header' => $this->__('Customer Name'),
00053 'sortable' => false,
00054 'index' => 'name'
00055 ));
00056
00057 $this->addColumn('orders_count', array(
00058 'header' => $this->__('Number of Orders'),
00059 'width' => '100px',
00060 'sortable' => false,
00061 'index' => 'orders_count',
00062 'total' => 'sum',
00063 'type' => 'number'
00064 ));
00065
00066 $baseCurrencyCode = $this->getCurrentCurrencyCode();
00067
00068 $this->addColumn('orders_avg_amount', array(
00069 'header' => $this->__('Average Order Amount'),
00070 'width' => '200px',
00071 'align' => 'right',
00072 'sortable' => false,
00073 'type' => 'currency',
00074 'currency_code' => $baseCurrencyCode,
00075 'index' => 'orders_avg_amount',
00076 'total' => 'orders_sum_amount/orders_count',
00077 'renderer' =>'adminhtml/report_grid_column_renderer_currency'
00078 ));
00079
00080 $this->addColumn('orders_sum_amount', array(
00081 'header' => $this->__('Total Order Amount'),
00082 'width' => '200px',
00083 'align' => 'right',
00084 'sortable' => false,
00085 'type' => 'currency',
00086 'currency_code' => $baseCurrencyCode,
00087 'index' => 'orders_sum_amount',
00088 'total' => 'sum',
00089 'renderer' => 'adminhtml/report_grid_column_renderer_currency',
00090 ));
00091
00092 $this->addExportType('*/*/exportOrdersCsv', Mage::helper('reports')->__('CSV'));
00093 $this->addExportType('*/*/exportOrdersExcel', Mage::helper('reports')->__('Excel'));
00094
00095 return parent::_prepareColumns();
00096 }
00097
00098 }