Mage_Adminhtml_Block_Sales_Order_View_Tab_Invoices Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_View_Tab_Invoices:

Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget_Tab_Interface Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getOrder ()
 getRowUrl ($row)
 getGridUrl ()
 getTabLabel ()
 getTabTitle ()
 canShowTab ()
 isHidden ()

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()


Detailed Description

Definition at line 34 of file Invoices.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 38 of file Invoices.php.

00039     {
00040         parent::__construct();
00041         $this->setId('order_invoices_grid');
00042         $this->setUseAjax(true);
00043     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 45 of file Invoices.php.

00046     {
00047         //TODO: add full name logic
00048         $collection = Mage::getResourceModel('sales/order_invoice_collection')
00049             ->addAttributeToSelect('order_id')
00050             ->addAttributeToSelect('increment_id')
00051             ->addAttributeToSelect('created_at')
00052             ->addAttributeToSelect('state')
00053             ->addAttributeToSelect('grand_total')
00054             ->addAttributeToSelect('base_grand_total')
00055             ->addAttributeToSelect('store_currency_code')
00056             ->addAttributeToSelect('base_currency_code')
00057             ->addAttributeToSelect('order_currency_code')
00058             ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')
00059             ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')
00060             ->addExpressionAttributeToSelect('billing_name',
00061                 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})',
00062                 array('billing_firstname', 'billing_lastname'))
00063             ->setOrderFilter($this->getOrder())
00064         ;
00065         $this->setCollection($collection);
00066         return parent::_prepareCollection();
00067     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 69 of file Invoices.php.

00070     {
00071         $this->addColumn('increment_id', array(
00072             'header'    => Mage::helper('sales')->__('Invoice #'),
00073             'index'     => 'increment_id',
00074             'width'     => '120px',
00075         ));
00076 
00077         $this->addColumn('billing_name', array(
00078             'header' => Mage::helper('sales')->__('Bill to Name'),
00079             'index' => 'billing_name',
00080         ));
00081 
00082         $this->addColumn('created_at', array(
00083             'header'    => Mage::helper('sales')->__('Invoice Date'),
00084             'index'     => 'created_at',
00085             'type'      => 'datetime',
00086         ));
00087 
00088         $this->addColumn('state', array(
00089             'header'    => Mage::helper('sales')->__('Status'),
00090             'index'     => 'state',
00091             'type'      => 'options',
00092             'options'   => Mage::getModel('sales/order_invoice')->getStates(),
00093         ));
00094 
00095         $this->addColumn('base_grand_total', array(
00096             'header'    => Mage::helper('customer')->__('Amount'),
00097             'index'     => 'base_grand_total',
00098             'type'      => 'currency',
00099             'currency'  => 'base_currency_code',
00100         ));
00101 
00102         return parent::_prepareColumns();
00103     }

canShowTab (  ) 

Implements Mage_Adminhtml_Block_Widget_Tab_Interface.

Definition at line 144 of file Invoices.php.

00145     {
00146         return true;
00147     }

getGridUrl (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 125 of file Invoices.php.

00126     {
00127         return $this->getUrl('*/*/invoices', array('_current' => true));
00128     }

getOrder (  ) 

Retrieve order model instance

Returns:
Mage_Sales_Model_Order

Definition at line 110 of file Invoices.php.

00111     {
00112         return Mage::registry('current_order');
00113     }

getRowUrl ( row  ) 

Definition at line 115 of file Invoices.php.

00116     {
00117         return $this->getUrl('*/sales_order_invoice/view',
00118             array(
00119                 'invoice_id'=> $row->getId(),
00120                 'order_id'  => $row->getOrderId()
00121             )
00122         );
00123     }

getTabLabel (  ) 

######################## TAB settings #################################

Implements Mage_Adminhtml_Block_Widget_Tab_Interface.

Definition at line 134 of file Invoices.php.

00135     {
00136         return Mage::helper('sales')->__('Invoices');
00137     }

getTabTitle (  ) 

Implements Mage_Adminhtml_Block_Widget_Tab_Interface.

Definition at line 139 of file Invoices.php.

00140     {
00141         return Mage::helper('sales')->__('Order Invoices');
00142     }

isHidden (  ) 

Implements Mage_Adminhtml_Block_Widget_Tab_Interface.

Definition at line 149 of file Invoices.php.

00150     {
00151         return false;
00152     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:02 2009 for Magento by  doxygen 1.5.8