Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

Undefined variable: logo on Print Template

Leonardo Gomes   ( User )

Commented 3 years ago

Hello,

I am trying to create a custom print template copying from the default template. However, When i put the

I am checking the controller "Sales\Invoices" and i don't see nowhere this variable is defined. However, if i activate the default template it works and if i activate my custom it doesn't.

Follow my custom blade file:

@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('content')










FACTURE N° 2020/005


@stack('invoiced_at_input_start')
Date Facturation: @date($invoice->invoiced_at)
@stack('invoiced_at_input_end')
@stack('due_at_input_start')

Date d'écheance: @date($invoice->due_at)


@stack('due_at_input_end')






{{ setting('company.name') }}

{!! nl2br(setting('company.address')) !!}


@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif



@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif


{{ setting('company.email') }}





@stack('name_input_start')
{{ $invoice->contact_name }}

@stack('name_input_end')
@stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}

@stack('address_input_end')
@stack('tax_number_input_start')

@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
@endif


@stack('tax_number_input_end')
@stack('phone_input_start')

@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif


@stack('phone_input_end')
@stack('email_start')
{{ $invoice->contact_email }}
@stack('email_input_end')







@stack('name_th_start')

@stack('name_th_end')

@stack('quantity_th_start')

@stack('quantity_th_end')


@stack('price_th_start')

@stack('price_th_end')

@stack('total_th_start')

@stack('total_th_end')



@foreach($invoice->items as $item)
@include('partials.documents.item.print', ['document' => $invoice])
@endforeach

{{ trans_choice($text_override['items'], 2) }} {{ trans($text_override['quantity']) }} Unité {{ trans($text_override['price']) }} {{ trans('invoices.total') }}




@stack('notes_input_start')
@if ($invoice->notes)
{{ trans_choice('general.notes', 2) }}


{!! nl2br($invoice->notes) !!}
@endif
@stack('notes_input_end')




@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')




@stack($total->code . '_total_tr_end')
@else
@if ($invoice->paid)
@stack('paid_total_tr_start')




@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')




@stack('grand_total_tr_end')
@endif
@endforeach

{{ trans($total->title) }}: @money($total->amount, $invoice->currency_code, true)
{{ trans('invoices.paid') }}: - @money($invoice->paid, $invoice->currency_code, true)
{{ trans($total->name) }}: @money($total->amount - $invoice->paid, $invoice->currency_code, true)



@if ($invoice->footer)

{!! nl2br($invoice->footer) !!}

@endif
@endsection

Thank if someone can hep!

Leonardo Gomes   ( User )

Commented 3 years ago

In case someone has the same Issue. The " $logo " variable is defined by a viewComposer.

On App\Providers\ViewComposer.php, You have a view::Composer([]) and you have to add your new view there.

:D

Please login or register to leave a response.

Showing 1 to 2 of 2 discussions