Example #1
0
 /**
  * Initialize all order totals relates with tax
  *
  * @return \Magento\Tax\Block\Sales\Order\Tax
  */
 public function initTotals()
 {
     /** @var $parent \Magento\Sales\Block\Adminhtml\Order\Invoice\Totals */
     $parent = $this->getParentBlock();
     $this->_order = $parent->getOrder();
     $this->_source = $parent->getSource();
     $store = $this->getStore();
     $allowTax = $this->_source->getTaxAmount() > 0 || $this->_config->displaySalesZeroTax($store);
     $grandTotal = (double) $this->_source->getGrandTotal();
     if (!$grandTotal || $allowTax && !$this->_config->displaySalesTaxWithGrandTotal($store)) {
         $this->_addTax();
     }
     $this->_initSubtotal();
     $this->_initShipping();
     $this->_initDiscount();
     $this->_initGrandTotal();
     return $this;
 }