Skip to content

Commit

Permalink
close #642 Fixed: Invoices do not have a euro sign (PDF)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 29, 2018
1 parent e000f55 commit 9934ebd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/Expenses/Bills.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ public function pdfBill(Bill $bill)
{
$bill = $this->prepareBill($bill);

$html = view($bill->template_path, compact('bill'))->render();
$currency_style = true;

$html = view($bill->template_path, compact('bill', 'currency_style'))->render();

$pdf = \App::make('dompdf.wrapper');
$pdf->loadHTML($html);
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Incomes/Invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ public function pdfInvoice(Invoice $invoice)
{
$invoice = $this->prepareInvoice($invoice);

$html = view($invoice->template_path, compact('invoice'))->render();
$currency_style = true;

$html = view($invoice->template_path, compact('invoice', 'currency_style'))->render();

$pdf = app('dompdf.wrapper');
$pdf->loadHTML($html);
Expand Down
10 changes: 5 additions & 5 deletions resources/views/expenses/bills/bill.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@
<td class="quantity">{{ $item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="price">@money($item->price, $bill->currency_code, true)</td>
<td class="style-price price">@money($item->price, $bill->currency_code, true)</td>
@stack('price_td_end')
@stack('taxes_td_start')
@stack('taxes_td_end')
@stack('total_td_start')
<td class="total">@money($item->total, $bill->currency_code, true)</td>
<td class="style-price total">@money($item->total, $bill->currency_code, true)</td>
@stack('total_td_end')
</tr>
@endforeach
Expand All @@ -156,20 +156,20 @@
@stack($total->code . '_td_start')
<tr>
<th>{{ trans($total->title) }}:</th>
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
<td class="style-price text-right">@money($total->amount, $bill->currency_code, true)</td>
</tr>
@stack($total->code . '_td_end')
@else
@if ($bill->paid)
<tr class="text-success">
<th>{{ trans('invoices.paid') }}:</th>
<td class="text-right">- @money($bill->paid, $bill->currency_code, true)</td>
<td class="style-price text-right">- @money($bill->paid, $bill->currency_code, true)</td>
</tr>
@endif
@stack('grand_total_td_start')
<tr>
<th>{{ trans($total->name) }}:</th>
<td class="text-right">@money($total->amount - $bill->paid, $bill->currency_code, true)</td>
<td class="style-price text-right">@money($total->amount - $bill->paid, $bill->currency_code, true)</td>
</tr>
@stack('grand_total_td_end')
@endif
Expand Down
21 changes: 16 additions & 5 deletions resources/views/incomes/invoices/invoice.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@
<td class="quantity">{{ $item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="price">@money($item->price, $invoice->currency_code, true)</td>
<td class="style-price price">@money($item->price, $invoice->currency_code, true)</td>
@stack('price_td_end')
@stack('taxes_td_start')
@stack('taxes_td_end')
@stack('total_td_start')
<td class="total">@money($item->total, $invoice->currency_code, true)</td>
<td class="style-price total">@money($item->total, $invoice->currency_code, true)</td>
@stack('total_td_end')
</tr>
@endforeach
Expand All @@ -156,20 +156,20 @@
@stack($total->code . '_td_start')
<tr>
<th>{{ trans($total->title) }}:</th>
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
<td class="style-price text-right">@money($total->amount, $invoice->currency_code, true)</td>
</tr>
@stack($total->code . '_td_end')
@else
@if ($invoice->paid)
<tr class="text-success">
<th>{{ trans('invoices.paid') }}:</th>
<td class="text-right">- @money($invoice->paid, $invoice->currency_code, true)</td>
<td class="style-price text-right">- @money($invoice->paid, $invoice->currency_code, true)</td>
</tr>
@endif
@stack('grand_total_td_start')
<tr>
<th>{{ trans($total->name) }}:</th>
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
<td class="style-price text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
</tr>
@stack('grand_total_td_end')
@endif
Expand All @@ -179,3 +179,14 @@
</div>
</div>
@endsection

@if (isset($currency_style) && $currency_style)
@push('stylesheet')
<style type="text/css">
.style-price {
font-family: sans-serif;
font-size: 15px;
}
</style>
@endpush
@endif
4 changes: 2 additions & 2 deletions resources/views/partials/bill/head.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8; charset=ISO-8859-1"/>

<title>@yield('title') - @setting('general.company_name')</title>

<link rel="stylesheet" href="{{ asset('public/css/invoice.css?v=' . version('short')) }}">

<style type="text/css">
*{
* {
font-family: DejaVu Sans;
}
</style>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/partials/invoice/head.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8; charset=ISO-8859-1"/>

<title>@yield('title') - @setting('general.company_name')</title>

<link rel="stylesheet" href="{{ asset('public/css/invoice.css?v=' . version('short')) }}">

<style type="text/css">
*{
* {
font-family: DejaVu Sans;
}
</style>
Expand Down

0 comments on commit 9934ebd

Please sign in to comment.