Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Subtotal.php
Go to the documentation of this file.
1 <?php
7 
8 class Subtotal extends \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal
9 {
21  public function getTotalsForDisplay()
22  {
23  $store = $this->getOrder()->getStore();
25  $amount = $this->getOrder()->formatPriceTxt($this->getAmount());
26  if ($this->getSource()->getSubtotalInclTax()) {
27  $amountInclTax = $this->getSource()->getSubtotalInclTax();
28  } else {
29  $amountInclTax = $this->getAmount() +
30  $this->getSource()->getTaxAmount() -
31  $this->getSource()->getShippingTaxAmount();
32  }
33 
34  $amountInclTax = $this->getOrder()->formatPriceTxt($amountInclTax);
35  $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
36 
37  if ($helper->displaySalesSubtotalBoth($store)) {
38  $totals = [
39  [
40  'amount' => $this->getAmountPrefix() . $amount,
41  'label' => __('Subtotal (Excl. Tax)') . ':',
42  'font_size' => $fontSize,
43  ],
44  [
45  'amount' => $this->getAmountPrefix() . $amountInclTax,
46  'label' => __('Subtotal (Incl. Tax)') . ':',
47  'font_size' => $fontSize
48  ],
49  ];
50  } elseif ($helper->displaySalesSubtotalInclTax($store)) {
51  $totals = [
52  [
53  'amount' => $this->getAmountPrefix() . $amountInclTax,
54  'label' => __($this->getTitle()) . ':',
55  'font_size' => $fontSize,
56  ],
57  ];
58  } else {
59  $totals = [
60  [
61  'amount' => $this->getAmountPrefix() . $amount,
62  'label' => __($this->getTitle()) . ':',
63  'font_size' => $fontSize,
64  ],
65  ];
66  }
67 
68  return $totals;
69  }
70 }
$helper
Definition: iframe.phtml:13
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
__()
Definition: __.php:13
$amount
Definition: order.php:14
$totals
Definition: totalbar.phtml:10