/** * Check if tax amount should be included to grandtotal block * array( * $index => array( * 'amount' => $amount, * 'label' => $label, * 'font_size'=> $font_size * ) * ) * @return array */ public function getTotalsForDisplay() { $store = $this->getOrder()->getStore(); if ($this->_taxConfig->displaySalesTaxWithGrandTotal($store)) { return []; } $totals = []; if ($this->_taxConfig->displaySalesFullSummary($store)) { $totals = $this->getFullTaxInfo(); } $totals = array_merge($totals, parent::getTotalsForDisplay()); return $totals; }
/** * Check if tax amount should be included to grandtotals block * array( * $index => array( * 'amount' => $amount, * 'label' => $label, * 'font_size'=> $font_size * ) * ) * @return array */ public function getTotalsForDisplay() { $store = $this->getOrder()->getStore(); if (!$this->_taxConfig->displaySalesTaxWithGrandTotal($store)) { return parent::getTotalsForDisplay(); } $amount = $this->getOrder()->formatPriceTxt($this->getAmount()); $amountExclTax = $this->getAmount() - $this->getSource()->getTaxAmount(); $amountExclTax = $amountExclTax > 0 ? $amountExclTax : 0; $amountExclTax = $this->getOrder()->formatPriceTxt($amountExclTax); $tax = $this->getOrder()->formatPriceTxt($this->getSource()->getTaxAmount()); $fontSize = $this->getFontSize() ? $this->getFontSize() : 7; $totals = [['amount' => $this->getAmountPrefix() . $amountExclTax, 'label' => __('Grand Total (Excl. Tax)') . ':', 'font_size' => $fontSize]]; if ($this->_taxConfig->displaySalesFullSummary($store)) { $totals = array_merge($totals, $this->getFullTaxInfo()); } $totals[] = ['amount' => $this->getAmountPrefix() . $tax, 'label' => __('Tax') . ':', 'font_size' => $fontSize]; $totals[] = ['amount' => $this->getAmountPrefix() . $amount, 'label' => __('Grand Total (Incl. Tax)') . ':', 'font_size' => $fontSize]; return $totals; }
/** * Check if we nedd display full tax total info * * @return bool */ public function displayFullSummary() { return $this->_config->displaySalesFullSummary($this->getOrder()->getStore()); }