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_Sales_Order_Abstract extends Mage_Adminhtml_Block_Widget
00035 {
00036
00037
00038
00039
00040
00041 public function getOrder()
00042 {
00043 if ($this->hasOrder()) {
00044 return $this->getData('order');
00045 }
00046 if (Mage::registry('current_order')) {
00047 return Mage::registry('current_order');
00048 }
00049 if (Mage::registry('order')) {
00050 return Mage::registry('order');
00051 }
00052 Mage::throwException(Mage::helper('sales')->__('Can\'t get order instance'));
00053 }
00054
00055 public function getPriceDataObject()
00056 {
00057 $obj = $this->getData('price_data_object');
00058 if (is_null($obj)) {
00059 return $this->getOrder();
00060 }
00061 return $obj;
00062 }
00063
00064 public function displayPriceAttribute($code, $strong = false, $separator = '<br/>')
00065 {
00066 return $this->displayPrices(
00067 $this->getPriceDataObject()->getData('base_'.$code),
00068 $this->getPriceDataObject()->getData($code),
00069 $strong,
00070 $separator
00071 );
00072 }
00073
00074 public function displayPrices($basePrice, $price, $strong = false, $separator = '<br/>')
00075 {
00076 if ($this->getOrder()->isCurrencyDifferent()) {
00077 $res = '<strong>';
00078 $res.= $this->getOrder()->formatBasePrice($basePrice);
00079 $res.= '</strong>'.$separator;
00080 $res.= '['.$this->getOrder()->formatPrice($price).']';
00081 }
00082 else {
00083 $res = $this->getOrder()->formatPrice($price);
00084 if ($strong) {
00085 $res = '<strong>'.$res.'</strong>';
00086 }
00087 }
00088 return $res;
00089 }
00090
00091
00092
00093
00094
00095
00096 public function getOrderTotalData()
00097 {
00098 return array();
00099 }
00100
00101
00102
00103
00104
00105
00106 public function getOrderInfoData()
00107 {
00108 return array();
00109 }
00110
00111
00112
00113
00114
00115
00116
00117
00118 public function displayShippingPriceInclTax($order)
00119 {
00120 $baseTax = $order->getBaseShippingTaxAmount();
00121 $tax = $order->getShippingTaxAmount();
00122
00123 return $this->displayPrices(
00124 $order->getBaseShippingAmount()+$baseTax,
00125 $order->getShippingAmount()+$tax,
00126 false,
00127 ' '
00128 );
00129 }
00130 }