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 class Mage_Adminhtml_Block_Tax_Rate_Grid extends Mage_Adminhtml_Block_Widget_Grid
00027 {
00028
00029 public function __construct()
00030 {
00031 parent::__construct();
00032 $this->setSaveParametersInSession(true);
00033 $this->setDefaultSort('region_name');
00034 $this->setDefaultDir('asc');
00035 }
00036
00037 protected function _prepareCollection()
00038 {
00039 $rateCollection = Mage::getModel('tax/calculation_rate')->getCollection()
00040 ->joinRegionTable();
00041
00042 $this->setCollection($rateCollection);
00043 return parent::_prepareCollection();
00044 }
00045
00046 protected function _prepareColumns()
00047 {
00048 $this->addColumn('code', array(
00049 'header' => Mage::helper('tax')->__('Tax Identifier'),
00050 'header_export' => Mage::helper('tax')->__('Code'),
00051 'align' =>'left',
00052 'index' => 'code',
00053 'filter_index' => 'main_table.code',
00054 ));
00055
00056 $this->addColumn('tax_country_id', array(
00057 'header' => Mage::helper('tax')->__('Country'),
00058 'type' => 'country',
00059 'align' => 'left',
00060 'index' => 'tax_country_id',
00061 'filter_index' => 'main_table.tax_country_id',
00062 'renderer' => 'adminhtml/tax_rate_grid_renderer_country',
00063 'sortable' => false
00064 ));
00065
00066 $this->addColumn('region_name', array(
00067 'header' => Mage::helper('tax')->__('State/Region'),
00068 'header_export' => Mage::helper('tax')->__('State'),
00069 'align' =>'left',
00070 'index' => 'region_name',
00071 'filter_index' => 'region_table.code',
00072 'default' => '*',
00073 ));
00074
00075 $this->addColumn('tax_postcode', array(
00076 'header' => Mage::helper('tax')->__('Zip/Post Code'),
00077 'align' =>'left',
00078 'index' => 'tax_postcode',
00079 'default' => '*',
00080 ));
00081
00082 $this->addColumn('rate', array(
00083 'header' => Mage::helper('tax')->__('Rate'),
00084 'align' =>'right',
00085 'index' => 'rate',
00086 'type' => 'number',
00087 'default' => '0.00',
00088 'renderer' => 'adminhtml/tax_rate_grid_renderer_data',
00089 ));
00090
00091 $this->addExportType('*/*/exportCsv', Mage::helper('tax')->__('CSV'));
00092 $this->addExportType('*/*/exportXml', Mage::helper('tax')->__('XML'));
00093
00094 return parent::_prepareColumns();
00095 }
00096
00097 public function getRowUrl($row)
00098 {
00099 return $this->getUrl('*/*/edit', array('rate' => $row->getTaxCalculationRateId()));
00100 }
00101
00102 }
00103