mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:37:34 -05:00 
			
		
		
		
	Merge pull request #4057 from beganovich/v2-show-fees-on-pdfs
Show taxes/fees on bottom of PDFs
This commit is contained in:
		
						commit
						ce4b5098fc
					
				@ -14,6 +14,7 @@ namespace App\Services\PdfMaker;
 | 
			
		||||
 | 
			
		||||
use App\Services\PdfMaker\Designs\Utilities\BaseDesign;
 | 
			
		||||
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
 | 
			
		||||
use App\Utils\Number;
 | 
			
		||||
use App\Utils\Traits\MakesInvoiceValues;
 | 
			
		||||
use Illuminate\Support\Str;
 | 
			
		||||
 | 
			
		||||
@ -24,6 +25,9 @@ class Design extends BaseDesign
 | 
			
		||||
    /** @var App\Models\Invoice || @var App\Models\Quote */
 | 
			
		||||
    public $entity;
 | 
			
		||||
 | 
			
		||||
    /** @var App\Models\Client */
 | 
			
		||||
    public $client;
 | 
			
		||||
 | 
			
		||||
    /** Global state of the design, @var array */
 | 
			
		||||
    public $context;
 | 
			
		||||
 | 
			
		||||
@ -243,15 +247,41 @@ class Design extends BaseDesign
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($variables as $variable) {
 | 
			
		||||
            if ($variable == '$total_taxes' || $variable == '$line_taxes') {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            if ($variable == '$total_taxes') {
 | 
			
		||||
                $taxes = $this->entity->calc()->getTotalTaxMap();
 | 
			
		||||
 | 
			
		||||
            $elements[] = ['element' => 'div', 'elements' => [
 | 
			
		||||
                ['element' => 'span', 'content' => 'This is placeholder for the 3rd fraction of element.', 'properties' => ['style' => 'opacity: 0%']], // Placeholder for fraction of element (3fr)
 | 
			
		||||
                ['element' => 'span', 'content' => $variable . '_label'],
 | 
			
		||||
                ['element' => 'span', 'content' => $variable],
 | 
			
		||||
            ]];
 | 
			
		||||
                if (!$taxes) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                foreach ($taxes as $tax) {
 | 
			
		||||
                    $elements[] = ['element' => 'div', 'elements' => [
 | 
			
		||||
                        ['element' => 'span', 'content' => 'This is placeholder for the 3rd fraction of element.', 'properties' => ['style' => 'opacity: 0%']], // Placeholder for fraction of element (3fr)
 | 
			
		||||
                        ['element' => 'span', 'content', 'content' => $tax['name']],
 | 
			
		||||
                        ['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client'])],
 | 
			
		||||
                    ]];
 | 
			
		||||
                }
 | 
			
		||||
            } elseif ($variable == '$line_taxes') {
 | 
			
		||||
                $taxes = $this->entity->calc()->getTaxMap();
 | 
			
		||||
 | 
			
		||||
                if (!$taxes) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                foreach ($taxes as $tax) {
 | 
			
		||||
                    $elements[] = ['element' => 'div', 'elements' => [
 | 
			
		||||
                        ['element' => 'span', 'content' => 'This is placeholder for the 3rd fraction of element.', 'properties' => ['style' => 'opacity: 0%']], // Placeholder for fraction of element (3fr)
 | 
			
		||||
                        ['element' => 'span', 'content', 'content' => $tax['name']],
 | 
			
		||||
                        ['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client'])],
 | 
			
		||||
                    ]];
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                $elements[] = ['element' => 'div', 'elements' => [
 | 
			
		||||
                    ['element' => 'span', 'content' => 'This is placeholder for the 3rd fraction of element.', 'properties' => ['style' => 'opacity: 0%']], // Placeholder for fraction of element (3fr)
 | 
			
		||||
                    ['element' => 'span', 'content' => $variable . '_label'],
 | 
			
		||||
                    ['element' => 'span', 'content' => $variable],
 | 
			
		||||
                ]];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $elements;
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
@ -108,10 +109,11 @@ class HtmlEngine
 | 
			
		||||
        $data['$invoice.due_date'] = &$data['$due_date'];
 | 
			
		||||
        $data['$invoice.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
 | 
			
		||||
        $data['$invoice.po_number'] = ['value' => $this->entity->po_number ?: ' ', 'label' => ctrans('texts.po_number')];
 | 
			
		||||
        $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')];
 | 
			
		||||
        $data['$invoice.line_taxes'] = &$data['$line_taxes'];
 | 
			
		||||
        $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')];
 | 
			
		||||
        $data['$invoice.total_taxes'] = &$data['$total_taxes'];
 | 
			
		||||
        // $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')];
 | 
			
		||||
        // $data['$invoice.line_taxes'] = &$data['$line_taxes'];
 | 
			
		||||
        
 | 
			
		||||
        // $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')];
 | 
			
		||||
        // $data['$invoice.total_taxes'] = &$data['$total_taxes'];
 | 
			
		||||
 | 
			
		||||
        if ($this->entity_string == 'invoice') {
 | 
			
		||||
            $data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user