![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-tax/Model/Sales/Pdf/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Tax\Model\Sales\Pdf; class Grandtotal extends \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal { /** * @var \Magento\Tax\Model\Config */ protected $_taxConfig; /** * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Tax\Model\ResourceModel\Sales\Order\Tax\CollectionFactory $ordersFactory * @param \Magento\Tax\Model\Config $taxConfig * @param array $data */ public function __construct( \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Tax\Model\ResourceModel\Sales\Order\Tax\CollectionFactory $ordersFactory, \Magento\Tax\Model\Config $taxConfig, array $data = [] ) { $this->_taxConfig = $taxConfig; parent::__construct($taxHelper, $taxCalculation, $ordersFactory, $data); } /** * 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; } }