Mage_Adminhtml_Block_Sales_Order_Invoice_Create_Items Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_Invoice_Create_Items:

Mage_Adminhtml_Block_Sales_Items_Abstract Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getDisableSubmitButton ()
 getOrder ()
 getSource ()
 getInvoice ()
 getOrderTotalData ()
 getOrderTotalbarData ()
 formatPrice ($price)
 getUpdateButtonHtml ()
 getUpdateUrl ()
 canCreateShipment ()
 canEditQty ()
 canCapture ()
 canSendInvoiceEmail ()

Protected Member Functions

 _beforeToHtml ()

Protected Attributes

 $_disableSubmitButton = false


Detailed Description

Definition at line 35 of file Items.php.


Member Function Documentation

_beforeToHtml (  )  [protected]

Prepare child blocks

Returns:
Mage_Adminhtml_Block_Sales_Order_Invoice_Create_Items

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 44 of file Items.php.

00045     {
00046         $onclick = "submitAndReloadArea($('invoice_item_container'),'".$this->getUpdateUrl()."')";
00047         $this->setChild(
00048             'update_button',
00049             $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
00050                 'class'     => 'update-button',
00051                 'label'     => Mage::helper('sales')->__('Update Qty\'s'),
00052                 'onclick'   => $onclick,
00053             ))
00054         );
00055         $this->_disableSubmitButton = true;
00056         $_submitButtonClass = ' disabled';
00057         foreach ($this->getInvoice()->getAllItems() as $item) {
00058             if ($item->getQty() || $this->getSource()->getData('base_grand_total')) {
00059                 $this->_disableSubmitButton = false;
00060                 $_submitButtonClass = '';
00061                 break;
00062             }
00063         }
00064         $_submitLabel = $this->getOrder()->getForcedDoShipmentWithInvoice()?'Submit Invoice and Shipment':'Submit Invoice';
00065         $this->setChild(
00066             'submit_button',
00067             $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
00068                 'label'     => Mage::helper('sales')->__('%s', $_submitLabel),
00069                 'class'     => 'save submit-button' . $_submitButtonClass,
00070                 'onclick'   => '$(\'edit_form\').submit()',
00071                 'disabled'  => $this->_disableSubmitButton
00072             ))
00073         );
00074 
00075         return parent::_prepareLayout();
00076     }

canCapture (  ) 

Reimplemented from Mage_Adminhtml_Block_Sales_Items_Abstract.

Definition at line 184 of file Items.php.

00185     {
00186         if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/capture')) {
00187             return $this->getInvoice()->canCapture();
00188         }
00189         return false;
00190     }

canCreateShipment (  ) 

Check shipment availability for current invoice

Returns:
bool

Reimplemented from Mage_Adminhtml_Block_Sales_Items_Abstract.

Definition at line 166 of file Items.php.

00167     {
00168         foreach ($this->getInvoice()->getAllItems() as $item) {
00169             if ($item->getOrderItem()->getQtyToShip()) {
00170                 return true;
00171             }
00172         }
00173         return false;
00174     }

canEditQty (  ) 

Check availability to edit quantity of item

Returns:
boolean

Disable editing of quantity of item if creating of shipment forced and ship partially disabled for order

Reimplemented from Mage_Adminhtml_Block_Sales_Items_Abstract.

Definition at line 176 of file Items.php.

00177     {
00178         if ($this->getInvoice()->getOrder()->getPayment()->canCapture()) {
00179             return $this->getInvoice()->getOrder()->getPayment()->canCapturePartial();
00180         }
00181         return true;
00182     }

canSendInvoiceEmail (  ) 

Definition at line 192 of file Items.php.

00193     {
00194         return Mage::helper('sales')->canSendNewInvoiceEmail($this->getOrder()->getStore()->getId());
00195     }

formatPrice ( price  ) 

Reimplemented from Mage_Adminhtml_Block_Sales_Items_Abstract.

Definition at line 146 of file Items.php.

00147     {
00148         return $this->getInvoice()->getOrder()->formatPrice($price);
00149     }

getDisableSubmitButton (  ) 

Get is submit button disabled or not

Returns:
boolean

Definition at line 83 of file Items.php.

00084     {
00085         return $this->_disableSubmitButton;
00086     }

getInvoice (  ) 

Retrieve invoice model instance

Returns:
Mage_Sales_Model_Order_Invoice

Reimplemented from Mage_Adminhtml_Block_Sales_Items_Abstract.

Definition at line 113 of file Items.php.

00114     {
00115         return Mage::registry('current_invoice');
00116     }

getOrder (  ) 

Retrieve invoice order

Returns:
Mage_Sales_Model_Order

Reimplemented from Mage_Adminhtml_Block_Sales_Items_Abstract.

Definition at line 93 of file Items.php.

00094     {
00095         return $this->getInvoice()->getOrder();
00096     }

getOrderTotalbarData (  ) 

Retrieve order totalbar block data

Returns:
array

Definition at line 133 of file Items.php.

00134     {
00135         $totalbarData = array();
00136         $this->setPriceDataObject($this->getInvoice());
00137         $totalbarData[] = array(Mage::helper('sales')->__('Paid Amount'), $this->displayPriceAttribute('amount_paid'), false);
00138         $totalbarData[] = array(Mage::helper('sales')->__('Refund Amount'), $this->displayPriceAttribute('amount_refunded'), false);
00139         $totalbarData[] = array(Mage::helper('sales')->__('Shipping Amount'), $this->displayPriceAttribute('shipping_captured'), false);
00140         $totalbarData[] = array(Mage::helper('sales')->__('Shipping Refund'), $this->displayPriceAttribute('shipping_refunded'), false);
00141         $totalbarData[] = array(Mage::helper('sales')->__('Order Grand Total'), $this->displayPriceAttribute('grand_total'), true);
00142 
00143         return $totalbarData;
00144     }

getOrderTotalData (  ) 

Retrieve order totals block settings

Returns:
array

Definition at line 123 of file Items.php.

00124     {
00125         return array();
00126     }

getSource (  ) 

Retrieve source

Returns:
Mage_Sales_Model_Order_Invoice

Reimplemented from Mage_Adminhtml_Block_Sales_Items_Abstract.

Definition at line 103 of file Items.php.

00104     {
00105         return $this->getInvoice();
00106     }

getUpdateButtonHtml (  ) 

Definition at line 151 of file Items.php.

00152     {
00153         return $this->getChildHtml('update_button');
00154     }

getUpdateUrl (  ) 

Definition at line 156 of file Items.php.

00157     {
00158         return $this->getUrl('*/*/updateQty', array('order_id'=>$this->getInvoice()->getOrderId()));
00159     }


Member Data Documentation

$_disableSubmitButton = false [protected]

Definition at line 37 of file Items.php.


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