Mage_Adminhtml_Block_Sales_Order_Invoice_View Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_Invoice_View:

Mage_Adminhtml_Block_Widget_Form_Container Mage_Adminhtml_Block_Widget_Container Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getInvoice ()
 getHeaderText ()
 getBackUrl ()
 getCaptureUrl ()
 getVoidUrl ()
 getCancelUrl ()
 getCreditMemoUrl ()
 getPrintUrl ()
 updateBackButtonUrl ($flag)


Detailed Description

Definition at line 34 of file View.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 Mage_Adminhtml_Block_Widget_Form_Container.

Definition at line 36 of file View.php.

00037     {
00038         $this->_objectId    = 'invoice_id';
00039         $this->_controller  = 'sales_order_invoice';
00040         $this->_mode        = 'view';
00041 
00042         parent::__construct();
00043 
00044         $this->_removeButton('save');
00045         $this->_removeButton('reset');
00046         $this->_removeButton('delete');
00047 
00048         if ($this->getInvoice()->canCancel()) {
00049             $this->_addButton('cancel', array(
00050                 'label'     => Mage::helper('sales')->__('Cancel'),
00051                 'class'     => 'delete',
00052                 'onclick'   => 'setLocation(\''.$this->getCancelUrl().'\')'
00053                 )
00054             );
00055         }
00056 
00057         if ($this->getInvoice()->getOrder()->canCreditmemo()) {
00058             if ($this->getInvoice()->getOrder()->getPayment()->canRefundPartialPerInvoice()
00059                 || !$this->getInvoice()->getIsUsedForRefund())
00060             {
00061                 $this->_addButton('capture', array(
00062                     'label'     => Mage::helper('sales')->__('Credit Memo'),
00063                     'class'     => 'save',
00064                     'onclick'   => 'setLocation(\''.$this->getCreditMemoUrl().'\')'
00065                     )
00066                 );
00067             }
00068         }
00069 
00070         if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/capture')
00071             && $this->getInvoice()->canCapture()) {
00072             $this->_addButton('capture', array(
00073                 'label'     => Mage::helper('sales')->__('Capture'),
00074                 'class'     => 'save',
00075                 'onclick'   => 'setLocation(\''.$this->getCaptureUrl().'\')'
00076                 )
00077             );
00078         }
00079 
00080         if ($this->getInvoice()->canVoid()) {
00081             $this->_addButton('void', array(
00082                 'label'     => Mage::helper('sales')->__('Void'),
00083                 'class'     => 'save',
00084                 'onclick'   => 'setLocation(\''.$this->getVoidUrl().'\')'
00085                 )
00086             );
00087         }
00088 
00089         if ($this->getInvoice()->getId()) {
00090             $this->_addButton('print', array(
00091                 'label'     => Mage::helper('sales')->__('Print'),
00092                 'class'     => 'save',
00093                 'onclick'   => 'setLocation(\''.$this->getPrintUrl().'\')'
00094                 )
00095             );
00096         }
00097     }


Member Function Documentation

getBackUrl (  ) 

Get URL for back (reset) button

Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Form_Container.

Definition at line 131 of file View.php.

00132     {
00133         return $this->getUrl(
00134             '*/sales_order/view',
00135             array(
00136                 'order_id'  => $this->getInvoice()->getOrderId(),
00137                 'active_tab'=> 'order_invoices'
00138             ));
00139     }

getCancelUrl (  ) 

Definition at line 151 of file View.php.

00152     {
00153         return $this->getUrl('*/*/cancel', array('invoice_id'=>$this->getInvoice()->getId()));
00154     }

getCaptureUrl (  ) 

Definition at line 141 of file View.php.

00142     {
00143         return $this->getUrl('*/*/capture', array('invoice_id'=>$this->getInvoice()->getId()));
00144     }

getCreditMemoUrl (  ) 

Definition at line 156 of file View.php.

00157     {
00158         return $this->getUrl('*/sales_order_creditmemo/start', array(
00159             'order_id'  => $this->getInvoice()->getOrder()->getId(),
00160             'invoice_id'=> $this->getInvoice()->getId(),
00161         ));
00162     }

getHeaderText (  ) 

Get header text

Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Container.

Definition at line 109 of file View.php.

00110     {
00111         if ($this->getInvoice()->getEmailSent()) {
00112             $emailSent = Mage::helper('sales')->__('Invoice email sent');
00113         }
00114         else {
00115             $emailSent = Mage::helper('sales')->__('Invoice email not sent');
00116         }
00117 
00118         $header = Mage::helper('sales')->__('Invoice #%s | %s (%s)',
00119             $this->getInvoice()->getIncrementId(),
00120             $this->getInvoice()->getStateName(),
00121             $emailSent
00122         );
00123         /*$header = Mage::helper('sales')->__('Invoice #%s | Order Date: %s | Customer Name: %s',
00124             $this->getInvoice()->getIncrementId(),
00125             $this->formatDate($this->getInvoice()->getOrder()->getCreatedAt(), 'medium', true),
00126             $this->getInvoice()->getOrder()->getCustomerName()
00127         );*/
00128         return $header;
00129     }

getInvoice (  ) 

Retrieve invoice model instance

Returns:
Mage_Sales_Model_Order_Invoice

Definition at line 104 of file View.php.

00105     {
00106         return Mage::registry('current_invoice');
00107     }

getPrintUrl (  ) 

Definition at line 164 of file View.php.

00165     {
00166         return $this->getUrl('*/*/print', array(
00167             'invoice_id' => $this->getInvoice()->getId()
00168         ));
00169     }

getVoidUrl (  ) 

Definition at line 146 of file View.php.

00147     {
00148         return $this->getUrl('*/*/void', array('invoice_id'=>$this->getInvoice()->getId()));
00149     }

updateBackButtonUrl ( flag  ) 

Definition at line 171 of file View.php.

00172     {
00173         if ($flag) {
00174             return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/sales_invoice/') . '\')');
00175         }
00176         return $this;
00177     }


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

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