fixed #71
This commit is contained in:
parent
51eb9ed369
commit
e033739c09
@ -30,6 +30,8 @@ use App\Utilities\ImportFile;
|
|||||||
use App\Utilities\Modules;
|
use App\Utilities\Modules;
|
||||||
use Date;
|
use Date;
|
||||||
use File;
|
use File;
|
||||||
|
use Image;
|
||||||
|
use Storage;
|
||||||
|
|
||||||
class Invoices extends Controller
|
class Invoices extends Controller
|
||||||
{
|
{
|
||||||
@ -489,7 +491,9 @@ class Invoices extends Controller
|
|||||||
{
|
{
|
||||||
$invoice = $this->prepareInvoice($invoice);
|
$invoice = $this->prepareInvoice($invoice);
|
||||||
|
|
||||||
$html = view($invoice->template_path, compact('invoice'))->render();
|
$logo = $this->getLogo();
|
||||||
|
|
||||||
|
$html = view($invoice->template_path, compact('invoice', 'logo'))->render();
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
@ -531,7 +535,9 @@ class Invoices extends Controller
|
|||||||
{
|
{
|
||||||
$invoice = $this->prepareInvoice($invoice);
|
$invoice = $this->prepareInvoice($invoice);
|
||||||
|
|
||||||
return view($invoice->template_path, compact('invoice'));
|
$logo = $this->getLogo();
|
||||||
|
|
||||||
|
return view($invoice->template_path, compact('invoice', 'logo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -545,7 +551,9 @@ class Invoices extends Controller
|
|||||||
{
|
{
|
||||||
$invoice = $this->prepareInvoice($invoice);
|
$invoice = $this->prepareInvoice($invoice);
|
||||||
|
|
||||||
$html = view($invoice->template_path, compact('invoice'))->render();
|
$logo = $this->getLogo();
|
||||||
|
|
||||||
|
$html = view($invoice->template_path, compact('invoice', 'logo'))->render();
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
@ -759,4 +767,31 @@ class Invoices extends Controller
|
|||||||
'sort_order' => $sort_order,
|
'sort_order' => $sort_order,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getLogo()
|
||||||
|
{
|
||||||
|
$logo = '';
|
||||||
|
|
||||||
|
if (setting('general.invoice_logo')) {
|
||||||
|
$file = session('company_id') . '/' . setting('general.invoice_logo');
|
||||||
|
} else {
|
||||||
|
$file = session('company_id') . '/' . setting('general.company_logo');
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = Storage::path($file);
|
||||||
|
if (!$path) {
|
||||||
|
return $logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
$extension = File::extension($path);
|
||||||
|
|
||||||
|
$image = Image::make($path)->encode()->getEncoded();
|
||||||
|
if (empty($image)) {
|
||||||
|
return $logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
$logo = 'data:image/' . $extension . ';base64,' . base64_encode($image);
|
||||||
|
|
||||||
|
return $logo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,7 @@
|
|||||||
<section class="invoice">
|
<section class="invoice">
|
||||||
<div class="row invoice-header">
|
<div class="row invoice-header">
|
||||||
<div class="col-xs-7">
|
<div class="col-xs-7">
|
||||||
@if (setting('general.invoice_logo'))
|
<img src="{{ $logo }}" class="invoice-logo" />
|
||||||
<img src="{{ Storage::url(setting('general.invoice_logo')) }}" class="invoice-logo" />
|
|
||||||
@else
|
|
||||||
<img src="{{ Storage::url(setting('general.company_logo')) }}" class="invoice-logo" />
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-5 invoice-company">
|
<div class="col-xs-5 invoice-company">
|
||||||
<address>
|
<address>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user