Spamworldpro Mini Shell
Spamworldpro


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/redchamps/module-total-adjustment/Model/Sales/Pdf/Total/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/redchamps/module-total-adjustment/Model/Sales/Pdf/Total/Adjustment.php
<?php
/**
 * @author RedChamps Team
 * @copyright Copyright (c) RedChamps (https://redchamps.com/)
 * @package RedChamps_TotalAdjustment
 */
namespace RedChamps\TotalAdjustment\Model\Sales\Pdf\Total;

use Magento\Sales\Model\Order\Pdf\Total\DefaultTotal;
use Magento\Tax\Helper\Data;
use Magento\Tax\Model\Calculation;
use Magento\Tax\Model\ResourceModel\Sales\Order\Tax\CollectionFactory;
use RedChamps\TotalAdjustment\Model\AdjustmentManager;

class Adjustment extends DefaultTotal
{
    /**
     * @var AdjustmentManager
     */
    private $adjustmentManager;

    public function __construct(
        AdjustmentManager $adjustmentManager,
        Data $taxHelper,
        Calculation $taxCalculation,
        CollectionFactory $ordersFactory,
        array $data = []
    ) {
        parent::__construct($taxHelper, $taxCalculation, $ordersFactory, $data);
        $this->adjustmentManager = $adjustmentManager;
    }

    public function getTotalsForDisplay()
    {
        $adjustments = $this->getSource()->getAdjustments();
        $totals = [];
        if ($adjustments) {
            $adjustments = $this->adjustmentManager->decodeAdjustments($adjustments);
            foreach ($adjustments as $adjustment) {
                $amount = $this->getOrder()->formatPriceTxt($adjustment["amount"]);
                if ($this->getAmountPrefix()) {
                    $amount = $this->getAmountPrefix() . $amount;
                }
                $title = __($adjustment["title"]);
                if ($this->getTitleSourceField()) {
                    $label = $title . ' (' . $this->getTitleDescription() . '):';
                } else {
                    $label = $title . ':';
                }

                $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
                $totals[] = [
                    'amount'    => $amount,
                    'label'     => $label,
                    'font_size' => $fontSize
                ];
            }
        }
        return $totals;
    }
}

Spamworldpro Mini