64 lines
2.2 KiB
PHP
64 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace Stemcell\Sales\Block\Adminhtml\Order;
|
|
|
|
use Magento\Framework\DataObject;
|
|
|
|
class Totals extends \Magento\Sales\Block\Adminhtml\Order\Totals
|
|
{
|
|
protected function _initTotals()
|
|
{
|
|
\Magento\Sales\Block\Adminhtml\Totals::_initTotals();
|
|
$this->_totals['paid'] = new \Magento\Framework\DataObject(
|
|
[
|
|
'code' => 'paid',
|
|
'strong' => true,
|
|
'value' => $this->getSource()->getTotalPaid(),
|
|
'base_value' => $this->getSource()->getBaseTotalPaid(),
|
|
'label' => __('Total Paid'),
|
|
'area' => 'footer',
|
|
]
|
|
);
|
|
$this->_totals['refunded'] = new \Magento\Framework\DataObject(
|
|
[
|
|
'code' => 'refunded',
|
|
'strong' => true,
|
|
'value' => $this->getSource()->getTotalRefunded(),
|
|
'base_value' => $this->getSource()->getBaseTotalRefunded(),
|
|
'label' => __('Total Refunded'),
|
|
'area' => 'footer',
|
|
]
|
|
);
|
|
$this->_totals['customer_discount_amount'] = new DataObject(
|
|
[
|
|
'code' => 'customer_discount_amount',
|
|
'strong' => true,
|
|
'value' => '¥'.number_format($this->getSource()->getData('customer_discount'), 2, '.', ''),
|
|
'label' => __('优惠金额'),
|
|
'area' => 'footer',
|
|
]
|
|
);
|
|
$code = 'due';
|
|
$label = 'Total Due';
|
|
$value = $this->getSource()->getTotalDue();
|
|
$baseValue = $this->getSource()->getBaseTotalDue();
|
|
if ($this->getSource()->getTotalCanceled() > 0 && $this->getSource()->getBaseTotalCanceled() > 0) {
|
|
$code = 'canceled';
|
|
$label = 'Total Canceled';
|
|
$value = $this->getSource()->getTotalCanceled();
|
|
$baseValue = $this->getSource()->getBaseTotalCanceled();
|
|
}
|
|
$this->_totals[$code] = new \Magento\Framework\DataObject(
|
|
[
|
|
'code' => 'due',
|
|
'strong' => true,
|
|
'value' => $value,
|
|
'base_value' => $baseValue,
|
|
'label' => __($label),
|
|
'area' => 'footer',
|
|
]
|
|
);
|
|
return $this;
|
|
}
|
|
}
|